diff --git a/.github/labeler.yml b/.github/labeler.yml index 9f25278..f9a3a2e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,23 +1,35 @@ comparers: - - comparers.go - - comparers_test.go + - changed-files: + - any-glob-to-any-file: + - comparers.go + - comparers_test.go slices: - - slices.go - - slices_test.go + - changed-files: + - any-glob-to-any-file: + - slices.go + - slices_test.go strings: - - strings.go - - strings_test.go + - changed-files: + - any-glob-to-any-file: + - strings.go + - strings_test.go errors: - - errors.go - - errors_test.go + - changed-files: + - any-glob-to-any-file: + - errors.go + - errors_test.go documentation: - - README.md + - changed-files: + - any-glob-to-any-file: + - README.md ci: - - .github/* - - .github/**/* - - .golangci.yml + - changed-files: + - any-glob-to-any-file: + - .github/* + - .github/**/* + - .golangci.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e3e541b..83ccb02 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,7 +24,7 @@ jobs: pull-requests: write steps: - - uses: actions/labeler@v3 + - uses: actions/labeler@v6 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" @@ -32,18 +32,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.18", "1.19", "1.20"] + go: ["1.26.4"] steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go }} - - uses: actions/cache@v3 + - uses: actions/cache@v5 with: path: | ~/.cache/go-build @@ -59,36 +59,36 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: - go-version: "1.20" + go-version: "1.26.4" - name: Check for go vulnerabilities run: | go install golang.org/x/vuln/cmd/govulncheck@latest govulncheck ./... - - name: WriteGoList - run: go list -json -m all > go.list - - - name: Nancy - uses: sonatype-nexus-community/nancy-github-action@main - lint: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 + with: + go-version: "1.26.4" + + - id: govulncheck + uses: golang/govulncheck-action@v1 with: - go-version: "1.20" + repo-checkout: 'false' + go-version-input: '1.26.4' - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v9 with: args: --timeout 5m0s diff --git a/.golangci.yml b/.golangci.yml index f687f29..f0847a1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,112 +1,13 @@ -linters-settings: - funlen: - lines: 100 - statements: 50 - cyclop: - skip-tests: true - max-complexity: 30 - package-average: 5 - gocyclo: - min-complexity: 15 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - unlambda - godot: - capital: true - govet: - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - disable-all: true - enable: - - assign - - atomic - - atomicalign - - bools - - buildtag - - cgocall - - composites - - copylocks - - deepequalerrors - - errorsas - - fieldalignment - - findcall - - framepointer - - httpresponse - - ifaceassert - - loopclosure - - lostcancel - - nilfunc - - printf - - reflectvaluecompare - - shift - - sigchanyzer - - sortslice - - stdmethods - - stringintconv - - structtag - - testinggoroutine - - tests - - unmarshal - - unreachable - - unsafeptr - - unusedresult - - misspell: - locale: UK - staticcheck: - checks: ['all'] - stylecheck: - checks: ['all'] - unparam: - check-exported: true - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - bodyclose - - dupl # we usualy duplicate code in tests - - errcheck - - errorlint - - funlen - - gocritic - - govet - - makezero - - unparam - exclude-dirs: - - model - - tmp - - bin - - scripts - fix: true - exclude-use-default: false - +version: "2" run: - timeout: 5m - allow-parallel-runners: true - tests: true build-tags: - integration - + tests: true + allow-parallel-runners: true linters: enable: - - asciicheck - asasalint + - asciicheck - bidichk - bodyclose - containedctx @@ -116,12 +17,9 @@ linters: - dogsled - dupl - durationcheck - - errcheck - errchkjson - errname - errorlint - - execinquery - - exportloopref - forbidigo - forcetypeassert - funlen @@ -132,18 +30,12 @@ linters: - gocyclo - godot - godox - - gofmt - - gofumpt - goheader - - goimports - gomoddirectives - - gomodguard + - gomodguard_v2 - goprintffuncname - - gosimple - - govet - grouper - importas - - ineffassign - maintidx - makezero - misspell @@ -159,12 +51,124 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck - - stylecheck - - tenv - tparallel - - typecheck - unconvert - unparam - - unused - wastedassign - whitespace + settings: + cyclop: + max-complexity: 30 + package-average: 5 + funlen: + lines: 100 + statements: 50 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + disabled-checks: + - unlambda + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 15 + godot: + capital: true + govet: + enable: + - assign + - atomic + - atomicalign + - bools + - buildtag + - cgocall + - composites + - copylocks + - deepequalerrors + - errorsas + - fieldalignment + - findcall + - framepointer + - httpresponse + - ifaceassert + - loopclosure + - lostcancel + - nilfunc + - printf + - reflectvaluecompare + - shift + - sigchanyzer + - sortslice + - stdmethods + - stringintconv + - structtag + - testinggoroutine + - tests + - unmarshal + - unreachable + - unsafeptr + - unusedresult + disable-all: true + settings: + printf: + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + misspell: + locale: UK + staticcheck: + checks: + - all + unparam: + check-exported: true + exclusions: + generated: lax + rules: + - linters: + - bodyclose + - dupl + - errcheck + - errorlint + - funlen + - gocritic + - govet + - makezero + - noctx + - prealloc + - unparam + path: _test\.go + - linters: + - cyclop + path: (.+)_test\.go + paths: + - model + - tmp + - bin + - scripts + - third_party$ + - builtin$ + - examples$ +issues: + fix: true +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - model + - tmp + - bin + - scripts + - third_party$ + - builtin$ + - examples$ diff --git a/go.mod b/go.mod index 8561cd3..a146ec7 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,22 @@ module github.com/blokur/testament -go 1.18 +go 1.26.4 require ( - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 github.com/hashicorp/go-multierror v1.1.1 github.com/pkg/errors v0.9.1 - github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 - google.golang.org/grpc v1.64.0 + github.com/stretchr/testify v1.11.1 + golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9 + google.golang.org/grpc v1.81.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect - google.golang.org/protobuf v1.34.1 // indirect + golang.org/x/sys v0.45.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4c66297..4f60d18 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -11,21 +13,22 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9 h1:4d4PbuBNwaxMXkXI8yiIYjydtMU+04RHeuSxJdgKftM= +golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9/go.mod h1:d2fgXJLVs4dYDHUk5lwMIfzRzSrWCfGZb0ZqeLa/Vcw= +golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= +golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= +golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= 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/net.go b/net.go index e1a97ca..cb2464c 100644 --- a/net.go +++ b/net.go @@ -13,7 +13,7 @@ import ( // listener on test cleanup. func GetFreeOpenPort(t *testing.T) (uint, net.Listener) { t.Helper() - l, err := net.Listen("tcp", ":0") + l, err := net.Listen("tcp", ":0") //nolint:noctx // test helper; no context available require.NoError(t, err, "could not open a port") addr := l.Addr().String() parts := strings.Split(addr, ":")