Rewrite typecheck against x/tools/go/packages

This runs much faster than before.  This change removes all of the
async status output because all of the compute time is spent inside
go/packages, with no opportunity to update the status.

Adds testdata code to prove it fails when expected.
This commit is contained in:
Tim Hockin
2020-06-18 20:30:58 -07:00
parent 734f27d980
commit d187d7effa
9 changed files with 403 additions and 441 deletions

View File

@@ -68,7 +68,7 @@ while IFS='' read -r line; do
all_packages+=("./$line")
done < <( hack/make-rules/helpers/cache_go_dirs.sh "${KUBE_ROOT}/_tmp/all_go_dirs" |
grep "^${FOCUS:-.}" |
grep -vE "(third_party|generated|clientset_generated|hack|/_)" |
grep -vE "(third_party|generated|clientset_generated|hack|testdata|/_)" |
grep -vE "$ignore_pattern" )
failing_packages=()

View File

@@ -30,10 +30,9 @@ 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.
# 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.
ret=0
hack/run-in-gopath.sh \
go run test/typecheck/main.go "$@" || ret=$?