Skip to content

Commit

Permalink
Use goimports
Browse files Browse the repository at this point in the history
- Update acronyms to have consistent case in `terraform_http_example_test.go`
- https://github.com/golang/go/wiki/CodeReviewComments#initialisms
  • Loading branch information
Christopher Black committed May 15, 2018
1 parent 9dff703 commit 7d31174
Show file tree
Hide file tree
Showing 66 changed files with 278 additions and 232 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
keys:
- v1-external-dep
- v1-dep-{{ checksum "Gopkg.lock" }}

- run: test -z "$(goimports -l -w . | tee /dev/stderr)"
name: Ensure goimports has been run

# Use the Gruntwork Installer to install the gruntwork-module-circleci-helpers
- run: curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.21
- run: gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.7.1"
Expand Down
5 changes: 3 additions & 2 deletions modules/aws/account.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/iam"
"strings"
"errors"
"strings"
"testing"

"github.com/aws/aws-sdk-go/service/iam"
)

// Get the Account ID for the currently logged in IAM User.
Expand Down
2 changes: 1 addition & 1 deletion modules/aws/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"testing"

"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -34,4 +35,3 @@ func TestExtractAccountIdFromInvalidArn(t *testing.T) {
t.Fatalf("Expected an error when extracting an account id from an invalid ARN, but got nil")
}
}

3 changes: 2 additions & 1 deletion modules/aws/acm.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/acm"
"testing"

"github.com/aws/aws-sdk-go/service/acm"
)

// Get the ACM certificate for the given domain name in the given region
Expand Down
9 changes: 5 additions & 4 deletions modules/aws/ami.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package aws

import (
"testing"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/aws"
"fmt"
"sort"
"testing"
"time"
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
)

const CanonicalAccountId = "099720109477"
Expand Down
1 change: 1 addition & 0 deletions modules/aws/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"testing"

"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions modules/aws/asg.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/autoscaling"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/autoscaling"
)

// Get the IDs of EC2 Instances in the given ASG
Expand Down Expand Up @@ -56,4 +57,3 @@ func NewAsgClientE(t *testing.T, region string) (*autoscaling.AutoScaling, error

return autoscaling.New(sess), nil
}

5 changes: 3 additions & 2 deletions modules/aws/cloudwatch.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"github.com/aws/aws-sdk-go/aws"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)

// Return the CloudWatch log messages in the given region for the given log stream and log group
Expand Down
13 changes: 7 additions & 6 deletions modules/aws/ec2-syslog.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package aws

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"fmt"
"time"
"encoding/base64"
"fmt"
"testing"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/retry"
)
Expand Down Expand Up @@ -35,7 +36,7 @@ func GetSyslogForInstanceE(t *testing.T, instanceId string, region string) (stri
return "", err
}

input := ec2.GetConsoleOutputInput {
input := ec2.GetConsoleOutputInput{
InstanceId: aws.String(instanceId),
}

Expand Down Expand Up @@ -97,4 +98,4 @@ func GetSyslogForInstancesInAsgE(t *testing.T, asgName string, awsRegion string)
}

return logs, nil
}
}
5 changes: 3 additions & 2 deletions modules/aws/ec2.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/aws"
"fmt"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/terratest/modules/logger"
)

Expand Down
5 changes: 3 additions & 2 deletions modules/aws/iam.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/iam"
"testing"
"github.com/aws/aws-sdk-go/aws"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/gruntwork-io/terratest/modules/logger"
)

Expand Down
1 change: 1 addition & 0 deletions modules/aws/iam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"testing"

"github.com/stretchr/testify/assert"
)

Expand Down
5 changes: 3 additions & 2 deletions modules/aws/keypair.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package aws

import (
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"testing"
"github.com/gruntwork-io/terratest/modules/ssh"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/ssh"
)

