Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup hack/verify-govet.sh to throttle process creation #27558

Merged
merged 2 commits into from
Jun 20, 2016

Conversation

mikedanese
Copy link
Member

@mikedanese mikedanese commented Jun 16, 2016

Running this check as it is on master spikes my load average to 294.19
and looks up my workstation. Depends on parallel being installed.

cc @thockin @goltermann

@mikedanese
Copy link
Member Author

mikedanese commented Jun 16, 2016

This patch catches a bunch of govets we are missing currently. Not sure why they are skipped:

From 32a216819d4e6356f70fccb1559924bab1c47f6d Mon Sep 17 00:00:00 2001
From: Mike Danese <mikedanese@google.com>
Date: Thu, 16 Jun 2016 11:38:11 -0700
Subject: [PATCH] test more

---
 hack/verify-govet.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hack/verify-govet.sh b/hack/verify-govet.sh
index de28e0e..6fce71b 100755
--- a/hack/verify-govet.sh
+++ b/hack/verify-govet.sh
@@ -39,8 +39,8 @@ done

 if [[ ${#targets[@]} -eq 0 ]]; then
   # Do not run on third_party directories.
-  targets=$(go list ./... | egrep -v "/(third_party|vendor)/")
+  targets=$(find . -type f -name '*.go' | egrep -v "/(third_party|vendor)/")
 fi

 echo "${targets[@]}" \
-  | parallel -I {} go vet "${goflags[@]:+${goflags[@]}}" "{}" 2>&1
+  | parallel -I {} go tool vet "${goflags[@]:+${goflags[@]}}" "{}" 2>&1
-- 
2.8.0.rc3.226.g39d4020

Even more if I pass -all to go tool vet

./test/integration/kubectl_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/pods_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/dynamic_client_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/master_benchmark_test.go:1: invalid non-alphanumeric build constraint: benchmark,!no-etcd,!integration
./test/integration/master_benchmark_test.go:114: k8s.io/kubernetes/test/integration/framework.Config composite literal uses unkeyed fields
./test/integration/master_benchmark_test.go:153: k8s.io/kubernetes/test/integration/framework.Config composite literal uses unkeyed fields
./test/integration/etcd_tools_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/garbage_collector_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/metrics_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd,linux
./test/integration/persistent_volumes_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/persistent_volumes_test.go:231: possible formatting directive in Fatal call
./test/integration/client_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/client_test.go:193: unreachable code
./test/integration/secret_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/configmap_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/master_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/scheduler_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/scheduler_test.go:138: k8s.io/kubernetes/pkg/api/unversioned.Time composite literal uses unkeyed fields
./test/integration/scheduler_test.go:144: k8s.io/kubernetes/pkg/api/unversioned.Time composite literal uses unkeyed fields
./test/integration/service_account_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/quota_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/extender_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./test/integration/extender_test.go:171: k8s.io/kubernetes/plugin/pkg/scheduler/api.HostPriority composite literal uses unkeyed fields
./test/integration/extender_test.go:183: k8s.io/kubernetes/plugin/pkg/scheduler/api.HostPriority composite literal uses unkeyed fields
./test/integration/extender_test.go:265: k8s.io/kubernetes/pkg/api/unversioned.Time composite literal uses unkeyed fields
./test/integration/auth_test.go:1: invalid non-alphanumeric build constraint: integration,!no-etcd
./contrib/mesos/pkg/redirfd/redirfd_windows.go:38: arg nonblock for printf verb %s of wrong type: bool

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Jun 16, 2016
@goltermann
Copy link
Contributor

Two questions:

  1. parallel won't be installed on everyone's dev machine - isn't that a problem?
  2. does this maintain the script requirement that returning 0 is success non-zero is fail?

@MHBauer
Copy link
Contributor

MHBauer commented Jun 16, 2016

Ouch on all the 'hidden' results.

Is there a place to add a "please brew install parallel" for OSX support?


exit $failedfiles
echo "${targets[@]}" \
| parallel -I {} go vet "${goflags[@]:+${goflags[@]}}" "{}" 2>&1
Copy link
Member

@ixdy ixdy Jun 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be simpler just to do | xargs go vet "${goflags[@]:+${goflags[@]}}" here and let go take care of parallizing itself.

on my workstation, the argument list can be very large, so I saw no benefit from using -P. It might be helpful in other environments, possibly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, on my workstation, using xargs vs this shell loop cuts the runtime of this check in half.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will use xargs

@ixdy
Copy link
Member

ixdy commented Jun 16, 2016

FYI I filed an issue on go vet passing after go install - golang/go#16086.

@ixdy
Copy link
Member

ixdy commented Jun 16, 2016

Based on the discussion on that issue, I think go vet is actually only correct after doing go install first. So by pure luck we were doing the right thing originally.

Thus we probably want to put a go install line in hack/verify-govet.sh. If it's already been run, go install exits pretty quickly.


exit $failedfiles
echo "${targets[@]}" \
| xargs -P 4 -I {} go vet "${goflags[@]:+${goflags[@]}}" "{}" 2>&1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't want to use {} here - with {} xargs will spawn one go vet process for each package, rather than one go vet process for all packages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woah, how does this possibly work. Is the arg limit a bash thing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the arg limit is system-dependent, and maybe xargs does the right thing depending on what the limit is?

It's ridiculously large on linux:

$ getconf ARG_MAX
2097152

OSX has a lower limit (I think), so it might be worth seeing if it works correctly there.

@mikedanese mikedanese added this to the v1.3 milestone Jun 17, 2016
@mikedanese
Copy link
Member Author

@ixdy I could have sworn I was getting an argument list too long but I guess not. Comments addressed.

@k8s-bot
Copy link

k8s-bot commented Jun 17, 2016

GCE e2e build/test passed for commit 31448198ceafe61bf0a9b9f698c104d77dbc53f2.

@goltermann
Copy link
Contributor

@ixdy can you LGTM this morning?

@mikedanese mikedanese added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jun 20, 2016
done

exit $failedfiles
go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]} 2>&1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the 2>&1 was originally so that grep would work, but it's not that big a deal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ixdy ixdy added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 20, 2016
Running this check as it is on master spikes my load average to 294.19
and looks up my workstation.
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@mikedanese mikedanese added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 20, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 20, 2016

GCE e2e build/test passed for commit 4dd7b7c.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 90053c2 into kubernetes:master Jun 20, 2016
@mikedanese mikedanese deleted the go-vet-better branch June 20, 2016 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants