From 1eff7e96a13ba9c2f405130b15221fea5cfe573d Mon Sep 17 00:00:00 2001 From: Calin Don Date: Fri, 19 May 2023 23:36:49 +0300 Subject: [PATCH] Build using golang 1.17.x --- .drone.yml | 28 ++++----- .golangci.yaml | 19 +++++++ Makefile | 4 +- go.mod | 57 ++++++++++++++++++- .../mysql/v1alpha1/zz_generated.deepcopy.go | 1 + .../mysql/v1alpha1/zz_generated.defaults.go | 1 + 6 files changed, 93 insertions(+), 17 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5a2eb8c09..54d487e14 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,32 +17,32 @@ steps: tags: true - name: install dependencies - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 commands: - make -j4 build.tools - name: verify generated code - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 commands: - make generate - git diff --exit-code - name: lint - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 commands: - make -j4 lint - name: test - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: ACK_GINKGO_DEPRECATIONS: 1.16.4 commands: - make test - name: build - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 commands: - - make -j4 build + - make build services: - name: docker @@ -80,12 +80,12 @@ steps: tags: true - name: build - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 commands: - - make -j4 build + - make build - name: publish - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: DOCKER_REGISTRY: docker.io/bitpoke DOCKER_USERNAME: bitpokebot @@ -135,7 +135,7 @@ steps: tags: true - name: create gke cluster - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: &e2eEnvironment # set version in stone, as we need stable tags for e2e testing VERSION: ${DRONE_COMMIT} @@ -156,7 +156,7 @@ steps: --monitoring=NONE - name: build - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 volumes: - name: dockersock path: /var/run @@ -167,7 +167,7 @@ steps: - git - name: publish e2e images - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: <<: *e2eEnvironment commands: @@ -178,7 +178,7 @@ steps: - build - name: e2e test - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: <<: *e2eEnvironment GOOGLE_CLOUD_CLUSTER: mysql-operator-e2e-testing-${DRONE_COMMIT:0:8} @@ -191,7 +191,7 @@ steps: - create gke cluster - name: delete gke cluster - image: docker.io/bitpoke/build:v0.7.0 + image: docker.io/bitpoke/build:v0.8.3 environment: <<: *e2eEnvironment commands: diff --git a/.golangci.yaml b/.golangci.yaml index 85a840296..0c0bd1c60 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -35,6 +35,25 @@ linters: - goimports - maligned - gochecknoglobals + # TODO: fix those linters (they were added for 1.42.1 upgrade) + - sqlclosecheck + - gosec + - cyclop + - forcetypeassert + - revive + - gofumpt + - errorlint + - exhaustivestruct + - goerr113 + - gosimple + - ifshort + - noctx + - predeclared + - nlreturn + - tagliatelle + - wrapcheck + - gci + - nolintlint # TODO: fix those linters - whitespace - scopelint diff --git a/Makefile b/Makefile index a928db274..3f46b83a0 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,9 @@ include build/makelib/common.mk GO111MODULE=on GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/mysql-operator $(GO_PROJECT)/cmd/mysql-operator-sidecar $(GO_PROJECT)/cmd/orc-helper -GOLANGCI_LINT_VERSION = 1.25.0 +GO_SUPPORTED_VERSIONS = 1.17 +GOFMT_VERSION = 1.17 +GOLANGCI_LINT_VERSION = 1.42.1 GO_LDFLAGS += \ -X $(GO_PROJECT)/pkg/version.buildDate=$(BUILD_DATE) \ -X $(GO_PROJECT)/pkg/version.gitVersion=$(VERSION) \ diff --git a/go.mod b/go.mod index 1e946d3c1..77287162b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bitpoke/mysql-operator -go 1.16 +go 1.17 require ( github.com/blang/semver v3.5.1+incompatible @@ -17,7 +17,6 @@ require ( github.com/spf13/cobra v1.1.1 github.com/spf13/pflag v1.0.5 golang.org/x/net v0.8.0 - gopkg.in/ini.v1 v1.57.0 // indirect // kubernetes k8s.io/api v0.21.4 @@ -28,3 +27,57 @@ require ( sigs.k8s.io/controller-runtime v0.9.7 sigs.k8s.io/testing_frameworks v0.1.2 ) + +require ( + cloud.google.com/go v0.54.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/blendle/zapdriver v1.3.1 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/evanphx/json-patch v4.11.0+incompatible // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-logr/zapr v0.4.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.5 // indirect + github.com/google/gofuzz v1.1.0 // indirect + github.com/google/uuid v1.1.2 // indirect + github.com/googleapis/gnostic v0.5.5 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/moby/spdystream v0.2.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/nxadm/tail v1.4.8 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.11.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.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.19.0 // indirect + golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/term v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect + golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.26.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.57.0 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + k8s.io/apiextensions-apiserver v0.21.4 // indirect + k8s.io/component-base v0.21.4 // indirect + k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect + k8s.io/utils v0.0.0-20210802155522-efc7438f0176 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect + sigs.k8s.io/yaml v1.2.0 // indirect +) diff --git a/pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go index b9b3164e5..f41327f2f 100644 --- a/pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/mysql/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/pkg/apis/mysql/v1alpha1/zz_generated.defaults.go b/pkg/apis/mysql/v1alpha1/zz_generated.defaults.go index 189f2da98..dcea3741b 100644 --- a/pkg/apis/mysql/v1alpha1/zz_generated.defaults.go +++ b/pkg/apis/mysql/v1alpha1/zz_generated.defaults.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /*