Skip to content

Commit

Permalink
Bump Go version to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Aug 11, 2023
1 parent bc609d2 commit 9337799
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 86 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/build-pb-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.21

- name: Install go pkgs
run: |
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/build-tzpb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,17 @@ env:
jobs:
build-tzpb-pipeline:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.20", "1.21"]

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install go pkgs
run: |
make install
- name: Install test related deps
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest

- name: Test
run: |
make test
go-version: ${{ matrix.go }}

- name: Download files
run: |
Expand Down
89 changes: 39 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,64 @@ permissions:
deployments: write

jobs:
build:
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Lint README
run: |
deno fmt --check ./README.md
golangci:
name: golangci-lint
strategy:
matrix:
go: ["1.20", "1.21"]
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: ${{ matrix.go }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=5m
build:
strategy:
matrix:
go: ["1.20", "1.21"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: ${{ matrix.go }}

- name: Install go pkgs
run: |
make install
- name: Install test related deps
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest

- name: Lint
run: golangci-lint run ./...

- name: Run coverage
run: go test -race -coverprofile=coverage.txt -covermode=atomic

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

- name: Bench
run: |
make bench | tee benchmark_result.txt
# - name: Continuous Benchmark
# uses: benchmark-action/github-action-benchmark@v1.15.0
# if: ${{ github.ref == 'refs/heads/main' }}
# with:
# name: Go Benchmark
# tool: "go"
# output-file-path: benchmark_result.txt
# github-token: ${{ secrets.CI_TOKEN }}
# gh-repository: "github.com/ringsaturn/tzf"
# auto-push: true
# alert-threshold: "150%"
# comment-on-alert: true
# fail-on-alert: false
# # gh-pages-branch: "master"
# benchmark-data-dir-path: "docs/"
# alert-comment-cc-users: "@ringsaturn"

- name: Summary
run: |
set +e
echo "## Go" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat benchmark_result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Lint README
run: |
deno fmt --check ./README.md
run: make bench | tee benchmark_result.txt
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ringsaturn/tzf

go 1.19
go 1.21

require (
github.com/loov/hrtime v1.0.3
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
Expand Down
2 changes: 0 additions & 2 deletions preindex/preindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"fmt"
"math/rand"
"runtime"
"time"

"github.com/paulmach/orb"
"github.com/paulmach/orb/maptile"
Expand Down Expand Up @@ -252,7 +251,6 @@ func PreIndexTimezones(input *pb.Timezones, idxZoom, aggZoom, maxZoomLevelToKeep
for i := 0; i < len(input.Timezones); i++ {
taskIds = append(taskIds, i)
}
rand.Seed(time.Now().UnixNano())
rand.Shuffle(len(taskIds), func(i, j int) { taskIds[i], taskIds[j] = taskIds[j], taskIds[i] })

m := map[string][]*pb.PreindexTimezone{}
Expand Down
4 changes: 2 additions & 2 deletions tzf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ package tzf
import (
"errors"
"fmt"
"sort"

"github.com/ringsaturn/tzf/convert"
"github.com/ringsaturn/tzf/pb"
"github.com/ringsaturn/tzf/reduce"
"github.com/tidwall/geojson/geometry"
"github.com/tidwall/rtree"
"golang.org/x/exp/slices"
)

var ErrNoTimezoneFound = errors.New("tzf: no timezone found")
Expand Down Expand Up @@ -241,7 +241,7 @@ func (f *Finder) GetTimezoneNames(lng float64, lat float64) ([]string, error) {
for i := 0; i < len(item); i++ {
ret = append(ret, item[i].name)
}
sort.Strings(ret)
slices.Sort(ret)
return ret, nil
}

Expand Down

0 comments on commit 9337799

Please sign in to comment.