Skip to content

Commit

Permalink
CLOUDP-269300: Bump to Go 1.23 (#1841)
Browse files Browse the repository at this point in the history
* Bump Go & golangci

* Replace deprecated linter

* Remedy linter errors

* Update licenses

* Move to go 1.23

* Try fix the licenses issue

* Bump all images to 1.23 also

* Apply suggestions from code review

Use %w for error wrapping

Co-authored-by: Sergiusz Urbaniak <[email protected]>
Signed-off-by: jose.vazquez <[email protected]>

* Apply suggestions from code review

Revert to use `%s` again, because `stat.Error` is a `string` and thus cannot be wrapped as an error.

---------

Signed-off-by: jose.vazquez <[email protected]>
Co-authored-by: jose.vazquez <[email protected]>
Co-authored-by: Sergiusz Urbaniak <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent ea489f0 commit 2921cce
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/actions/gen-install-scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22
FROM golang:1.23

ENV KUBECTL_VERSION 1.18.12
ENV GO111MODULE on
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
- dupl
- errcheck
- errorlint
- exportloopref
- copyloopvar
#- gocritic
- gocyclo
- goimports
Expand Down
2 changes: 1 addition & 1 deletion .licenses-gomod.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
100644 c4cf9120e81ef4e31f288eef5adccbba2862f023 go.mod
100644 6a6da89744c37c3cd16ce3e453f217e5927c2860 go.mod
2 changes: 1 addition & 1 deletion Dockerfile.post-install
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22 as builder
FROM golang:1.23 as builder

ENV CGO_ENABLED=0
ENV GOOS=linux
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ATLAS_KEY_SECRET_NAME = mongodb-atlas-operator-api-key

BASE_GO_PACKAGE = github.com/mongodb/mongodb-atlas-kubernetes/v2
GO_LICENSES = go-licenses
GO_LICENSES_VERSION = 1.6.0
KUSTOMIZE = kustomize
DISALLOWED_LICENSES = restricted,reciprocal

Expand Down Expand Up @@ -126,9 +127,9 @@ all: manager ## Build all binaries
build-licenses.csv: go.mod ## Track licenses in a CSV file
@echo "Tracking licenses into file $@"
@echo "========================================"
GOOS=linux GOARCH=amd64 go mod download
# https://github.com/google/go-licenses/issues/244
GOTOOLCHAIN=local GOOS=linux GOARCH=amd64 $(GO_LICENSES) csv --include_tests $(BASE_GO_PACKAGE)/... > licenses.csv
export GOOS=linux
export GOARCH=amd64
go run github.com/google/$(GO_LICENSES)@v$(GO_LICENSES_VERSION) csv --include_tests $(BASE_GO_PACKAGE)/... > licenses.csv
echo $(GOMOD_SHA) > $(LICENSES_GOMOD_SHA_FILE)

.PHONY: recompute-licenses
Expand All @@ -145,8 +146,9 @@ licenses-up-to-date: ## Check if the licenses.csv is up to date
check-licenses: licenses-up-to-date ## Check licenses are compliant with our restrictions
@echo "Checking licenses not to be: $(DISALLOWED_LICENSES)"
@echo "============================================"
# https://github.com/google/go-licenses/issues/244
GOTOOLCHAIN=local GOOS=linux GOARCH=amd64 $(GO_LICENSES) check --include_tests \
export GOOS=linux
export GOARCH=amd64
go run github.com/google/$(GO_LICENSES)@v$(GO_LICENSES_VERSION) check --include_tests \
--disallowed_types $(DISALLOWED_LICENSES) $(BASE_GO_PACKAGE)/...
@echo "--------------------"
@echo "Licenses check: PASS"
Expand Down
5 changes: 2 additions & 3 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"yq-go@latest",
"[email protected]",
"jq@latest",
"go@1.22.5",
"go@1.23",
"gotests@latest",
"act@latest",
"kubectl@latest",
Expand All @@ -16,11 +16,10 @@
"kubernetes-helm@latest",
"govulncheck@latest",
"gotools@latest",
"go-licenses@latest",
"ginkgo@latest",
"[email protected]",
"shellcheck@latest",
"golangci-lint@1.59.1",
"golangci-lint@1.60",
"[email protected]"
]
}
Loading

0 comments on commit 2921cce

Please sign in to comment.