Bump golang to 1.18.1

Also update all use of 'go get' => 'go install', update CI tooling for
1.18 compatibility, and gofmt everything so lint passes.

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/5548/head
Brad Davidson 2022-04-05 13:13:48 -07:00 committed by Brad Davidson
parent e6385b2341
commit c8447dca56
24 changed files with 32 additions and 23 deletions

View File

@ -47,7 +47,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.17.5'
go-version: '1.18.1'
- name: Checkout
uses: actions/checkout@v2
with:

View File

@ -33,7 +33,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.17.5'
go-version: '1.18.1'
- name: Checkout
uses: actions/checkout@v2
with:

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.17.5-alpine3.15
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
ARG http_proxy=$http_proxy
@ -11,7 +11,7 @@ ENV no_proxy=$no_proxy
RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget ca-certificates jq linux-headers \
zlib-dev tar zip squashfs-tools npm coreutils python3 openssl-dev libffi-dev libseccomp libseccomp-dev \
libseccomp-static make libuv-static sqlite-dev sqlite-static libselinux libselinux-dev zlib-dev zlib-static \
zstd pigz alpine-sdk binutils-gold btrfs-progs-dev btrfs-progs-static gawk \
zstd pigz alpine-sdk binutils-gold btrfs-progs-dev btrfs-progs-static gawk yq \
&& \
if [ "$(go env GOARCH)" = "amd64" ]; then \
apk -U --no-cache add mingw-w64-gcc; \
@ -30,17 +30,14 @@ RUN if [ "$(go env GOARCH)" = "arm64" ]; then
tar -zxvf trivy_0.25.3_Linux-64bit.tar.gz && \
mv trivy /usr/local/bin; \
fi
# this works for both go 1.15 and 1.16
RUN GOPROXY=direct go get golang.org/x/tools/cmd/goimports@gopls/v0.7.0
# this works for both go 1.17 and 1.18
RUN GOPROXY=direct go install golang.org/x/tools/cmd/goimports@gopls/v0.8.2
RUN rm -rf /go/src /go/pkg
RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.45.2; \
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/v1.45.2/install.sh | sh -s; \
fi
ENV YQ_URL=https://github.com/mikefarah/yq/releases/download/v4.6.2/yq_linux
RUN wget -O - ${YQ_URL}_$(go env GOARCH) > /usr/bin/yq && chmod +x /usr/bin/yq
ARG SELINUX=true
ENV SELINUX $SELINUX

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.17.5-alpine3.15
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
COPY --from=plugins/manifest:1.2.3 /bin/* /bin/

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.17.5-alpine3.15
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
RUN apk -U --no-cache add bash git gcc musl-dev docker curl jq coreutils python3 openssl py3-pip procps

View File

@ -1,4 +1,4 @@
ARG GOLANG=golang:1.17.5-alpine3.15
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
RUN apk -U --no-cache add bash jq

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package loadbalancer

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package templates

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package cmds

View File

@ -1,3 +1,4 @@
//go:build !linux || !cgo
// +build !linux !cgo
package cmds

View File

@ -1,3 +1,4 @@
//go:build !linux || !cgo
// +build !linux !cgo
package cmds

View File

@ -1,3 +1,4 @@
//go:build no_stage
// +build no_stage
package cmds

View File

@ -1,3 +1,4 @@
//go:build ctrd
// +build ctrd
/*

View File

@ -1,3 +1,4 @@
//go:build ctrd
// +build ctrd
/*

View File

@ -1,3 +1,4 @@
//go:build ctrd
// +build ctrd
/*

View File

@ -1,3 +1,4 @@
//go:build ctrd
// +build ctrd
package containerd

View File

@ -1,3 +1,4 @@
//go:build no_stage
// +build no_stage
package deploy

View File

@ -1,3 +1,4 @@
//go:build no_stage
// +build no_stage
package static

View File

@ -15,7 +15,7 @@ EOF
# ---
. /tmp/docker-run
# ---
go get -u github.com/go-delve/delve/cmd/dlv
go install -u github.com/go-delve/delve/cmd/dlv
# ---
cat <<EOF >/etc/profile.d/docker.sh
export DOCKER_HOST=tcp://10.0.2.2:2375

View File

@ -13,7 +13,7 @@ sed -E 's|apk( -U)?( --no-cache)?( --repository [^ ]*)? add|yum install -y|g' -i
sed -E 's/-dev/-devel/g' -i /tmp/docker-run
. /tmp/docker-run
# ---
go get -u github.com/go-delve/delve/cmd/dlv
go install -u github.com/go-delve/delve/cmd/dlv
# ---
# docker install instructions slightly changed from https://kubernetes.io/docs/setup/production-environment/container-runtimes/
# default "exec-opts": ["native.cgroupdriver=cgroupfs"], and set "selinux-enabled": true

View File

@ -19,5 +19,5 @@ zypper -q install -y \
sed -E 's|apk( -U)?( --no-cache)?( --repository [^ ]*)? add .*||g' -i /tmp/docker-run
. /tmp/docker-run
# ---
go get -u github.com/go-delve/delve/cmd/dlv
go install -u github.com/go-delve/delve/cmd/dlv
# ---

View File

@ -36,5 +36,5 @@ apt-get install -y \
zstd
# ---
go get -u github.com/go-delve/delve/cmd/dlv
go install -u github.com/go-delve/delve/cmd/dlv
# ---

View File

@ -13,5 +13,5 @@ COPY ./tests/integration/test-runner.sh .
COPY ./dist/artifacts/k3s /usr/local/bin
COPY ./dist/artifacts/k3s-integration-* ./tests/
RUN go get -u github.com/onsi/gomega
RUN go get -u github.com/onsi/ginkgo
RUN go install -u github.com/onsi/gomega
RUN go install -u github.com/onsi/ginkgo

View File

@ -19,7 +19,7 @@ RUN apk update && \
WORKDIR $GOPATH/src/github.com/k3s-io/k3s
COPY . .
RUN go get github.com/gruntwork-io/terratest/modules/terraform
RUN go get -u github.com/onsi/gomega
RUN go get -u github.com/onsi/ginkgo/v2
RUN go get -u golang.org/x/crypto/...
RUN go install github.com/gruntwork-io/terratest/modules/terraform
RUN go install -u github.com/onsi/gomega
RUN go install -u github.com/onsi/ginkgo/v2
RUN go install -u golang.org/x/crypto/...