diff --git a/.github/workflows/build-pb-doc.yml b/.github/workflows/build-pb-doc.yml index 5c8a225..e5084fb 100644 --- a/.github/workflows/build-pb-doc.yml +++ b/.github/workflows/build-pb-doc.yml @@ -26,7 +26,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.22 + go-version: 1.23 - name: Install go pkgs run: | diff --git a/.github/workflows/build-tzpb.yml b/.github/workflows/build-tzpb.yml index d3fd8ee..1cd023c 100644 --- a/.github/workflows/build-tzpb.yml +++ b/.github/workflows/build-tzpb.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.21", "1.22"] + go: ["1.22", "1.23"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18447e8..951c6a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,48 +24,34 @@ jobs: run: | deno fmt --check ./README.md - golangci: - name: golangci-lint + build: strategy: matrix: - go: ["1.21", "1.22"] - permissions: - contents: read - pull-requests: read + go: ["1.23"] runs-on: ubuntu-latest - timeout-minutes: 15 steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} + go-version-file: go.mod - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout=5m - build: - strategy: - matrix: - go: ["1.21", "1.22"] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} + skip-cache: true + skip-pkg-cache: true + skip-build-cache: true - name: Install go pkgs run: | make install - name: Run coverage - run: go test -race -coverprofile=coverage.txt -covermode=atomic + run: go test -coverprofile=coverage.txt -covermode=atomic - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 diff --git a/go.mod b/go.mod index 7d4ff38..4192127 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,12 @@ module github.com/ringsaturn/tzf -go 1.22 -toolchain go1.23.0 +go 1.23 require ( github.com/loov/hrtime v1.0.3 github.com/mitchellh/mapstructure v1.5.0 github.com/paulmach/orb v0.11.1 - github.com/ringsaturn/go-cities.json v0.6.1 + github.com/ringsaturn/go-cities.json v0.6.2 github.com/ringsaturn/polyf v0.2.2 github.com/ringsaturn/tzf-rel-lite v0.0.2024-a github.com/tidwall/geojson v1.4.5 diff --git a/go.sum b/go.sum index 8731861..4193809 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKf 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/ringsaturn/go-cities.json v0.6.1 h1:37P320/yLo0IL4+hAQYPXNPNn8pvm497BCtE74EdFIA= -github.com/ringsaturn/go-cities.json v0.6.1/go.mod h1:RWApnQPG6nU558XXbY1try5mi9u9Hd667J6vr948VBo= +github.com/ringsaturn/go-cities.json v0.6.2 h1:7vtbP4JowdESbLFZkcTnCVooKmsGpdk73BT7mvBHSrw= +github.com/ringsaturn/go-cities.json v0.6.2/go.mod h1:RWApnQPG6nU558XXbY1try5mi9u9Hd667J6vr948VBo= github.com/ringsaturn/polyf v0.2.2 h1:71ua1Giawwpb+bvqFelcZygup+0HFuV5hYLA+8YO2ZM= github.com/ringsaturn/polyf v0.2.2/go.mod h1:0+PnAZooWRyH6ULFdxTC86pe15L4VT3e71CQVPG67CE= github.com/ringsaturn/tzf-rel-lite v0.0.2024-a h1:olA5Zh7jE5tXhtHby2hFlZWo4nZJxIzTL7ctGFOa+Uw= diff --git a/tzf_default_finder_test.go b/tzf_default_finder_test.go index 95fcdd8..d60d928 100644 --- a/tzf_default_finder_test.go +++ b/tzf_default_finder_test.go @@ -3,7 +3,6 @@ package tzf_test import ( "bytes" "fmt" - "math/rand" "runtime" "testing" @@ -55,7 +54,7 @@ func BenchmarkDefaultFinder_GetTimezoneName_Random_WorldCities(b *testing.B) { bench := hrtesting.NewBenchmark(b) defer bench.Report() for bench.Next() { - p := gocitiesjson.Cities[rand.Intn(len(gocitiesjson.Cities))] + p := gocitiesjson.Random() _ = defaultFinder.GetTimezoneName(p.Lng, p.Lat) } } diff --git a/tzf_fuzzy_test.go b/tzf_fuzzy_test.go index 5c62c5a..41a5d12 100644 --- a/tzf_fuzzy_test.go +++ b/tzf_fuzzy_test.go @@ -2,7 +2,6 @@ package tzf_test import ( "fmt" - "math/rand" "testing" "github.com/loov/hrtime/hrtesting" @@ -31,7 +30,7 @@ func init() { func TestFuzzySupports(t *testing.T) { failCount := 0 - for _, city := range gocitiesjson.Cities { + for city := range gocitiesjson.All(false) { name := fuzzyFinder.GetTimezoneName(city.Lng, city.Lat) if name == "" { failCount += 1 @@ -76,7 +75,7 @@ func BenchmarkFuzzyFinder_GetTimezoneName_Random_WorldCities(b *testing.B) { bench := hrtesting.NewBenchmark(b) defer bench.Report() for bench.Next() { - p := gocitiesjson.Cities[rand.Intn(len(gocitiesjson.Cities))] + p := gocitiesjson.Random() _ = fuzzyFinder.GetTimezoneName(p.Lng, p.Lat) } } diff --git a/tzf_test.go b/tzf_test.go index 6b63558..df43fd5 100644 --- a/tzf_test.go +++ b/tzf_test.go @@ -3,7 +3,6 @@ package tzf_test import ( "bytes" "fmt" - "math/rand" "runtime" "testing" @@ -48,7 +47,7 @@ func BenchmarkGetTimezoneName_Random_WorldCities(b *testing.B) { bench := hrtesting.NewBenchmark(b) defer bench.Report() for bench.Next() { - p := gocitiesjson.Cities[rand.Intn(len(gocitiesjson.Cities))] + p := gocitiesjson.Random() _ = finder.GetTimezoneName(p.Lng, p.Lat) } }