Fix last run-in-gopath user: typecheck

This now works across modules

Verified by introducing errors in 2 different modules and running.
This commit is contained in:
Tim Hockin 2023-12-29 10:27:14 -08:00
parent 91efe7e571
commit b32e207256
No known key found for this signature in database

View File

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