Skip to content

Commit

Permalink
Enforce proper sha256 usage (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Jan 26, 2023
1 parent 76bac93 commit 11843ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ linters:

disable:
- errcheck

linters-settings:
depguard:
include-go-root: true
packages-with-error-message:
- crypto/sha256: "use crypto.SHA256 instead"
1 change: 1 addition & 0 deletions pkg/name/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package name

import (
// nolint: depguard
_ "crypto/sha256" // Recommended by go-digest.
"strings"

Expand Down
3 changes: 1 addition & 2 deletions pkg/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package registry_test

import (
"bytes"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -47,7 +46,7 @@ const (
)

func sha256String(s string) string {
h, _, _ := v1.SHA256(bytes.NewReader([]byte(s)))
h, _, _ := v1.SHA256(strings.NewReader(s))
return h.Hex
}

Expand Down

0 comments on commit 11843ba

Please sign in to comment.