Merge pull request #27558 from mikedanese/go-vet-better
Automatic merge from submit-queue cleanup hack/verify-govet.sh to throttle process creation 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
This commit is contained in:
		| @@ -76,12 +76,12 @@ func (r *Route53APIStub) ChangeResourceRecordSets(input *route53.ChangeResourceR | |||||||
| 		switch *change.Action { | 		switch *change.Action { | ||||||
| 		case route53.ChangeActionCreate: | 		case route53.ChangeActionCreate: | ||||||
| 			if _, found := recordSets[*change.ResourceRecordSet.Name]; found { | 			if _, found := recordSets[*change.ResourceRecordSet.Name]; found { | ||||||
| 				return nil, fmt.Errorf("Attempt to create duplicate rrset %s", change.ResourceRecordSet.Name) // TODO: Return AWS errors with codes etc | 				return nil, fmt.Errorf("Attempt to create duplicate rrset %s", *change.ResourceRecordSet.Name) // TODO: Return AWS errors with codes etc | ||||||
| 			} | 			} | ||||||
| 			recordSets[*change.ResourceRecordSet.Name] = append(recordSets[*change.ResourceRecordSet.Name], change.ResourceRecordSet) | 			recordSets[*change.ResourceRecordSet.Name] = append(recordSets[*change.ResourceRecordSet.Name], change.ResourceRecordSet) | ||||||
| 		case route53.ChangeActionDelete: | 		case route53.ChangeActionDelete: | ||||||
| 			if _, found := recordSets[*change.ResourceRecordSet.Name]; !found { | 			if _, found := recordSets[*change.ResourceRecordSet.Name]; !found { | ||||||
| 				return nil, fmt.Errorf("Attempt to delete non-existant rrset %s", change.ResourceRecordSet.Name) // TODO: Check other fields too | 				return nil, fmt.Errorf("Attempt to delete non-existant rrset %s", *change.ResourceRecordSet.Name) // TODO: Check other fields too | ||||||
| 			} | 			} | ||||||
| 			delete(recordSets, *change.ResourceRecordSet.Name) | 			delete(recordSets, *change.ResourceRecordSet.Name) | ||||||
| 		case route53.ChangeActionUpsert: | 		case route53.ChangeActionUpsert: | ||||||
| @@ -102,7 +102,7 @@ func (r *Route53APIStub) ListHostedZones(*route53.ListHostedZonesInput) (*route5 | |||||||
|  |  | ||||||
| func (r *Route53APIStub) CreateHostedZone(input *route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error) { | func (r *Route53APIStub) CreateHostedZone(input *route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error) { | ||||||
| 	if _, ok := r.zones[*input.Name]; ok { | 	if _, ok := r.zones[*input.Name]; ok { | ||||||
| 		return nil, fmt.Errorf("Error creating hosted DNS zone: %s already exists", input.Name) | 		return nil, fmt.Errorf("Error creating hosted DNS zone: %s already exists", *input.Name) | ||||||
| 	} | 	} | ||||||
| 	r.zones[*input.Name] = &route53.HostedZone{ | 	r.zones[*input.Name] = &route53.HostedZone{ | ||||||
| 		Id:   input.Name, | 		Id:   input.Name, | ||||||
|   | |||||||
| @@ -107,7 +107,7 @@ func NewFakeInterface() (dnsprovider.Interface, error) { | |||||||
| 	interface_ := newInterfaceWithStub("", service) | 	interface_ := newInterfaceWithStub("", service) | ||||||
| 	zones := service.ManagedZones_ | 	zones := service.ManagedZones_ | ||||||
| 	// Add a fake zone to test against. | 	// Add a fake zone to test against. | ||||||
| 	zone := &stubs.ManagedZone{zones, "example.com", []stubs.ResourceRecordSet{}} | 	zone := &stubs.ManagedZone{Service: zones, Name_: "example.com", Rrsets: []stubs.ResourceRecordSet{}} | ||||||
| 	call := zones.Create(interface_.project(), zone) | 	call := zones.Create(interface_.project(), zone) | ||||||
| 	if _, err := call.Do(); err != nil { | 	if _, err := call.Do(); err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
|   | |||||||
| @@ -46,34 +46,4 @@ if [[ ${#targets[@]} -eq 0 ]]; then | |||||||
|   targets=$(go list ./... | egrep -v "/(third_party|vendor)/") |   targets=$(go list ./... | egrep -v "/(third_party|vendor)/") | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # Do this in parallel; results in 5-10x speedup. | go vet "${goflags[@]:+${goflags[@]}}" ${targets[@]} | ||||||
| pids="" |  | ||||||
| for i in $targets |  | ||||||
|   do |  | ||||||
|   ( |  | ||||||
|     # Run go vet using goflags for each target specified. |  | ||||||
|     # |  | ||||||
|     # Remove any lines go vet or godep outputs with the exit status. |  | ||||||
|     # Remove any lines godep outputs about the vendor experiment. |  | ||||||
|     # |  | ||||||
|     # If go vet fails (produces output), grep will succeed, but if go vet |  | ||||||
|     # succeeds (produces no output) grep will fail. Then we just use |  | ||||||
|     # PIPESTATUS[0] which is go's exit code. |  | ||||||
|     # |  | ||||||
|     # The intended result is that each incantation of this line returns |  | ||||||
|     # either 0 (pass) or 1 (fail). |  | ||||||
|     go vet "${goflags[@]:+${goflags[@]}}" "$i" 2>&1 \ |  | ||||||
|       | grep -v -E "exit status|GO15VENDOREXPERIMENT=" \ |  | ||||||
|       || fail=${PIPESTATUS[0]} |  | ||||||
|     exit $fail |  | ||||||
|   ) & |  | ||||||
|   pids+=" $!" |  | ||||||
| done |  | ||||||
|  |  | ||||||
| # Count and return the number of failed files (non-zero is a failed vet run). |  | ||||||
| failedfiles=0 |  | ||||||
| for p in $pids; do |  | ||||||
|   wait $p || let "failedfiles+=1" |  | ||||||
| done |  | ||||||
|  |  | ||||||
| exit $failedfiles |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 k8s-merge-robot
					k8s-merge-robot