Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ excludes = [
'G304',
'G307',
'G702',
'G706'
'G706',
]
includes = [
'G501', # Import blocklist: crypto/md5
'G502', # Import blocklist: crypto/des
'G503', # Import blocklist: crypto/rc4
'G504', # Import blocklist: net/http/cgi
'G505', # Import blocklist: crypto/sha1
'G506', # Import blocklist: golang.org/x/crypto/md4
'G507', # Import blocklist: golang.org/x/crypto/ripemd160
]

[linters.settings.gosec.config]
Expand Down
8 changes: 4 additions & 4 deletions mage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mage

import (
"context"
"crypto/sha256"
"crypto/sha3"
"errors"
"flag"
"fmt"
Expand Down Expand Up @@ -682,13 +682,13 @@ func ExeName(goCmd, cacheDir string, files []string) (string, error) {
}
// hash the mainfile template to ensure if it gets updated, we make a new
// binary.
hashes = append(hashes, fmt.Sprintf("%x", sha256.Sum256([]byte(mageMainfileTplString))))
hashes = append(hashes, fmt.Sprintf("%x", sha3.Sum256([]byte(mageMainfileTplString))))
sort.Strings(hashes)
ver, err := internal.OutputDebug(goCmd, "version")
if err != nil {
return "", err
}
hash := sha256.Sum256([]byte(strings.Join(hashes, "") + magicRebuildKey + ver))
hash := sha3.Sum256([]byte(strings.Join(hashes, "") + magicRebuildKey + ver))
filename := fmt.Sprintf("%x", hash)

out := filepath.Join(cacheDir, filename)
Expand All @@ -705,7 +705,7 @@ func hashFile(fn string) (string, error) {
}
defer f.Close()

h := sha256.New()
h := sha3.New256()
if _, err := io.Copy(h, f); err != nil {
return "", fmt.Errorf("can't write data to hash: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion mg/fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestFuncCheck(t *testing.T) {
t.Error("func is not on a namespace")
}

hasContext, isNamespace, err = checkF(Foo.Bare, nil)
_, _, err = checkF(Foo.Bare, nil)
if err != nil {
t.Error(err)
}
Expand Down