Skip to content

Commit

Permalink
chore: upgrade go version to 1.20 (apecloud#2574)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldming authored Apr 14, 2023
1 parent c98dfe9 commit 3d679a5
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/localflows/github-action-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if ! [ -x "$(which act)" ]; then
fi

# run act
act --reuse --platform self-hosted=jashbook/golang-lint:1.19-latest --workflows .github/localflows/cicd-local.yml
act --reuse --platform self-hosted=jashbook/golang-lint:1.20-latest --workflows .github/localflows/cicd-local.yml
2 changes: 1 addition & 1 deletion .github/workflows/cicd-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.20'

- name: start minikube
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cicd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
MAKE_OPS: "build-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "check"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit

check-tools-image:
Expand All @@ -86,7 +86,7 @@ jobs:
MAKE_OPS: "build-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "check"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit

check-helm:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cicd-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20

- name: Check cli doc
id: check-cli-doc
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
MAKE_OPS: "build-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "check"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit

check-tools-image:
Expand All @@ -200,7 +200,7 @@ jobs:
MAKE_OPS: "build-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "check"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit

check-helm:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
MAKE_OPS: "push-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit

release-tools-image:
Expand All @@ -55,5 +55,5 @@ jobs:
MAKE_OPS: "push-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
GO_VERSION: 1.19
GO_VERSION: 1.20
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
GO_VERSION: '1.19'
GO_VERSION: '1.20'
CLI_NAME: 'kbcli'
CLI_REPO: 'apecloud/kbcli'
GITLAB_KBCLI_PROJECT_ID: 85948
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ mod-vendor: module ## Run go mod vendor against go modules.

.PHONY: module
module: ## Run go mod tidy->verify against go modules.
$(GO) mod tidy -compat=1.19
$(GO) mod tidy -compat=1.20
$(GO) mod verify

TEST_PACKAGES ?= ./internal/... ./apis/... ./controllers/... ./cmd/...
Expand Down Expand Up @@ -333,7 +333,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

.PHONY: reviewable
reviewable: generate build-checks test check-license-header ## Run code checks to proceed with PR reviews.
$(GO) mod tidy -compat=1.19
$(GO) mod tidy -compat=1.20

.PHONY: check-diff
check-diff: reviewable ## Run git code diff checker.
Expand Down
2 changes: 1 addition & 1 deletion cmd/probe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can get started with Probe, by any of the following methods:

## 2.1 Build

Compiler `Go 1.19+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.
Compiler `Go 1.20+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.

Use `go build` to build and produce the `probe` binary file. The executable is produced under current directory.

Expand Down
2 changes: 1 addition & 1 deletion cmd/reloader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can get started with Reloader, by any of the following methods:

## 2.1 Build

Compiler `Go 1.19+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.
Compiler `Go 1.20+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.

Use `make reloader` to build and produce the `reloader` binary file. The executable is produced under current directory.

Expand Down
2 changes: 1 addition & 1 deletion cmd/reloader/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You can get started with cue-helper, by the following methods:

## 2.1 Build

Compiler `Go 1.19+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.
Compiler `Go 1.20+` (Generics Programming Support), checking the [Go Installation](https://go.dev/doc/install) to see how to install Go on your platform.

Use `make cue-helper` to build and produce the `cue-helper` binary file. The executable is produced under current directory.

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=${BUILDPLATFORM} golang:1.19 as builder
FROM --platform=${BUILDPLATFORM} golang:1.20 as builder

## docker buildx buid injected build-args:
#BUILDPLATFORM — matches the current machine. (e.g. linux/amd64)
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go/.devcontainer/base.Dockerfile

# [Choice] Go version: 1, 1.19, 1.18, etc
ARG GOVERSION=1.19
ARG GOVERSION=1.20
FROM golang:${GOVERSION}-bullseye

# Copy library scripts to execute
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-tools
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build the kubeblocks tools binaries
# includes kbcli, kubectl, and manager tools.
FROM --platform=${BUILDPLATFORM} golang:1.19 as builder
FROM --platform=${BUILDPLATFORM} golang:1.20 as builder

## docker buildx buid injected build-args:
#BUILDPLATFORM — matches the current machine. (e.g. linux/amd64)
Expand Down
2 changes: 1 addition & 1 deletion docs/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To build `KubeBlocks` on your own host, needs to install the following tools:
- Make

#### Install Go
Download and install [Go 1.19 or later](https://go.dev/doc/install).
Download and install [Go 1.20 or later](https://go.dev/doc/install).
#### Install Make
`KubeBlocks` uses `make` for a variety of build and test actions, and needs to be installed as appropriate for your platform:

Expand Down
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/apecloud/kubeblocks

go 1.19
go 1.20

require (
cuelang.org/go v0.4.3
Expand Down Expand Up @@ -342,7 +342,7 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sys v0.5.0 // indirect
Expand All @@ -369,11 +369,7 @@ require (
)

replace (
// github.com/google/certificate-transparency-go => github.com/google/certificate-transparency-go v1.1.3
// github.com/coreos/etcd => github.com/coreos/etcd v3.5.5+incompatible
github.com/hashicorp/terraform => github.com/apecloud/terraform v1.3.0-20220927
github.com/spf13/afero => github.com/spf13/afero v1.2.2
go.opentelemetry.io/otel => go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.10.0
// go.etcd.io/etcd/v3 => go.etcd.io/etcd/v3 v3.5.5+incompatible
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,8 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 h1:UXLjNohABv4S58tHmeuIZDO6e3mHpW2Dx33gaNt03LE=
go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 h1:FyBZqvoA/jbNzuAWLQE2kG820zMAkcilx6BMjGbL/E4=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296 h1:QJ/xcIANMLApehfgPCHnfK1hZiaMmbaTVmPv7DAoTbo=
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230221090011-e4bae7ad2296/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down
5 changes: 0 additions & 5 deletions internal/cli/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"time"

"github.com/go-logr/logr"
"github.com/google/uuid"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -205,10 +204,6 @@ func DoWithRetry(ctx context.Context, logger logr.Logger, operation func() error
return err
}

func GenRequestID() string {
return uuid.New().String()
}

func PrintGoTemplate(wr io.Writer, tpl string, values interface{}) error {
tmpl, err := template.New("output").Parse(tpl)
if err != nil {
Expand Down

0 comments on commit 3d679a5

Please sign in to comment.