diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 08e4272..b024289 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,7 +23,7 @@ jobs: uses: pion/.goassets/.github/workflows/test.reusable.yml@master strategy: matrix: - go: ["1.22", "1.21"] # auto-update/supported-go-version-list + go: ["1.23", "1.22"] # auto-update/supported-go-version-list fail-fast: false with: go-version: ${{ matrix.go }} @@ -33,7 +33,7 @@ jobs: uses: pion/.goassets/.github/workflows/test-i386.reusable.yml@master strategy: matrix: - go: ["1.22", "1.21"] # auto-update/supported-go-version-list + go: ["1.23", "1.22"] # auto-update/supported-go-version-list fail-fast: false with: go-version: ${{ matrix.go }} @@ -41,5 +41,5 @@ jobs: test-wasm: uses: pion/.goassets/.github/workflows/test-wasm.reusable.yml@master with: - go-version: "1.22" # auto-update/latest-go-version + go-version: "1.23" # auto-update/latest-go-version secrets: inherit diff --git a/.golangci.yml b/.golangci.yml index e06de4d..a3235be 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,9 @@ # SPDX-FileCopyrightText: 2023 The Pion community # SPDX-License-Identifier: MIT +run: + timeout: 5m + linters-settings: govet: enable: @@ -48,7 +51,7 @@ linters: - goconst # Finds repeated strings that could be replaced by a constant - gocritic # The most opinionated Go source code linter - godox # Tool for detection of FIXME, TODO and other comment keywords - - goerr113 # Golang linter to check the errors handling expressions + - err113 # Golang linter to check the errors handling expressions - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification - gofumpt # Gofumpt checks whether code was gofumpt-ed. - goheader # Checks is file header matches to pattern @@ -83,17 +86,14 @@ linters: - depguard # Go linter that checks if package imports are in a list of acceptable packages - containedctx # containedctx is a linter that detects struct contained context.Context field - cyclop # checks function and package cyclomatic complexity - - exhaustivestruct # Checks if all struct's fields are initialized - funlen # Tool for detection of long functions - gocyclo # Computes and checks the cyclomatic complexity of functions - godot # Check if comments end in a period - gomnd # An analyzer to detect magic numbers. - - ifshort # Checks that your code uses short syntax for if-statements whenever possible - ireturn # Accept Interfaces, Return Concrete Types - lll # Reports long lines - maintidx # maintidx measures the maintainability index of each function. - makezero # Finds slice declarations with non-zero initial length - - maligned # Tool to detect Go structs that would take less memory if their fields were sorted - nakedret # Finds naked returns in functions greater than a specified function length - nestif # Reports deeply nested if statements - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity diff --git a/packetio/buffer_test.go b/packetio/buffer_test.go index 131f066..2f35a4a 100644 --- a/packetio/buffer_test.go +++ b/packetio/buffer_test.go @@ -408,12 +408,12 @@ func TestBufferMisc(t *testing.T) { func TestBufferAlloc(t *testing.T) { packet := make([]byte, 1024) - test := func(f func(count int) func(), count int, max float64) func(t *testing.T) { + test := func(f func(count int) func(), count int, maxVal float64) func(t *testing.T) { return func(t *testing.T) { allocs := testing.AllocsPerRun(3, f(count)) - if allocs > max { + if allocs > maxVal { t.Errorf("count=%v, max=%v, got %v", - count, max, allocs, + count, maxVal, allocs, ) } } diff --git a/test/util.go b/test/util.go index 076be54..b320108 100644 --- a/test/util.go +++ b/test/util.go @@ -60,7 +60,7 @@ func CheckRoutines(t *testing.T) func() { // Checking the state of goroutines exactly is tricky. As users writing // goroutines, we tend to clean up gracefully using some synchronization // pattern. When used correctly, we won't leak goroutines, but we cannot -// gurantee *when* the goroutines will end. This is the nature of waiting +// guarantee *when* the goroutines will end. This is the nature of waiting // on the runtime's goexit1 being called which is the final subroutine // called, which is after any user written code. This small, but possible // chance to have a thread (not goroutine) be preempted before this is diff --git a/utils/xor/xor_test.go b/utils/xor/xor_test.go index 854ae3d..a694359 100644 --- a/utils/xor/xor_test.go +++ b/utils/xor/xor_test.go @@ -32,7 +32,7 @@ func TestXOR(t *testing.T) { t.Fatal(err) } XorBytes(d1, p, q) - n := min(p, q) + n := minInt(p, q) for i := 0; i < n; i++ { d2[i] = p[i] ^ q[i] } @@ -53,7 +53,7 @@ func TestXOR(t *testing.T) { } } -func min(a, b []byte) int { +func minInt(a, b []byte) int { n := len(a) if len(b) < n { n = len(b)