Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to go 1.23 #44

Closed
wants to merge 12 commits into from
16 changes: 3 additions & 13 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Checkout code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
path: |
~/go/pkg/mod
~/.cache/go-build
**/.dashboard_download_cache
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang
go-version: 1.23
- name: Make Check
run: |
make build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
add_labels:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
- uses: actions/github-script@v7
name: Add labels
with:
script: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pd-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
strategy:
fail-fast: true
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Make
run: make docker-image
26 changes: 9 additions & 17 deletions .github/workflows/pd-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ jobs:
outputs:
job-total: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Checkout code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
path: |
~/go/pkg/mod
~/.cache/go-build
**/.tools
**/.dashboard_download_cache
key: ${{ runner.os }}-go-${{ matrix.worker_id }}-${{ hashFiles('**/go.sum') }}
go-version: "1.23"
- name: Make Test
env:
WORKER_ID: ${{ matrix.worker_id }}
Expand All @@ -49,20 +40,21 @@ jobs:
mv covprofile covprofile_$WORKER_ID
sed -i "/failpoint_binding/d" covprofile_$WORKER_ID
- name: Upload coverage result ${{ matrix.worker_id }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cover-reports
name: cover-reports-${{ matrix.worker_id }}
path: covprofile_${{ matrix.worker_id }}
report-coverage:
needs: chunks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download chunk report
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: cover-reports
pattern: cover-reports-*
merge-multiple: true
- name: Merge
env:
TOTAL_JOBS: ${{needs.chunks.outputs.job-total}}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tso-consistency-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
tso-consistency-test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Make TSO Consistency Test
run: make test-tso-consistency
8 changes: 4 additions & 4 deletions .github/workflows/tso-function-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
tso-function-test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Make TSO Function Test
run: make test-tso-function
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ linters-settings:
excludes:
- G402
- G404
# TODO: enable G115 after fixing the issues
# It is consistent with https://github.com/tikv/pd/pull/8637
- G115
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine as builder
FROM golang:1.23-alpine as builder

RUN apk add --no-cache \
make \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)

install-tools:
@mkdir -p $(GO_TOOLS_BIN_PATH)
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.48.0
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.61.0
@grep '_' tools.go | sed 's/"//g' | awk '{print $$2}' | xargs go install

.PHONY: install-tools
Expand Down
8 changes: 4 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ func (c *client) ScanRegions(ctx context.Context, key, endKey []byte, limit int)
defer span.Finish()
}
start := time.Now()
defer cmdDurationScanRegions.Observe(time.Since(start).Seconds())
defer func() { cmdDurationScanRegions.Observe(time.Since(start).Seconds()) }()

var cancel context.CancelFunc
scanCtx := ctx
Expand Down Expand Up @@ -1865,7 +1865,7 @@ func (c *client) StoreGlobalConfig(ctx context.Context, items []GlobalConfigItem
}
resErr := res.GetError()
if resErr != nil {
return errors.Errorf("[pd]" + resErr.Message)
return errors.New("[pd]" + resErr.Message)
}
return err
}
Expand Down Expand Up @@ -1914,7 +1914,7 @@ func (c *client) GetExternalTimestamp(ctx context.Context) (uint64, error) {
}
resErr := resp.GetHeader().GetError()
if resErr != nil {
return 0, errors.Errorf("[pd]" + resErr.Message)
return 0, errors.New("[pd]" + resErr.Message)
}
return resp.GetTimestamp(), nil
}
Expand All @@ -1929,7 +1929,7 @@ func (c *client) SetExternalTimestamp(ctx context.Context, timestamp uint64) err
}
resErr := resp.GetHeader().GetError()
if resErr != nil {
return errors.Errorf("[pd]" + resErr.Message)
return errors.New("[pd]" + resErr.Message)
}
return nil
}
Expand Down
33 changes: 27 additions & 6 deletions client/go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
module github.com/tikv/pd/client

go 1.16
go 1.23

require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c
github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00
github.com/pingcap/kvproto v0.0.0-20230726063044-73d6d7f3756b
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3
github.com/prometheus/client_golang v1.11.1
github.com/stretchr/testify v1.7.0
go.uber.org/goleak v1.1.11
github.com/stretchr/testify v1.8.3
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.20.0
golang.org/x/text v0.3.8 // indirect
google.golang.org/grpc v1.43.0
google.golang.org/grpc v1.58.3
)

require (
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading