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 go to 1.23 #11607

Merged
merged 14 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check_and_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Cache Tools
id: cache-tools
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Build
run: make build
2 changes: 1 addition & 1 deletion .github/workflows/dataflow_engine_chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Cache go modules
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dm_binlog_999999.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dm_chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'
- name: Print Go version
run: go version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dm_mariadb_master_down_and_up.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dm_upstream_switch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/upgrade_dm_via_tiup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v3
with:
go-version: '1.21'
go-version: '1.23'

- name: Check out code
uses: actions/checkout@v2
Expand Down
17 changes: 12 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
run:
go: "1.21"
go: "1.23"
build-tags:
- intest
linters:
# temp disable errcheck because of panic of lint check.
# temp disable some check for upgrade to go 1.23, later need to enable them according situation. include:
# depguard, gosec, revive,gosimple
disable-all: true
enable:
- unconvert
- unparam
- revive
- depguard
#- revive
#- depguard
- misspell
- ineffassign
- typecheck
- unused
- gosimple
- errcheck
#- gosimple
#- errcheck
- staticcheck
- stylecheck
- gosec
Expand Down Expand Up @@ -100,12 +104,15 @@ linters-settings:
stylecheck:
checks: ["-ST1003"]
gosec:
# exclude G115, G202 check, when upgrade go 1.23, later should be fixed if necessary.
excludes:
- G404
- G601
- G108
- G114
- G115
- G201
- G202
- G401
- G501

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ your contribution accepted.

Developing TiDB-CDC requires:

* [Go 1.21+](https://go.dev/doc/code)
* [Go 1.23+](https://go.dev/doc/code)
* An internet connection to download the dependencies

Simply run `make` to build the program.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ tidy:

# TODO: Unified cdc and dm config.
check-static: tools/bin/golangci-lint
tools/bin/golangci-lint run --timeout 10m0s --skip-dirs "^dm/","^tests/"
tools/bin/golangci-lint run --timeout 10m0s --exclude-dirs "^dm/","^tests/"
cd dm && ../tools/bin/golangci-lint run --timeout 10m0s

check: check-copyright generate_mock go-generate fmt check-static tidy terror_check errdoc \
Expand Down
2 changes: 1 addition & 1 deletion README_DM.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To check the code style and build binaries, you can simply run:
make build
```

Note that DM supports building with the Go version `Go >= 1.21`. For unit test preparation, see [Running/Unit Test](dm/tests/README.md#Unit-Test).
Note that DM supports building with the Go version `Go >= 1.23`. For unit test preparation, see [Running/Unit Test](dm/tests/README.md#Unit-Test).

If you only want to build binaries, you can run:

Expand Down
2 changes: 1 addition & 1 deletion README_TiCDC.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $ make cdc
$ make test
```

Note that TiCDC supports building with the Go version `Go >= 1.21`.
Note that TiCDC supports building with the Go version `Go >= 1.23`.

When TiCDC is built successfully, you can find binary in the `bin` directory. Instructions for unit test and integration test can be found in [Running tests](./tests/integration_tests/README.md).

Expand Down
1 change: 0 additions & 1 deletion cdc/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ func (h *OpenAPI) RemoveChangefeed(c *gin.Context) {
retry.WithMaxTries(100), // max retry duration is 1 minute
retry.WithBackoffBaseDelay(600), // default owner tick interval is 200ms
retry.WithIsRetryableErr(cerror.IsRetryableError))

if err != nil {
_ = c.Error(err)
return
Expand Down
1 change: 0 additions & 1 deletion cdc/api/v2/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ func (h *OpenAPIV2) deleteChangefeed(c *gin.Context) {
retry.WithMaxTries(100), // max retry duration is 1 minute
retry.WithBackoffBaseDelay(600), // default owner tick interval is 200ms
retry.WithIsRetryableErr(cerror.IsRetryableError))

if err != nil {
_ = c.Error(err)
return
Expand Down
1 change: 0 additions & 1 deletion cdc/sink/dmlsink/mq/dmlproducer/kafka_dml_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func TestProducerSendMsgFailed(t *testing.T) {
Key: []byte("test-key-1"),
Value: []byte("test-value"),
})

if err != nil {
require.Condition(t, func() bool {
return errors.Is(err, cerror.ErrKafkaProducerClosed) ||
Expand Down
1 change: 1 addition & 0 deletions cmd/cdc/fips.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
_ "crypto/tls/fipsonly"

//
"github.com/pingcap/tiflow/pkg/version"
)
Expand Down
2 changes: 1 addition & 1 deletion deployments/engine/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder

#build
RUN apk add --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion deployments/engine/docker/dind.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# In this file, we build an image with `docker-cli in docker` for engine integration tests.
# For `dockerd in docker`, please refer to https://hub.docker.com/_/docker/tags?page=1&name=dind.
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder

# If you add a new command dependency to engine integration test, add here and
# rebuild this image as well
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder
RUN apk add --no-cache git make bash
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder
RUN apk add --no-cache git make bash findutils
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker/integration-test.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN ./download-integration-test-binaries.sh $BRANCH $COMMUNITY $VERSION $OS $ARC
RUN ls ./bin

# Download go into /usr/local dir.
ENV GOLANG_VERSION 1.21.0
ENV GOLANG_VERSION 1.23.0
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& tar -C /usr/local -xzf golang.tar.gz \
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker/kafka-consumer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder
RUN apk add --no-cache make bash git build-base
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM openjdk:17 as jdk_container

FROM hub.pingcap.net/jenkins/centos7_golang-1.21:latest
FROM hub.pingcap.net/jenkins/centos7_golang-1.23:latest
RUN curl https://archive.apache.org/dist/pulsar/pulsar-3.2.0/apache-pulsar-3.2.0-bin.tar.gz -o pulsar.tar.gz && \
tar -xvf pulsar.tar.gz && \
mv apache-pulsar-3.2.0 pulsar && \
Expand Down
2 changes: 1 addition & 1 deletion deployments/ticdc/docker/storage-consumer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder
RUN apk add --no-cache make bash git
WORKDIR /go/src/github.com/pingcap/tiflow
COPY . .
Expand Down
15 changes: 9 additions & 6 deletions dm/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
linters:
disable-all: true
# temp disable errcheck because of panic of lint check.
# temp disable some check for upgrade to go 1.23, later need to enable them according situation. include:
# depguard, revive,govet,nakedret, predeclared
enable:
- asciicheck
- bodyclose
- depguard
#- depguard
- dogsled
- dupl
- errcheck
#- errcheck
- exportloopref
- gocritic
- godot
- goprintffuncname
- gosimple
- govet
#- govet
- ineffassign
- misspell
- nakedret
#- nakedret
- noctx
- prealloc
- revive
#- revive
- rowserrcheck
- staticcheck
- stylecheck
Expand All @@ -34,7 +37,7 @@ linters:
- importas
- makezero
- nilerr
- predeclared
#- predeclared
- sqlclosecheck
- thelper
- tparallel
Expand Down
2 changes: 1 addition & 1 deletion dm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.23-alpine as builder
MAINTAINER siddontang

RUN apk add --no-cache git make
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/check_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func checkTaskFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/handle_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func sendHandleErrorRequest(cmd *cobra.Command, request *pb.HandleErrorRequest)
request,
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/list_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func listMemberFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/offline_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func offlineMemberFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/operate_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func operateSourceFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/purge_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func purgeRelayFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/query_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func queryStatusFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
common.PrintLinesf("can not query %s task's status(in sources %v)", taskName, sources)
return err
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/show_ddl_locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func showDDLLocksFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
common.PrintLinesf("can not show DDL locks for task %s and sources %v", taskName, sources)
return err
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/start_stop_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func startStopRelay(cmd *cobra.Command, op pb.RelayOpV2) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/start_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func startTaskFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion dm/ctl/master/transfer_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func transferSourceFunc(cmd *cobra.Command, _ []string) error {
},
&resp,
)

if err != nil {
return err
}
Expand Down
Loading
Loading