Skip to content

Commit 11843ba

Browse files
authored
Enforce proper sha256 usage (#1544)
1 parent 76bac93 commit 11843ba

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.golangci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ linters:
3232

3333
disable:
3434
- errcheck
35+
36+
linters-settings:
37+
depguard:
38+
include-go-root: true
39+
packages-with-error-message:
40+
- crypto/sha256: "use crypto.SHA256 instead"

pkg/name/digest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package name
1616

1717
import (
18+
// nolint: depguard
1819
_ "crypto/sha256" // Recommended by go-digest.
1920
"strings"
2021

pkg/registry/registry_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package registry_test
1616

1717
import (
18-
"bytes"
1918
"fmt"
2019
"io"
2120
"log"
@@ -47,7 +46,7 @@ const (
4746
)
4847

4948
func sha256String(s string) string {
50-
h, _, _ := v1.SHA256(bytes.NewReader([]byte(s)))
49+
h, _, _ := v1.SHA256(strings.NewReader(s))
5150
return h.Hex
5251
}
5352

0 commit comments

Comments
 (0)