Skip to content

Commit

Permalink
Update Go and GH Action versions (#77)
Browse files Browse the repository at this point in the history
* Update to Go 1.19; Update deprecated actions; Move to golangci-lint

* Update codecov action

* Address linter issues
  • Loading branch information
nirosys authored Mar 30, 2023
1 parent a29daca commit c23f526
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 45 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.13
go-version: 1.19
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive

Expand All @@ -33,29 +33,23 @@ jobs:
run: go test -v ./... -coverprofile coverage.txt

- name: Upload Coverage report to CodeCov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt

imports:
name: Imports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: grandcolline/[email protected]
with:
run: imports
token: ${{ secrets.GITHUB_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@master
- name: check
uses: grandcolline/[email protected]
with:
run: lint
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v4
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: check
uses: golangci/[email protected]
with:
version: 'v1.52'
only-new-issues: true
1 change: 1 addition & 0 deletions base_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (bs *baseSerializer) handleAnnotationsEnd(ionValue hashValue, isContainer b
return nil
}

//nolint:unused
func (bs *baseSerializer) writeSymbol(val string) error {
symbol, err := ion.NewSymbolToken(ion.V1SystemSymbolTable, val)
if err != nil {
Expand Down
38 changes: 19 additions & 19 deletions crypto_hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

"golang.org/x/crypto/blake2b"
"golang.org/x/crypto/blake2s"
"golang.org/x/crypto/md4"
"golang.org/x/crypto/ripemd160"
"golang.org/x/crypto/md4" //nolint: staticcheck
"golang.org/x/crypto/ripemd160" //nolint: staticcheck
"golang.org/x/crypto/sha3"
)

Expand All @@ -35,23 +35,23 @@ type Algorithm string
// Constants for each of the algorithm names supported.
const (
MD4 Algorithm = "MD4"
MD5 = "MD5"
SHA1 = "SHA1"
SHA224 = "SHA224"
SHA256 = "SHA256"
SHA384 = "SHA384"
SHA512 = "SHA512"
RIPEMD160 = "RIPMD160"
SHA3s224 = "SHA3_224"
SHA3s256 = "SHA3_256"
SHA3s384 = "SHA3_384"
SHA3s512 = "SHA3_512"
SHA512s224 = "SHA512_224"
SHA512s256 = "SHA512_256"
BLAKE2s256 = "BLAKE2s_256"
BLAKE2b256 = "BLAKE2b_256"
BLAKE2b384 = "BLAKE2b_384"
BLAKE2b512 = "BLAKE2b_512"
MD5 Algorithm = "MD5"
SHA1 Algorithm = "SHA1"
SHA224 Algorithm = "SHA224"
SHA256 Algorithm = "SHA256"
SHA384 Algorithm = "SHA384"
SHA512 Algorithm = "SHA512"
RIPEMD160 Algorithm = "RIPMD160"
SHA3s224 Algorithm = "SHA3_224"
SHA3s256 Algorithm = "SHA3_256"
SHA3s384 Algorithm = "SHA3_384"
SHA3s512 Algorithm = "SHA3_512"
SHA512s224 Algorithm = "SHA512_224"
SHA512s256 Algorithm = "SHA512_256"
BLAKE2s256 Algorithm = "BLAKE2s_256"
BLAKE2b256 Algorithm = "BLAKE2b_256"
BLAKE2b384 Algorithm = "BLAKE2b_384"
BLAKE2b512 Algorithm = "BLAKE2b_512"
)

// cryptoHasher computes the hash using given algorithm.
Expand Down
4 changes: 2 additions & 2 deletions hash_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ func TestWriteContainers(t *testing.T) {

assert.NoError(t, ionHashWriter.BeginList(), "Something went wrong executing ionHashWriter.BeginList()")

sum, err = ionHashWriter.Sum(nil)
_, err = ionHashWriter.Sum(nil)
assert.Error(t, err, "Expected ionHashWriter.Sum(nil) to return an error")
assert.IsType(t, &InvalidOperationError{}, err,
"Expected ionHashWriter.Sum(nil) to return an InvalidOperationError")

assert.NoError(t, ionHashWriter.WriteBool(true), "Something went wrong executing ionHashWriter.WriteBool(true)")

sum, err = ionHashWriter.Sum(nil)
_, err = ionHashWriter.Sum(nil)
assert.Error(t, err, "Expected ionHashWriter.Sum(nil) to return an error")
assert.IsType(t, &InvalidOperationError{}, err,
"Expected ionHashWriter.Sum(nil) to return an InvalidOperationError")
Expand Down
4 changes: 2 additions & 2 deletions naughty_strings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func newTestValue(ion string) testValue {
if strings.HasPrefix(ion, prefix) {
validIon = true
ion = ion[len(prefix):]
} else if strings.HasPrefix(ion, invalidPrefix) {
ion = ion[len(invalidPrefix):]
} else {
ion = strings.TrimPrefix(ion, invalidPrefix)
}

return testValue{ionPrefix: prefix, invalidIonPrefix: invalidPrefix, ion: ion, validIon: validIon}
Expand Down
1 change: 1 addition & 0 deletions struct_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (ss *structSerializer) stepOut() error {
return ss.baseSerializer.stepOut()
}

//nolint:unused
func (ss *structSerializer) handleAnnotationsBegin(ionValue hashValue) error {
return ss.baseSerializer.handleAnnotationsBegin(ionValue, false)
}
Expand Down

0 comments on commit c23f526

Please sign in to comment.