Skip to content

Commit

Permalink
fix: fix golint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
duke-git committed Jan 1, 2024
1 parent 4afc838 commit b2c3fa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fileutil/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func Sha(filepath string, shaType ...int) (string, error) {
} else if shaType[0] == 512 {
h = sha512.New()
} else {
return "", errors.New("param `shaType` should be 1, 256 or 512.")
return "", errors.New("param `shaType` should be 1, 256 or 512")
}
}

Expand Down
6 changes: 5 additions & 1 deletion fileutil/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,14 @@ func TestSha(t *testing.T) {
assert := internal.NewAssert(t, "TestSha")

sha1, err := Sha("./testdata/test.txt", 1)
assert.IsNil(err)

sha256, err := Sha("./testdata/test.txt", 256)
sha512, err := Sha("./testdata/test.txt", 512)
assert.IsNil(err)

sha512, err := Sha("./testdata/test.txt", 512)
assert.IsNil(err)

assert.Equal("dda3cf10c5a6ff6c6659a497bf7261b287af2bc7", sha1)
assert.Equal("aa6d0a3fbc3442c228d606da09e0c1dc98c69a1cac3da1909199e0266171df35", sha256)
assert.Equal("d22aba2a1b7a2e2f512756255cc1c3708905646920cb1eb95e45b531ba74774dbbb89baebf1f716220eb9cf4908f1cfc5b2a01267704d9a59f59d77cab609870", sha512)
Expand Down

0 comments on commit b2c3fa0

Please sign in to comment.