diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index 269cf7f..3fc852d 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -5,18 +5,18 @@ on: - main - develop pull_request: - jobs: lint: runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v5 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v6 with: - go-version: 1.21.0 - - name: Checkout code - uses: actions/checkout@v3 + go-version-file: go.mod + cache: true - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v8 with: - version: v1.54.2 + version: v2.1 \ No newline at end of file diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index 0f68257..ed3f06d 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -12,10 +12,7 @@ jobs: strategy: matrix: go-version: - - 1.18.x - - 1.19.x - - 1.20.x - - 1.21.x + - 1.24.x runs-on: ubuntu-22.04 steps: - name: Install Go @@ -28,4 +25,3 @@ jobs: - name: Run tests # rapidsnark_noasm build tag is needed for older GitHub Action runners run: go test -tags rapidsnark_noasm -v -covermode=count - diff --git a/.golangci.yml b/.golangci.yml index 0951b41..ade55b1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,84 +1,71 @@ -service: - golangci-lint-version: 1.54.x +version: "2" run: - timeout: 2m - # On linux x86_64 use rapisnark version with disabled asm optimizations - # because GitHub has some amount of older hardware used for action runners.allow-parallel-runners. - # For other platforms this flag is ignored build-tags: - rapidsnark_noasm - skip-dirs: - - vendor - -linters-settings: - govet: - check-shadowing: true - revive: - min-confidence: 0.1 - rules: - # Add more comments for exported functions and remove this rule - - name: package-comments - disabled: true - maligned: - suggest-new: true - goconst: - min-len: 2 - min-occurrences: 2 - misspell: - locale: US - lll: - line-length: 140 - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - hugeParam linters: + default: none enable: - bodyclose - - megacheck - - revive - - govet - - unconvert - - megacheck - - gas - - gocyclo - dupl - - misspell - - unparam - - typecheck - - ineffassign - - stylecheck + - errcheck - gochecknoinits - - exportloopref - gocritic + - gocyclo + - gosec + - govet + - ineffassign + - misspell - nakedret - - gosimple - prealloc + - revive + - staticcheck + - unconvert + - unparam - unused - - goimports + - lll + - goconst + settings: + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + disabled-checks: + - hugeParam + enabled-tags: + - performance + - style + - experimental + govet: + enable: + - shadow + lll: + line-length: 160 + misspell: + locale: US + revive: + confidence: 0.1 + rules: + # Add more comments for exported functions and remove this rule + - name: package-comments + disabled: true + exclusions: + generated: lax + rules: + - linters: + - staticcheck + text: at least one file in a package should have a package comment + - linters: + - revive + text: should have a package comment, unless it's in another file for this package + - linters: + - dupl + - gosec + - lll + path: _test\.go +formatters: + enable: - gofmt - - errcheck - - fast: false - disable-all: true - -issues: - exclude-rules: - # - Fix and remove - - text: "at least one file in a package should have a package comment" - linters: - - stylecheck - # - Fix and remove - - text: "should have a package comment, unless it's in another file for this package" - linters: - - revive - - path: _test\.go - linters: - - gosec - - dupl - exclude-use-default: false + - goimports + - gci diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..269f78d --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +test: + go test -v -count=1 ./... + +lint: + golangci-lint run --config .golangci.yml ./... diff --git a/go.mod b/go.mod index 0efa903..5b976b7 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/iden3/go-jwz/v2 -go 1.18 +go 1.24.0 require ( - github.com/iden3/go-circuits/v2 v2.4.2 + github.com/iden3/go-circuits/v2 v2.4.3 github.com/iden3/go-iden3-core/v2 v2.3.2 github.com/iden3/go-iden3-crypto v0.0.17 - github.com/iden3/go-rapidsnark/prover v0.0.14 + github.com/iden3/go-rapidsnark/prover v0.0.15 github.com/iden3/go-rapidsnark/types v0.0.3 github.com/iden3/go-rapidsnark/verifier v0.0.5 github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 @@ -21,8 +21,8 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/tetratelabs/wazero v1.1.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/sys v0.6.0 // indirect + github.com/tetratelabs/wazero v1.10.1 // indirect + golang.org/x/crypto v0.44.0 // indirect + golang.org/x/sys v0.38.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9624779..f6098bd 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI= github.com/iden3/go-circuits/v2 v2.4.2 h1:n4AaL7kIrmeTUGZdn2e1UL9wmzqcO1glkiZGUQXmagQ= github.com/iden3/go-circuits/v2 v2.4.2/go.mod h1:LnbASvfhsDajwOYSdPmbQ585KuzwHF/AUS7pICol5ss= +github.com/iden3/go-circuits/v2 v2.4.3 h1:J/fAIDl0d/mYWCVDBSIlmtwMbyrIYONRBoAjprlmivQ= +github.com/iden3/go-circuits/v2 v2.4.3/go.mod h1:LnbASvfhsDajwOYSdPmbQ585KuzwHF/AUS7pICol5ss= github.com/iden3/go-iden3-core/v2 v2.3.2 h1:kZq/TiSUmBKO/mvPUucfFE45ugTW+hXXlGT+Jf6CQTg= github.com/iden3/go-iden3-core/v2 v2.3.2/go.mod h1:8vmG6y8k9VS7iNoxuiKukKbRQFsMyabCc+i8er07zOs= github.com/iden3/go-iden3-crypto v0.0.17 h1:NdkceRLJo/pI4UpcjVah4lN/a3yzxRUGXqxbWcYh9mY= @@ -12,6 +14,10 @@ github.com/iden3/go-merkletree-sql/v2 v2.0.6 h1:vsVDImnvnHf7Ggr45ptFOXJyWNA/8IwV github.com/iden3/go-merkletree-sql/v2 v2.0.6/go.mod h1:kRhHKYpui5DUsry5RpveP6IC4XMe6iApdV9VChRYuEk= github.com/iden3/go-rapidsnark/prover v0.0.14 h1:W4UqUQ3pC7/BSIj0km20cRfCzDxd8LbDNDXdsGHpf2Q= github.com/iden3/go-rapidsnark/prover v0.0.14/go.mod h1:mUNLeDXYOW2igiPuhHZHD7kzSp/GjHSWND03aYyECvQ= +github.com/iden3/go-rapidsnark/prover v0.0.15-0.20251113102832-4a52129c3d66 h1:eQ1nu1C+Nzg5fk9OqqDUSdJO+R+rWtwUFMwT1o6XntE= +github.com/iden3/go-rapidsnark/prover v0.0.15-0.20251113102832-4a52129c3d66/go.mod h1:mUNLeDXYOW2igiPuhHZHD7kzSp/GjHSWND03aYyECvQ= +github.com/iden3/go-rapidsnark/prover v0.0.15 h1:es0jUD6GR7jZS6MO92Tjt90edpSWeTsdsm/tah4hLWs= +github.com/iden3/go-rapidsnark/prover v0.0.15/go.mod h1:mUNLeDXYOW2igiPuhHZHD7kzSp/GjHSWND03aYyECvQ= github.com/iden3/go-rapidsnark/types v0.0.3 h1:f0s1Qdut1qHe1O67+m+xUVRBPwSXnq5j0xSrBi0jqM4= github.com/iden3/go-rapidsnark/types v0.0.3/go.mod h1:ApgcaUxKIgSRA6fAeFxK7p+lgXXfG4oA2HN5DhFlfF4= github.com/iden3/go-rapidsnark/verifier v0.0.5 h1:J7y0ovrEjDQoWtZmlrp4tgGng1A9faMeYsQH4igAEqA= @@ -31,10 +37,16 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tetratelabs/wazero v1.1.0 h1:EByoAhC+QcYpwSZJSs/aV0uokxPwBgKxfiokSUwAknQ= github.com/tetratelabs/wazero v1.1.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= +github.com/tetratelabs/wazero v1.10.1 h1:2DugeJf6VVk58KTPszlNfeeN8AhhpwcZqkJj2wwFuH8= +github.com/tetratelabs/wazero v1.10.1/go.mod h1:DRm5twOQ5Gr1AoEdSi0CLjDQF1J9ZAuyqFIjl1KKfQU= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU= +golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/hash_test.go b/hash_test.go index 9faedb5..d498773 100644 --- a/hash_test.go +++ b/hash_test.go @@ -10,7 +10,7 @@ import ( func TestHash(t *testing.T) { - msg := "message" + const msg = "message" h, err := Hash([]byte(msg)) assert.NoError(t, err)