diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 20df7ea..f9be4fc 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.24 + go-version: 1.25 - name: Write coverage profile run: go test -v ./... -coverprofile=./coverage.txt -covermode=atomic @@ -44,17 +44,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go_versions: [ '1.23', '1.24' ] + go_versions: [ '1.24', '1.25' ] os: [ubuntu-latest, windows-2022, macos-14] exclude: # Only latest Go version for Windows and MacOS. - os: windows-2022 - go_versions: '1.23' + go_versions: '1.24' - os: macos-14 - go_versions: '1.23' + go_versions: '1.24' # Exclude latest Go version for Ubuntu as Coverage uses it. - os: ubuntu-latest - go_versions: '1.24' + go_versions: '1.25' fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/go.mod b/go.mod index 0f73cba..627d352 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/nspcc-dev/go-ordered-json -go 1.22 +go 1.24 diff --git a/number_test.go b/number_test.go index 1d45b8e..5d57bb0 100644 --- a/number_test.go +++ b/number_test.go @@ -119,7 +119,7 @@ func TestNumberIsValid(t *testing.T) { func BenchmarkNumberIsValid(b *testing.B) { s := "-61657.61667E+61673" - for range b.N { + for b.Loop() { isValidNumber(s) } } @@ -127,7 +127,7 @@ func BenchmarkNumberIsValid(b *testing.B) { func BenchmarkNumberIsValidRegexp(b *testing.B) { var jsonNumberRegexp = regexp.MustCompile(`^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$`) s := "-61657.61667E+61673" - for range b.N { + for b.Loop() { jsonNumberRegexp.MatchString(s) } } diff --git a/scanner_test.go b/scanner_test.go index b540318..e7eb0ce 100644 --- a/scanner_test.go +++ b/scanner_test.go @@ -230,8 +230,7 @@ var benchScan scanner func BenchmarkSkipValue(b *testing.B) { initBig() - b.ResetTimer() - for range b.N { + for b.Loop() { _, _, _ = nextValue(jsonBig, &benchScan) } b.SetBytes(int64(len(jsonBig))) diff --git a/tags.go b/tags.go index c38fd51..3109208 100644 --- a/tags.go +++ b/tags.go @@ -28,17 +28,10 @@ func (o tagOptions) Contains(optionName string) bool { if len(o) == 0 { return false } - s := string(o) - for s != "" { - var next string - i := strings.Index(s, ",") - if i >= 0 { - s, next = s[:i], s[i+1:] - } + for s := range strings.FieldsFuncSeq(string(o), func(c rune) bool { return c == ',' }) { if s == optionName { return true } - s = next } return false }