From 1b24221adcc60db2b53b55800bcb062d9bf43796 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Wed, 17 Aug 2022 14:57:46 +0200 Subject: [PATCH] fix: set an explicit GOROOT for go-critic --- .gitattributes | 1 - .github/workflows/tag.yml | 2 +- build/Dockerfile | 2 ++ build/{Dockerfile.alpine => alpine.Dockerfile} | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) rename build/{Dockerfile.alpine => alpine.Dockerfile} (90%) diff --git a/.gitattributes b/.gitattributes index 236bbf95fc20..32f1001be0a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ go.sum linguist-generated -Dockerfile.* linguist-language=Dockerfile diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index c2bb3e6c6047..e3cc09410ac4 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -37,7 +37,7 @@ jobs: matrix: target: - Dockerfile: build/Dockerfile - - Dockerfile: build/Dockerfile.alpine + - Dockerfile: build/alpine.Dockerfile steps: - uses: actions/checkout@v3 diff --git a/build/Dockerfile b/build/Dockerfile index 0bf96710448d..b3839a4eb1c8 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -11,6 +11,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X # stage 2 FROM golang:1.19 +# related to https://github.com/golangci/golangci-lint/issues/3107 +ENV GOROOT /usr/local/go # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume COPY --from=builder /golangci/golangci-lint /usr/bin/ CMD ["golangci-lint"] diff --git a/build/Dockerfile.alpine b/build/alpine.Dockerfile similarity index 90% rename from build/Dockerfile.alpine rename to build/alpine.Dockerfile index 37e97695d1a0..c19449fbc197 100644 --- a/build/Dockerfile.alpine +++ b/build/alpine.Dockerfile @@ -16,6 +16,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X # stage 2 FROM golang:1.19-alpine +# related to https://github.com/golangci/golangci-lint/issues/3107 +ENV GOROOT /usr/local/go # gcc is required to support cgo; # git and mercurial are needed most times for go get`, etc. # See https://github.com/docker-library/golang/issues/80