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 <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2022-03-22 23:11:26 -07:00
parent 4513de06a8
commit d8fdb00b34
2 changed files with 0 additions and 14 deletions

View File

@ -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}"

View File

@ -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() {