Make verify-typecheck not depend on GOPATH

This script fails if not under a GOPATH because we use go/types, which
is not modules aware.
This commit is contained in:
Tim Hockin 2020-06-16 22:34:44 -07:00
parent a2f26075c8
commit 15df3d6042

View File

@ -30,8 +30,13 @@ cd "${KUBE_ROOT}"
make --no-print-directory -C "${KUBE_ROOT}" generated_files
# As of June, 2020 the typecheck tool is written in terms of go/types, but that
# library doesn't work well with modules. Guidance is to rewrite tools against
# golang.org/x/tools/go/packages. Until that is done, force this tooling to
# run in a fake GOPATH.
ret=0
go run test/typecheck/main.go "$@" || ret=$?
hack/run-in-gopath.sh \
go run test/typecheck/main.go "$@" || 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