From c51ce2551e6aaf6e9a5d9758ba6494b0fed69123 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Wed, 1 Feb 2023 10:38:01 +0200 Subject: [PATCH] use latest go-compile (#3906) Signed-off-by: Avi Deitcher --- Makefile | 4 ++-- src/cmd/linuxkit/Makefile | 4 ++-- tools/go-compile/Dockerfile | 11 ++++++++++- tools/go-compile/build.yml | 1 + tools/go-compile/compile.sh | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cdfdc1d2f..7a3f28423 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ VERSION="v0.8+" TEST_SUITE ?= TEST_SHARD ?= -GO_COMPILE=linuxkit/go-compile:7b1f5a37d2a93cd4a9aa2a87db264d8145944006 +GO_COMPILE=linuxkit/go-compile:c97703655e8510b7257ffc57f25e40337b0f0813 ifeq ($(OS),Windows_NT) LINUXKIT?=$(CURDIR)/bin/linuxkit.exe @@ -34,7 +34,7 @@ export VERSION GO_COMPILE GOOS GOARCH LOCAL_TARGET LINUXKIT default: linuxkit $(RTF) all: default -RTF_COMMIT=1b6277593346dea7e6039d528c4e8321a4bd9eaf +RTF_COMMIT=b74a4f7c78e5cddcf7e6d2e6be7be312b9f645fc RTF_CMD=github.com/linuxkit/rtf/cmd RTF_VERSION=0.0 $(RTF): tmp_rtf_bin.tar | bin diff --git a/src/cmd/linuxkit/Makefile b/src/cmd/linuxkit/Makefile index 53e8fbd14..87bc06d7f 100644 --- a/src/cmd/linuxkit/Makefile +++ b/src/cmd/linuxkit/Makefile @@ -1,6 +1,6 @@ VERSION?="v0.0-dev" GIT_COMMIT=$(shell git rev-list -1 HEAD) -GO_COMPILE?=linuxkit/go-compile:7b1f5a37d2a93cd4a9aa2a87db264d8145944006 +GO_COMPILE?=linuxkit/go-compile:c97703655e8510b7257ffc57f25e40337b0f0813 export GO_FLAGS=-mod=vendor ifeq ($(OS),Windows_NT) @@ -78,7 +78,7 @@ LOCAL_TARGET ?= $(LINUXKIT) local-check: $(LINUXKIT_DEPS) @echo gofmt... && o=$$(gofmt -s -l $(filter %.go,$(LINUXKIT_DEPS))) && if [ -n "$$o" ] ; then echo $$o ; exit 1 ; fi @echo govet... && go vet -printf=false ./... - @echo golint... && set -e ; for i in $(filter %.go,$(LINUXKIT_DEPS)); do golint $$i ; done + @echo golangci-lint... && golangci-lint run ./... @echo ineffassign... && ineffassign ./... local-build: diff --git a/tools/go-compile/Dockerfile b/tools/go-compile/Dockerfile index 87a6a74d0..2fb67075d 100644 --- a/tools/go-compile/Dockerfile +++ b/tools/go-compile/Dockerfile @@ -4,13 +4,22 @@ RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ RUN apk add --no-cache --initdb -p /out \ alpine-baselayout \ busybox \ + curl \ git \ go \ musl-dev -# Hack to work around an issue wirh go on arm64 requiring gcc + +# curl to install golangci-lint +RUN apk add --no-cache curl + +# Hack to work around an issue with go on arm64 requiring gcc RUN [ $(uname -m) = aarch64 ] && apk add --no-cache --initdb -p /out gcc || true RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache +# installing golangci-lint +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /out/go/bin v1.50.1 + + FROM scratch ENV GOPATH=/go PATH=$PATH:/go/bin COPY --from=mirror /out/ / diff --git a/tools/go-compile/build.yml b/tools/go-compile/build.yml index 56e7fdf8a..851e02a91 100644 --- a/tools/go-compile/build.yml +++ b/tools/go-compile/build.yml @@ -1 +1,2 @@ image: go-compile +network: true diff --git a/tools/go-compile/compile.sh b/tools/go-compile/compile.sh index 43f883d99..aa399df38 100755 --- a/tools/go-compile/compile.sh +++ b/tools/go-compile/compile.sh @@ -84,7 +84,7 @@ test -z $(gofmt -s -l .| grep -v .pb. | grep -v vendor/ | tee /dev/stderr) test -z $(GOOS=linux go vet $MOD_ARG -printf=false . 2>&1 | grep -v "^#" | grep -v vendor/ | tee /dev/stderr) >&2 echo "golint..." -test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr) +test -z $(golangci-lint run ./... | tee /dev/stderr) >&2 echo "ineffassign..." test -z $(ineffassign ./... | tee /dev/stderr)