Skip to content

Update go to 1.20 #937

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

Merged
merged 1 commit into from
Mar 17, 2023
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/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
RUN_ON: github
strategy:
matrix:
go: [ '1.19' ]
go: [ '1.20' ]
name: KinD tests
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up go version
uses: actions/setup-go@v3
with:
go-version: '~1.19' # The Go version to download (if necessary) and use.
go-version: '~1.20' # The Go version to download (if necessary) and use.
- run: go version

- name: Run e2e test on KinD cluster
Expand Down
4 changes: 2 additions & 2 deletions addon/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
AgentImageEnv = "OPERAND_IMAGE_MULTICLUSTER_OPERATORS_SUBSCRIPTION"
)

//nolint
//nolint:all
//go:embed manifests
//go:embed manifests/chart
//go:embed manifests/chart/templates/_helpers.tpl
Expand Down Expand Up @@ -146,7 +146,7 @@ func newRegistrationOption(kubeClient *kubernetes.Clientset, addonName string) *
}
}

//nolint
//nolint:all
func applyManifestFromFile(file, clusterName, addonName string, kubeClient *kubernetes.Clientset) error {
groups := agent.DefaultGroups(clusterName, addonName)
config := struct {
Expand Down
2 changes: 1 addition & 1 deletion addon/addon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func newAgentAddon(t *testing.T) agent.AgentAddon {
return agentAddon
}

// nolint
//nolint:all
func TestManifest(t *testing.T) {
tests := []struct {
name string
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.ci.openshift.org/stolostron/builder:go1.19-linux AS plugin-builder
FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS plugin-builder
ENV POLICY_GENERATOR_TAG=v1.10.0

WORKDIR /policy-generator
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.prow
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.ci.openshift.org/stolostron/builder:go1.19-linux AS builder
FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS builder
ENV POLICY_GENERATOR_TAG=v1.10.0

WORKDIR /go/src/github.com/stolostron/multicluster-operators-subscription
Expand Down
2 changes: 1 addition & 1 deletion build/run-code-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gem install mdl
gem install awesome_bot

# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.46.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin v1.51.2

# Start lint task
make -f Makefile.prow lint-all
6 changes: 4 additions & 2 deletions build/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if [ "$TRAVIS_BUILD" != 1 ]; then
sed -i -e "s|image: .*:latest$|image: $BUILD_IMAGE|" deploy/standalone/operator.yaml

echo -e "\nDownload and install KinD\n"
GO111MODULE=on go get sigs.k8s.io/kind@v0.13.0
go install sigs.k8s.io/kind@v0.17.0


else
Expand All @@ -68,7 +68,7 @@ if [ $? != 0 ]; then
exit $?;
fi

kind create cluster --image=kindest/node:v1.21.1
kind create cluster --image=kindest/node:v1.25.3
if [ $? != 0 ]; then
exit $?;
fi
Expand Down Expand Up @@ -149,6 +149,8 @@ function cleanup()

trap cleanup EXIT

echo -e "\nClean cache\n"
go clean -cache

echo -e "\nStart to run e2e test(s)\n"
go test -v ./e2e
Expand Down
15 changes: 12 additions & 3 deletions common/config/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
service:
# When updating this, also update the version stored in docker/build-tools/Dockerfile in the multicloudlab/tools repo.
golangci-lint-version: 1.46.x # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.51.x # use the fixed version to not introduce new linters unexpectedly
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 20m
timeout: 20m
go: '1.17'

# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
Expand Down Expand Up @@ -33,6 +32,7 @@ linters:
- bodyclose
- contextcheck
- cyclop
- deadcode
- depguard
- dupl
- forbidigo
Expand All @@ -43,6 +43,7 @@ linters:
- exhaustivestruct
- forcetypeassert
- gci
- ginkgolinter
- gochecknoglobals
- gochecknoinits
- goconst
Expand All @@ -57,26 +58,34 @@ linters:
- gosec
- ifshort
- ineffassign
- interfacebloat
- interfacer
- ireturn
- loggercheck
- maintidx
- maligned
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nonamedreturns
- nosnakecase
- paralleltest
- prealloc
- predeclared
- staticcheck
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- tagliatelle
- tenv
- testpackage
- thelper
- usestdlibvars
- varcheck
- varnamelen
- wastedassign
- wrapcheck
Expand Down
2 changes: 1 addition & 1 deletion common/scripts/lint_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2

export GOLANGCI_LINT_CACHE=/tmp/golangci-cache
export GOROOT=`go env GOROOT`
Expand Down
28 changes: 13 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module open-cluster-management.io/multicloud-operators-subscription

go 1.19
go 1.20

require (
github.com/Masterminds/semver/v3 v3.1.1
Expand All @@ -23,20 +23,20 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
golang.org/x/net v0.0.0-20220728030405-41545e8bf201
golang.org/x/net v0.7.0
gomodules.xyz/jsonpatch/v3 v3.0.1
gopkg.in/src-d/go-git.v4 v4.13.1
helm.sh/helm/v3 v3.10.3
k8s.io/api v0.25.2
k8s.io/apiextensions-apiserver v0.25.2
k8s.io/apimachinery v0.25.2
k8s.io/cli-runtime v0.25.2
k8s.io/client-go v12.0.0+incompatible
k8s.io/api v0.25.7
k8s.io/apiextensions-apiserver v0.25.7
k8s.io/apimachinery v0.25.7
k8s.io/cli-runtime v0.25.7
k8s.io/client-go v0.25.7
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.70.1
open-cluster-management.io/addon-framework v0.5.0
open-cluster-management.io/api v0.9.0
open-cluster-management.io/multicloud-operators-channel v0.9.1-0.20221219160726-09c23d2225ac
open-cluster-management.io/multicloud-operators-channel v0.10.1-0.20230316173315-10f48e51f3aa
sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/kustomize/api v0.12.1
sigs.k8s.io/kustomize/kyaml v0.13.9
Expand Down Expand Up @@ -177,9 +177,9 @@ require (
go.starlark.net v0.0.0-20220714194419-4cadf0a12139 // indirect
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/tools v0.1.12 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
Expand All @@ -193,8 +193,8 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.25.2 // indirect
k8s.io/component-base v0.25.2 // indirect
k8s.io/apiserver v0.25.7 // indirect
k8s.io/component-base v0.25.7 // indirect
k8s.io/kube-aggregator v0.24.3 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/kubectl v0.25.2 // indirect
Expand All @@ -205,5 +205,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace k8s.io/client-go => k8s.io/client-go v0.25.0
Loading