verify-govet-levee.sh: optimize "go list"

go list -find takes ~60% the time:

$ time go list -e ./... | grep -E -v "/(build|third_party|vendor|staging|clientset_generated|hack)/" | md5sum
b5593b3f51f3b3cd08c33bbff9627d10  -

real	0m2.687s
user	0m3.624s
sys	0m1.552s

$ time go list -find -e ./... | grep -E -v "/(build|third_party|vendor|staging|clientset_generated|hack)/" | md5sum
b5593b3f51f3b3cd08c33bbff9627d10  -

real	0m1.721s
user	0m1.675s
sys	0m1.197s

https://github.com/kubernetes/kubernetes/pull/116166#discussion_r1123924871
This commit is contained in:
Patrick Ohly 2023-03-03 07:45:07 +01:00
parent fd8523aa08
commit 5331973fa5

View File

@ -43,6 +43,6 @@ CONFIG_FILE="${KUBE_ROOT}/hack/testdata/levee/levee-config.yaml"
targets=() targets=()
while IFS='' read -r line; do while IFS='' read -r line; do
targets+=("${line}") targets+=("${line}")
done < <(go list -e ./... | grep -E -v "/(build|third_party|vendor|staging|clientset_generated|hack)/") done < <(go list --find -e ./... | grep -E -v "/(build|third_party|vendor|staging|clientset_generated|hack)/")
go vet -vettool="${LEVEE_BIN}" -config="${CONFIG_FILE}" "${targets[@]}" go vet -vettool="${LEVEE_BIN}" -config="${CONFIG_FILE}" "${targets[@]}"