From b32e2072569a751336aa524766f50a71ebbf06b3 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Fri, 29 Dec 2023 10:27:14 -0800 Subject: [PATCH] Fix last run-in-gopath user: typecheck This now works across modules Verified by introducing errors in 2 different modules and running. --- hack/verify-typecheck.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hack/verify-typecheck.sh b/hack/verify-typecheck.sh index 590a9e75ebd..a96afb58d8b 100755 --- a/hack/verify-typecheck.sh +++ b/hack/verify-typecheck.sh @@ -23,18 +23,15 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" - -kube::golang::verify_go_version - cd "${KUBE_ROOT}" -# As of June, 2020 the typecheck tool is written in terms of go/packages, but -# that library doesn't work well with multiple modules. Until that is done, -# force this tooling to run in a fake GOPATH. +kube::golang::new::setup_env +kube::golang::verify_go_version + ret=0 TYPECHECK_SERIAL="${TYPECHECK_SERIAL:-false}" -hack/run-in-gopath.sh \ - go run test/typecheck/main.go "$@" "--serial=$TYPECHECK_SERIAL" || ret=$? +go run ./test/typecheck "$@" "--serial=$TYPECHECK_SERIAL" || ret=$? + if [[ $ret -ne 0 ]]; then echo "!!! Type Check has failed. This may cause cross platform build failures." >&2 echo "!!! Please see https://git.k8s.io/kubernetes/test/typecheck for more information." >&2