-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support go modules add 1.10-1.13 go in travis
- Loading branch information
Jan Seidl
committed
Nov 13, 2019
1 parent
70131fd
commit d77c767
Showing
12 changed files
with
237 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ go: | |
- "1.10" | ||
- 1.11 | ||
- 1.12 | ||
- 1.13 | ||
|
||
install: | ||
- make setup | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3.1 | ||
1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
package pathutil | ||
|
||
import ( | ||
"crypto" | ||
"testing" | ||
|
||
"github.com/JaSei/hashutil-go" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
const emptyFileSha256Hex = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" | ||
|
||
var emptyFileSha256Bin = []uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55} | ||
|
||
func TestPathCrypto(t *testing.T) { | ||
path, err := NewTempFile(TempOpt{}) | ||
assert.Nil(t, err) | ||
defer func() { | ||
assert.NoError(t, path.Remove()) | ||
}() | ||
|
||
hash, err := path.Crypto(crypto.Hash(crypto.SHA256)) | ||
md5Hash, err := path.CryptoMd5() | ||
assert.NoError(t, err) | ||
assert.True(t, hashutil.EmptyMd5().Equal(md5Hash)) | ||
|
||
assert.Equal(t, emptyFileSha256Hex, hash.HexSum()) | ||
assert.Equal(t, emptyFileSha256Bin, hash.BinSum()) | ||
sha1Hash, err := path.CryptoSha1() | ||
assert.NoError(t, err) | ||
assert.True(t, hashutil.EmptySha1().Equal(sha1Hash)) | ||
|
||
sha256Hash, err := path.CryptoSha256() | ||
assert.NoError(t, err) | ||
assert.True(t, hashutil.EmptySha256().Equal(sha256Hash)) | ||
|
||
sha384Hash, err := path.CryptoSha384() | ||
assert.NoError(t, err) | ||
assert.True(t, hashutil.EmptySha384().Equal(sha384Hash)) | ||
|
||
sha512Hash, err := path.CryptoSha512() | ||
assert.NoError(t, err) | ||
assert.True(t, hashutil.EmptySha512().Equal(sha512Hash)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module github.com/JaSei/pathutil-go | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/JaSei/hashutil-go v0.0.0-20191113002909-3ff95654e7b7 | ||
github.com/davecgh/go-spew v1.1.0 | ||
github.com/mitchellh/go-homedir v1.1.0 | ||
github.com/pkg/errors v0.8.1 | ||
github.com/pmezard/go-difflib v1.0.0 | ||
github.com/stretchr/testify v1.4.0 | ||
) |
Oops, something went wrong.