From 34e1f1e1524a481e97cb7d1cb529164ad1c1a43d Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Thu, 27 Feb 2020 09:45:23 -0700 Subject: [PATCH] set GO111MODULE=on for build container Signed-off-by: Steve Kriss --- hack/build-image/Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hack/build-image/Dockerfile b/hack/build-image/Dockerfile index 4e0d4f8f2..ea9f0ff1b 100644 --- a/hack/build-image/Dockerfile +++ b/hack/build-image/Dockerfile @@ -14,6 +14,7 @@ FROM golang:1.13 +ENV GO111MODULE=on # Use a proxy for go modules to reduce the likelihood of various hosts being down and breaking the build ENV GOPROXY=https://proxy.golang.org @@ -22,17 +23,13 @@ RUN mkdir -p /go/src/k8s.io WORKDIR /go/src/k8s.io RUN git config --global advice.detachedHead false RUN git clone -b kubernetes-1.17.0 https://github.com/kubernetes/code-generator -# vendor code-generator go modules to be compatible with pre-1.15 -WORKDIR /go/src/k8s.io/code-generator -# Don't use ENV here because we don't want to disable modules for subsequent commands -RUN GO111MODULE=on go mod vendor # get controller-tools -RUN GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.4 +RUN go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.4 # get goimports (the revision is pinned so we don't indiscriminately update, but the particular commit # is not important) -RUN GO111MODULE=on go get golang.org/x/tools/cmd/goimports@11e9d9cc0042e6bd10337d4d2c3e5d9295508e7d +RUN go get golang.org/x/tools/cmd/goimports@11e9d9cc0042e6bd10337d4d2c3e5d9295508e7d # get protoc compiler and golang plugin WORKDIR /root @@ -41,7 +38,7 @@ RUN wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v unzip protoc-3.9.1-linux-x86_64.zip && \ mv bin/protoc /usr/bin/protoc && \ chmod +x /usr/bin/protoc -RUN GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@v1.0.0 +RUN go get github.com/golang/protobuf/protoc-gen-go@v1.0.0 # get goreleaser RUN wget --quiet https://github.com/goreleaser/goreleaser/releases/download/v0.120.8/goreleaser_Linux_x86_64.tar.gz && \