Skip to content

Commit

Permalink
[close #369] *: Upgrade to go1.21 (#370)
Browse files Browse the repository at this point in the history
* upgrade go1.21

Signed-off-by: Ping Yu <[email protected]>

* polish

Signed-off-by: Ping Yu <[email protected]>

* fix CI version

Signed-off-by: Ping Yu <[email protected]>

* fix gosec

Signed-off-by: Ping Yu <[email protected]>

---------

Signed-off-by: Ping Yu <[email protected]>
  • Loading branch information
pingyu authored Nov 27, 2023
1 parent fdb5806 commit 1736954
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-br.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
contents: read

env:
GO_VERSION: 1.20.5
GO_VERSION: 1.21.4

jobs:
br-check-tidy:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
tikv_version: [v6.1.6, v6.5.3, v7.1.0, nightly]
tikv_version: [v6.1.7, v6.5.3, v7.1.2, nightly]
api_version: [1, 2]
with_tls: [false, true]
include:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/ci-cdc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ on:
permissions:
contents: read

env:
GO_VERSION: 1.21.4

jobs:
cdc-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.19.6'
go-version: '${{ env.GO_VERSION }}'
- name: make check
shell: bash
run: |
Expand All @@ -29,7 +32,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.19.6'
go-version: '${{ env.GO_VERSION }}'
- name: make check-gosec
shell: bash
run: |
Expand All @@ -41,7 +44,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.19.6'
go-version: '${{ env.GO_VERSION }}'
- name: make cdc
shell: bash
run: |
Expand Down
10 changes: 5 additions & 5 deletions br/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ your contribution accepted.

Developing BR requires:

* [Go 1.18+](http://golang.org/doc/code.html)
* An internet connection to download the dependencies
- [Go 1.21+](http://golang.org/doc/code.html)
- An internet connection to download the dependencies

Simply run `make` to build the program.

Expand Down Expand Up @@ -60,15 +60,15 @@ We follow a rough convention for commit messages that is designed to answer two
questions: what changed and why. The subject line should feature the what and
the body of the commit should describe the why.

```
```text
restore: add comment for variable declaration
Improve documentation.
```

The format can be described more formally as follows:

```
```text
<subsystem>: <what changed>
<BLANK LINE>
<why this change was made>
Expand All @@ -87,4 +87,4 @@ If the change affects many subsystems, you can use ```*``` instead, like ```*:``

For the why part, if no specific reason for the change,
you can use one of some generic reasons like "Improve documentation.",
"Improve performance.", "Improve robustness.", "Improve test coverage."
"Improve performance.", "Improve robustness.", "Improve test coverage."
2 changes: 1 addition & 1 deletion br/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ make release // build the release binary used for production
$ make test // run unit test
```

*Notice TiKV-BR requires building with Go version `Go >= 1.18`*
*Notice TiKV-BR requires building with Go version `Go >= 1.21`*

When TiKV-BR is built successfully, you can find binary in the `bin` directory.

Expand Down
6 changes: 3 additions & 3 deletions br/deployments/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.18.0-alpine3.15 as builder
RUN apk add --no-cache git make bash
FROM golang:1.21-alpine3.18 as builder
RUN apk add --no-cache git make bash build-base
WORKDIR /go/src/github.com/tikv/migration/br
COPY . .
RUN make release

FROM alpine:3.15
FROM alpine:3.18
RUN apk add --no-cache tzdata bash curl socat
COPY --from=builder /go/src/github.com/tikv/migration/br/bin/tikv-br /usr/bin/
ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion br/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/migration/br

go 1.18
go 1.21

require (
cloud.google.com/go/storage v1.28.1
Expand Down
4 changes: 4 additions & 0 deletions br/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl
cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k=
cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0=
cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM=
cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
Expand Down Expand Up @@ -325,6 +326,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw=
github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
Expand Down Expand Up @@ -1079,6 +1081,7 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -1283,3 +1286,4 @@ sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfp
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
stathat.com/c/consistent v1.0.0 h1:ezyc51EGcRPJUxfHGSgJjWzJdj3NiMU9pNfLNGiXV0c=
stathat.com/c/consistent v1.0.0/go.mod h1:QkzMWzcbB+yQBL2AttO6sgsQS/JSTapcDISJalmCDS0=
4 changes: 2 additions & 2 deletions br/tests/rawkv/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/migration/br/tests/br_rawkv

go 1.18
go 1.21

require (
github.com/coreos/go-semver v0.3.0
Expand All @@ -12,7 +12,7 @@ require (
github.com/tikv/migration/br v0.0.0-20221104062935-658ccf72a949
github.com/tikv/pd/client v0.0.0-20220307081149-841fa61e9710
go.uber.org/zap v1.21.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sync v0.1.0
google.golang.org/grpc v1.56.3
)

Expand Down
2 changes: 2 additions & 0 deletions br/tests/rawkv/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
2 changes: 1 addition & 1 deletion br/tools/check/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ require (
honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3
)

go 1.18
go 1.21
2 changes: 1 addition & 1 deletion cdc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ tools/bin/errdoc-gen: tools/check/go.mod
cd tools/check && $(GO) build -mod=mod -o ../bin/errdoc-gen github.com/pingcap/errors/errdoc-gen

tools/bin/gosec:
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b tools/bin v2.12.0
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b tools/bin v2.18.2

check_failpoint_ctl: tools/bin/failpoint-ctl

Expand Down
4 changes: 2 additions & 2 deletions cdc/deployments/tikv-cdc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.18.0-alpine3.15 as builder
FROM golang:1.21-alpine3.18 as builder
RUN apk add --no-cache git make bash
WORKDIR /go/src/github.com/tikv/migration/cdc
COPY . .
ENV CDC_ENABLE_VENDOR=0
RUN make release

FROM alpine:3.15
FROM alpine:3.18
RUN apk add --no-cache tzdata bash curl socat
COPY --from=builder /go/src/github.com/tikv/migration/cdc/bin/tikv-cdc /usr/bin/
# TiKV-CDC use TiCDC operator to run TiKV-CDC server, TiCDC operator will use '/cdc' to start server
Expand Down
4 changes: 2 additions & 2 deletions cdc/deployments/tikv-cdc/docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.0-alpine3.15 as builder
FROM golang:1.21-alpine3.18 as builder
RUN apk add --no-cache git make bash
WORKDIR /go/src/github.com/tikv/migration/cdc
COPY . .
Expand All @@ -8,7 +8,7 @@ RUN make failpoint-enable
RUN make
RUN make failpoint-disable

FROM alpine:3.15
FROM alpine:3.18
RUN apk add --no-cache tzdata bash curl socat
COPY --from=builder /go/src/github.com/tikv/migration/cdc/bin/tikv-cdc /usr/bin/
# TiKV-CDC use TiCDC operator to run TiKV-CDC server, TiCDC operator will use '/cdc' to start server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN ./download-integration-test-binaries.sh master
RUN ls ./bin

# Download go into /usr/local dir.
ENV GOLANG_VERSION 1.18.5
ENV GOLANG_VERSION 1.21
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 9e5de37f9c49942c601b191ac5fba404b868bfc21d446d6960acc12283d6e5f2
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
Expand Down
2 changes: 1 addition & 1 deletion cdc/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tikv/migration/cdc

go 1.19
go 1.21

require (
github.com/BurntSushi/toml v1.2.1
Expand Down
Loading

0 comments on commit 1736954

Please sign in to comment.