type Ec2Keypair struct {
Expand Down
11 changes: 6 additions & 5 deletions modules/aws/keypair_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package aws

import (
"fmt"
"strings"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/terratest/modules/random"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/aws"
"strings"
)

func TestCreateImportAndDeleteEC2KeyPair(t *testing.T) {
Expand Down Expand Up @@ -48,4 +49,4 @@ func keyPairExists(t *testing.T, keyPair *Ec2Keypair) bool {
func deleteKeyPair(t *testing.T, keyPair *Ec2Keypair) {
DeleteEC2KeyPair(t, keyPair)
assert.False(t, keyPairExists(t, keyPair))
}
}
5 changes: 3 additions & 2 deletions modules/aws/kms.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/kms"
"github.com/aws/aws-sdk-go/aws"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/kms"
)

// Get the ARN of a KMS Customer Master Key (CMK) in the given region with the given ID. The ID can be an alias, such
Expand Down
9 changes: 4 additions & 5 deletions modules/aws/region.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/ec2"
"os"
"github.com/aws/aws-sdk-go/aws"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/gruntwork-io/terratest/modules/collections"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/random"
)

// You can set this environment variable to force Terratest to use a specific region rather than a random one. This is
Expand Down Expand Up @@ -120,5 +121,3 @@ func GetAvailabilityZonesE(t *testing.T, region string) ([]string, error) {

return out, nil
}


4 changes: 2 additions & 2 deletions modules/aws/region_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package aws

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
"fmt"
)

func TestGetRandomRegion(t *testing.T) {
Expand Down Expand Up @@ -53,4 +54,3 @@ func TestGetAvailabilityZones(t *testing.T) {
assert.Regexp(t, fmt.Sprintf("^%s[a-z]$", randomRegion), az)
}
}

7 changes: 4 additions & 3 deletions modules/aws/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package aws
import (
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3"
"bytes"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/gruntwork-io/terratest/modules/logger"
)

Expand Down Expand Up @@ -71,7 +72,7 @@ func GetS3ObjectContentsE(t *testing.T, awsRegion string, bucket string, key str

res, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: &bucket,
Key: &key,
Key: &key,
})

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions modules/aws/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/random"
)

func TestCreateAndDestroyS3Bucket(t *testing.T) {
Expand Down Expand Up @@ -49,4 +49,4 @@ func TestAssertS3BucketExistsNoFalsePositive(t *testing.T) {
if err == nil {
t.Fatalf("Function claimed that S3 Bucket '%s' exists, but in fact it does not.", s3BucketName)
}
}
}
7 changes: 4 additions & 3 deletions modules/aws/sns.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package aws

import (
"github.com/aws/aws-sdk-go/service/sns"
"github.com/aws/aws-sdk-go/aws"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sns"
"github.com/gruntwork-io/terratest/modules/logger"
)

Expand Down Expand Up @@ -79,4 +80,4 @@ func NewSnsClientE(t *testing.T, region string) (*sns.SNS, error) {
}

return sns.New(sess), nil
}
}
11 changes: 6 additions & 5 deletions modules/aws/sns_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package aws

import (
"testing"
"github.com/gruntwork-io/terratest/modules/random"
"fmt"
"github.com/aws/aws-sdk-go/service/sns"
"strings"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sns"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/stretchr/testify/assert"
"strings"
)

func TestCreateAndDeleteSnsTopic(t *testing.T) {
Expand Down Expand Up @@ -41,4 +42,4 @@ func snsTopicExists(t *testing.T, region string, arn string) bool {
func deleteTopic(t *testing.T, region string, arn string) {
DeleteSNSTopic(t, region, arn)
assert.False(t, snsTopicExists(t, region, arn))
}
}
11 changes: 6 additions & 5 deletions modules/aws/sqs.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package aws

import (
"github.com/google/uuid"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/aws/aws-sdk-go/aws"
"fmt"
"strconv"
"strings"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/google/uuid"
"github.com/gruntwork-io/terratest/modules/logger"
)

Expand Down Expand Up @@ -145,8 +146,8 @@ func WaitForQueueMessage(t *testing.T, awsRegion string, queueUrl string, timeou
return QueueMessageResponse{Error: err}
}

cycles := timeout;
cycleLength := 1;
cycles := timeout
cycleLength := 1
if timeout >= 20 {
cycleLength = 20
cycles = timeout / cycleLength
Expand Down
Loading

0 comments on commit 7d31174

Please sign in to comment.