From 255b4c1332043b2ebe25bb358570e3dd2eed8898 Mon Sep 17 00:00:00 2001 From: Aniruddha Basak Date: Tue, 12 Sep 2023 20:48:47 +0530 Subject: [PATCH] Bump golang 1.20 => 1.21 Signed-off-by: Aniruddha Basak --- .github/renovate/golang.json5 | 4 ++-- .golangci-suggestions.yaml | 19 +++++++++++++------ .golangci.yaml | 8 ++++---- go.mod | 2 +- hack/golang-modules-update.sh | 5 ++--- images/builder/Dockerfile | 8 ++++---- images/caph/Dockerfile | 4 ++-- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/renovate/golang.json5 b/.github/renovate/golang.json5 index cb71f33cd..64557900b 100644 --- a/.github/renovate/golang.json5 +++ b/.github/renovate/golang.json5 @@ -4,7 +4,7 @@ }, // https://docs.renovatebot.com/configuration-options/#constraints "constraints": { - "go": "1.20" + "go": "1.21" }, packageRules: [ { @@ -41,4 +41,4 @@ enabled: false, }, ], -} \ No newline at end of file +} diff --git a/.golangci-suggestions.yaml b/.golangci-suggestions.yaml index df30fcad1..b63852273 100644 --- a/.golangci-suggestions.yaml +++ b/.golangci-suggestions.yaml @@ -94,9 +94,9 @@ linters-settings: allow-leading-space: false require-specific: true staticcheck: - go: "1.20" + go: "1.21" stylecheck: - go: "1.20" + go: "1.21" gocritic: enabled-tags: - diagnostic @@ -151,7 +151,14 @@ linters-settings: severity: warning disabled: false arguments: - - ["call-chain", "loop", "method-call", "recover", "immediate-recover", "return"] # yamllint disable-line rule:line-length + - [ + "call-chain", + "loop", + "method-call", + "recover", + "immediate-recover", + "return", + ] # yamllint disable-line rule:line-length # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported - name: exported severity: warning @@ -218,7 +225,7 @@ linters-settings: - ["ID"] # AllowList - ["VM"] # DenyList unused: - go: "1.20" + go: "1.21" usestdlibvars: # Suggest the use of http.MethodXX. # Default: true @@ -276,8 +283,8 @@ issues: exclude-use-default: false run: timeout: 10m - go: "1.20" + go: "1.21" allow-parallel-runners: true modules-download-mode: vendor skip-dirs: - - vendor$ \ No newline at end of file + - vendor$ diff --git a/.golangci.yaml b/.golangci.yaml index d6d8f7219..09e590238 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -81,9 +81,9 @@ linters-settings: allow-leading-space: false require-specific: true staticcheck: - go: "1.20" + go: "1.21" stylecheck: - go: "1.20" + go: "1.21" gosec: excludes: - G307 # Deferring unsafe method "Close" on type "\*os.File" @@ -111,7 +111,7 @@ linters-settings: - rangeValCopy - hugeParam unused: - go: "1.20" + go: "1.21" issues: max-same-issues: 0 max-issues-per-linter: 0 @@ -205,4 +205,4 @@ run: - "tilt_modules" - "test" allow-parallel-runners: true - modules-download-mode: readonly \ No newline at end of file + modules-download-mode: readonly diff --git a/go.mod b/go.mod index b3aa474e7..e7fbc69e8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/syself/cluster-api-provider-hetzner -go 1.20 +go 1.21 replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.5.0 diff --git a/hack/golang-modules-update.sh b/hack/golang-modules-update.sh index 5f20b899b..4e0554e67 100755 --- a/hack/golang-modules-update.sh +++ b/hack/golang-modules-update.sh @@ -25,6 +25,5 @@ DIRS="./ ./hack/tools" for DIR in ${DIRS}; do cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod download cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod verify - cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod tidy - cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod vendor -done \ No newline at end of file + cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod vendor +done diff --git a/images/builder/Dockerfile b/images/builder/Dockerfile index 559ef32d5..202c99102 100644 --- a/images/builder/Dockerfile +++ b/images/builder/Dockerfile @@ -31,7 +31,7 @@ RUN apk add --no-cache curl && \ FROM docker.io/library/alpine:3.17.3@sha256:b6ca290b6b4cdcca5b3db3ffa338ee0285c11744b4a6abaa9627746ee3291d8d as golangci # update: datasource=github-tags depName=golangci/golangci-lint versioning=semver ENV GOLANGCI_VERSION="v1.52.2" -WORKDIR / +WORKDIR / # hadolint ignore=DL3018,DL4006 RUN apk add --no-cache curl && \ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s ${GOLANGCI_VERSION} @@ -45,7 +45,7 @@ FROM docker.io/aquasec/trivy:0.39.0@sha256:ab281f43ee11b8ea5443ca8897641441f04f1 ############################ # Caph Build Image Base # ############################ -FROM docker.io/library/golang:1.20.2-bullseye@sha256:2101aa981e68ab1e06e3d4ac35ae75ed122f0380e5331e3ae4ba7e811bf9d256 +FROM docker.io/library/golang:1.21.1-bullseye@sha256:357be9f9e594a338ba16f54c4df16481e7e82533a6571cecaf22dca833622f91 # update: datasource=repology depName=debian_11/skopeo versioning=loose ENV SKOPEO_VERSION="1.2.2+dfsg1-1+b6" @@ -65,7 +65,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ pip install --no-cache-dir \ yamllint==${YAMLLINT_VERSION} \ - yamlfixer-opt-nc==${YAMLFIXER_VERSION} + yamlfixer-opt-nc==${YAMLFIXER_VERSION} COPY --from=lychee /usr/bin/lychee /usr/bin/lychee COPY --from=golangci /bin/golangci-lint /usr/local/bin @@ -76,4 +76,4 @@ ENV GOCACHE=/go/cache COPY build.sh / RUN chmod +x /build.sh -ENTRYPOINT ["/build.sh"] \ No newline at end of file +ENTRYPOINT ["/build.sh"] diff --git a/images/caph/Dockerfile b/images/caph/Dockerfile index b87a16395..4390b4c4c 100644 --- a/images/caph/Dockerfile +++ b/images/caph/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.20.5@sha256:fd9306e1c664bd49a11d4a4a04e41303430e069e437d137876e9290a555e06fb as build +FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.1-bullseye@sha256:357be9f9e594a338ba16f54c4df16481e7e82533a6571cecaf22dca833622f91 as build ARG TARGETOS TARGETARCH COPY . /src/cluster-api-provider-hetzner @@ -28,4 +28,4 @@ WORKDIR / COPY --from=build /src/cluster-api-provider-hetzner/manager . # Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies USER 65532 -ENTRYPOINT ["/manager"] \ No newline at end of file +ENTRYPOINT ["/manager"]