From d8fdb00b344e4a52052be591791000cb63794117 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 22 Mar 2022 23:11:26 -0700 Subject: [PATCH] Fix verify: generated-stable-metrics wrt go 1.18 This should fix the following error when running ./hack/update-generated-stable-metrics.sh: 'go get' is no longer supported outside a module. To build and install a command, use 'go install' with a version, like 'go install example.com/cmd@latest' For more information, see https://golang.org/doc/go-get-install-deprecation or run 'go help get' or 'go help install'. Using `go get` to download gopkg.in/yaml.v2 package into KUBE_EXTRA_GOPATH directory no longer works. Interestingly, main repo already has gopkg.in/yaml.v2@v2.4.0, same version that was installed by that go get. I guess that GOPATH with multiple elements no longer works either, and since this code was the only user of KUBE_EXTRA_GOPATH, let's remove it as well. Signed-off-by: Kir Kolyshkin --- hack/lib/golang.sh | 8 -------- test/instrumentation/stability-utils.sh | 6 ------ 2 files changed, 14 deletions(-) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 527a0b8d523..b07beef927f 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -496,9 +496,6 @@ EOF # ${PATH}. It will also check that the Go version is good enough for the # Kubernetes build. # -# Inputs: -# KUBE_EXTRA_GOPATH - If set, this is included in created GOPATH -# # Outputs: # env-var GOPATH points to our local output dir # env-var GOBIN is unset (we want binaries in a predictable place) @@ -512,11 +509,6 @@ kube::golang::setup_env() { export GOPATH="${KUBE_GOPATH}" export GOCACHE="${KUBE_GOPATH}/cache" - # Append KUBE_EXTRA_GOPATH to the GOPATH if it is defined. - if [[ -n ${KUBE_EXTRA_GOPATH:-} ]]; then - GOPATH="${GOPATH}:${KUBE_EXTRA_GOPATH}" - fi - # Make sure our own Go binaries are in PATH. export PATH="${KUBE_GOPATH}/bin:${PATH}" diff --git a/test/instrumentation/stability-utils.sh b/test/instrumentation/stability-utils.sh index 7769d6daf4a..4b158950a19 100644 --- a/test/instrumentation/stability-utils.sh +++ b/test/instrumentation/stability-utils.sh @@ -26,13 +26,7 @@ stability_check_setup() { kube::golang::verify_go_version kube::util::ensure-temp-dir cd "${KUBE_ROOT}" - export KUBE_EXTRA_GOPATH=$KUBE_TEMP kube::golang::setup_env - pushd "${KUBE_EXTRA_GOPATH}" >/dev/null - touch go.mod - GO111MODULE=on go mod edit -module=example.com/mod - GO111MODULE=on go get "gopkg.in/yaml.v2" - popd >/dev/null } find_files_to_check() {