-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
provider: Fix updated govet composites and nilness checks #7993
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ linters: | |
- gosimple | ||
- ineffassign | ||
- misspell | ||
- staticcheck | ||
- structcheck | ||
- unconvert | ||
- unused | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
dist: trusty | ||
dist: xenial | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was updated to see if it helped with the memory issue since TravisCI does not start services by default on the newer OS. It didn't make the memory issue disappear, but the update is helpful anyways. |
||
sudo: required | ||
services: | ||
- docker | ||
language: go | ||
go: | ||
- "1.12.x" | ||
env: | ||
GOFLAGS=-mod=vendor | ||
- "1.12.x" | ||
env: GOFLAGS=-mod=vendor | ||
|
||
git: | ||
depth: 1 | ||
|
||
install: | ||
# This script is used by the Travis build to install a cookie for | ||
# go.googlesource.com so rate limits are higher when using `go get` to fetch | ||
# packages that live there. | ||
# See: https://github.com/golang/go/issues/12933 | ||
- bash scripts/gogetcookie.sh | ||
- make tools | ||
# This script is used by the Travis build to install a cookie for | ||
# go.googlesource.com so rate limits are higher when using `go get` to fetch | ||
# packages that live there. | ||
# See: https://github.com/golang/go/issues/12933 | ||
- bash scripts/gogetcookie.sh | ||
- make tools | ||
|
||
script: | ||
- make lint | ||
- make test | ||
- make website-lint | ||
- make website-test | ||
- make lint | ||
- make test | ||
- make website-lint | ||
- make website-test | ||
|
||
branches: | ||
only: | ||
- master | ||
- master | ||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- go: tip | ||
- go: tip |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,21 +58,20 @@ func testAccCheckEmrSecurityConfigurationDestroy(s *terraform.State) error { | |
resp, err := conn.DescribeSecurityConfiguration(&emr.DescribeSecurityConfigurationInput{ | ||
Name: aws.String(rs.Primary.ID), | ||
}) | ||
if err == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invert logic here to match preferred style across codebase of error checking first. |
||
if resp.Name != nil && *resp.Name == rs.Primary.ID { | ||
// assume this means the resource still exists | ||
return fmt.Errorf("Error: EMR Security Configuration still exists: %s", *resp.Name) | ||
} | ||
|
||
if isAWSErr(err, "InvalidRequestException", "does not exist") { | ||
return nil | ||
} | ||
|
||
// Verify the error is what we want | ||
if err != nil { | ||
if isAWSErr(err, "InvalidRequestException", "does not exist") { | ||
return nil | ||
} | ||
return err | ||
} | ||
|
||
if resp != nil && aws.StringValue(resp.Name) == rs.Primary.ID { | ||
return fmt.Errorf("Error: EMR Security Configuration still exists: %s", aws.StringValue(resp.Name)) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
return nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,12 @@ func testSweepGameliftGameSessionQueue(region string) error { | |
|
||
out, err := conn.DescribeGameSessionQueues(&gamelift.DescribeGameSessionQueuesInput{}) | ||
|
||
if testSweepSkipSweepError(err) { | ||
log.Printf("[WARN] Skipping Gamelife Queue sweep for %s: %s", region, err) | ||
return nil | ||
} | ||
|
||
if err != nil { | ||
if testSweepSkipSweepError(err) { | ||
log.Printf("[WARN] Skipping Gamelife Queue sweep for %s: %s", region, err) | ||
return nil | ||
} | ||
return fmt.Errorf("error listing Gamelift Session Queue: %s", err) | ||
} | ||
|
||
|
@@ -57,14 +58,6 @@ func testSweepGameliftGameSessionQueue(region string) error { | |
} | ||
} | ||
|
||
if err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing duplicate logic. |
||
if testSweepSkipSweepError(err) { | ||
log.Printf("[WARN] Skipping Gamelift Session Queue sweep for %s: %s", region, err) | ||
return nil | ||
} | ||
return fmt.Errorf("error listing Gamelift Session Queue: %s", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,13 +222,9 @@ func testAccAWSVpnConnectionDisappears(connection *ec2.VpnConnection) resource.T | |
_, err := conn.DeleteVpnConnection(&ec2.DeleteVpnConnectionInput{ | ||
VpnConnectionId: connection.VpnConnectionId, | ||
}) | ||
|
||
if err != nil { | ||
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidVpnConnectionID.NotFound" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The acceptance test should fail if this error is returned here. |
||
return nil | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
return err | ||
} | ||
|
||
return resource.Retry(40*time.Minute, func() *resource.RetryError { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,18 +374,7 @@ func testAccAWSVpnGatewayDisappears(gateway *ec2.VpnGateway) resource.TestCheckF | |
VpcId: gateway.VpcAttachments[0].VpcId, | ||
}) | ||
if err != nil { | ||
ec2err, ok := err.(awserr.Error) | ||
if ok { | ||
if ec2err.Code() == "InvalidVpnGatewayID.NotFound" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The acceptance test should fail if either of these errors are returned here. |
||
return nil | ||
} else if ec2err.Code() == "InvalidVpnGatewayAttachment.NotFound" { | ||
return nil | ||
} | ||
} | ||
|
||
if err != nil { | ||
return err | ||
} | ||
return err | ||
} | ||
|
||
opts := &ec2.DeleteVpnGatewayInput{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary for now to fix out of memory issue. We can consider adding a separate TravisCI matrix job, running staticcheck by itself, or waiting for
staticcheck
2019.1.1 support ingolangci-lint
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the memory usage difference locally for me:
We should also watch: dominikh/go-tools#419
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! golangci/golangci-lint#445 was merged. Also, I've added the section about memory usage into README. You can try to set
GOGC=30
for example to trade memory for CPU.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much @jirfag 😄 This should be a huge help for us.