Skip to content

Commit

Permalink
removed extra parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoust committed Oct 8, 2015
1 parent 4637a34 commit e4845f7
Show file tree
Hide file tree
Showing 43 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion builtin/providers/aws/conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func unwrapAwsStringList(in []*string) []string {
ret := make([]string, len(in), len(in))
for i := 0; i < len(in); i++ {
if in[i] != nil {
ret[i] = *(in[i])
ret[i] = *in[i]
}
}
return ret
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/network_acl_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func expandNetworkAclEntries(configured []interface{}, entryType string) ([]*ec2
From: aws.Int64(int64(data["from_port"].(int))),
To: aws.Int64(int64(data["to_port"].(int))),
},
Egress: aws.Bool((entryType == "egress")),
Egress: aws.Bool(entryType == "egress"),
RuleAction: aws.String(data["action"].(string)),
RuleNumber: aws.Int64(int64(data["rule_no"].(int))),
CidrBlock: aws.String(data["cidr_block"].(string)),
Expand Down
26 changes: 13 additions & 13 deletions builtin/providers/aws/resource_aws_ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
}

image := res.Images[0]
state := *(image.State)
state := *image.State

if state == "pending" {
// This could happen if a user manually adds an image we didn't create
Expand All @@ -142,7 +142,7 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
state = *(image.State)
state = *image.State
}

if state == "deregistered" {
Expand Down Expand Up @@ -170,22 +170,22 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
for _, blockDev := range image.BlockDeviceMappings {
if blockDev.Ebs != nil {
ebsBlockDev := map[string]interface{}{
"device_name": *(blockDev.DeviceName),
"delete_on_termination": *(blockDev.Ebs.DeleteOnTermination),
"encrypted": *(blockDev.Ebs.Encrypted),
"device_name": *blockDev.DeviceName,
"delete_on_termination": *blockDev.Ebs.DeleteOnTermination,
"encrypted": *blockDev.Ebs.Encrypted,
"iops": 0,
"snapshot_id": *(blockDev.Ebs.SnapshotId),
"volume_size": int(*(blockDev.Ebs.VolumeSize)),
"volume_type": *(blockDev.Ebs.VolumeType),
"snapshot_id": *blockDev.Ebs.SnapshotId,
"volume_size": int(*blockDev.Ebs.VolumeSize),
"volume_type": *blockDev.Ebs.VolumeType,
}
if blockDev.Ebs.Iops != nil {
ebsBlockDev["iops"] = int(*(blockDev.Ebs.Iops))
ebsBlockDev["iops"] = int(*blockDev.Ebs.Iops)
}
ebsBlockDevs = append(ebsBlockDevs, ebsBlockDev)
} else {
ephemeralBlockDevs = append(ephemeralBlockDevs, map[string]interface{}{
"device_name": *(blockDev.DeviceName),
"virtual_name": *(blockDev.VirtualName),
"device_name": *blockDev.DeviceName,
"virtual_name": *blockDev.VirtualName,
})
}
}
Expand Down Expand Up @@ -301,7 +301,7 @@ func resourceAwsAmiWaitForAvailable(id string, client *ec2.EC2) (*ec2.Image, err
return nil, fmt.Errorf("new AMI vanished while pending")
}

state := *(res.Images[0].State)
state := *res.Images[0].State

if state == "pending" {
// Give it a few seconds before we poll again.
Expand All @@ -316,7 +316,7 @@ func resourceAwsAmiWaitForAvailable(id string, client *ec2.EC2) (*ec2.Image, err

// If we're not pending or available then we're in one of the invalid/error
// states, so stop polling and bail out.
stateReason := *(res.Images[0].StateReason)
stateReason := *res.Images[0].StateReason
return nil, fmt.Errorf("new AMI became %s while pending: %s", state, stateReason)
}
}
Expand Down
24 changes: 12 additions & 12 deletions builtin/providers/aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er
updates = append(updates, update)

// Hash key is required, range key isn't
hashkey_type, err := getAttributeType(d, *(gsi.KeySchema[0].AttributeName))
hashkey_type, err := getAttributeType(d, *gsi.KeySchema[0].AttributeName)
if err != nil {
return err
}
Expand All @@ -396,7 +396,7 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er

// If there's a range key, there will be 2 elements in KeySchema
if len(gsi.KeySchema) == 2 {
rangekey_type, err := getAttributeType(d, *(gsi.KeySchema[1].AttributeName))
rangekey_type, err := getAttributeType(d, *gsi.KeySchema[1].AttributeName)
if err != nil {
return err
}
Expand Down Expand Up @@ -480,8 +480,8 @@ func resourceAwsDynamoDbTableUpdate(d *schema.ResourceData, meta interface{}) er

capacityUpdated := false

if int64(gsiReadCapacity) != *(gsi.ProvisionedThroughput.ReadCapacityUnits) ||
int64(gsiWriteCapacity) != *(gsi.ProvisionedThroughput.WriteCapacityUnits) {
if int64(gsiReadCapacity) != *gsi.ProvisionedThroughput.ReadCapacityUnits ||
int64(gsiWriteCapacity) != *gsi.ProvisionedThroughput.WriteCapacityUnits {
capacityUpdated = true
}

Expand Down Expand Up @@ -544,8 +544,8 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
attributes := []interface{}{}
for _, attrdef := range table.AttributeDefinitions {
attribute := map[string]string{
"name": *(attrdef.AttributeName),
"type": *(attrdef.AttributeType),
"name": *attrdef.AttributeName,
"type": *attrdef.AttributeType,
}
attributes = append(attributes, attribute)
log.Printf("[DEBUG] Added Attribute: %s", attribute["name"])
Expand All @@ -556,9 +556,9 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
gsiList := make([]map[string]interface{}, 0, len(table.GlobalSecondaryIndexes))
for _, gsiObject := range table.GlobalSecondaryIndexes {
gsi := map[string]interface{}{
"write_capacity": *(gsiObject.ProvisionedThroughput.WriteCapacityUnits),
"read_capacity": *(gsiObject.ProvisionedThroughput.ReadCapacityUnits),
"name": *(gsiObject.IndexName),
"write_capacity": *gsiObject.ProvisionedThroughput.WriteCapacityUnits,
"read_capacity": *gsiObject.ProvisionedThroughput.ReadCapacityUnits,
"name": *gsiObject.IndexName,
}

for _, attribute := range gsiObject.KeySchema {
Expand All @@ -571,7 +571,7 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
}
}

gsi["projection_type"] = *(gsiObject.Projection.ProjectionType)
gsi["projection_type"] = *gsiObject.Projection.ProjectionType
gsi["non_key_attributes"] = gsiObject.Projection.NonKeyAttributes

gsiList = append(gsiList, gsi)
Expand Down Expand Up @@ -647,7 +647,7 @@ func createGSIFromData(data *map[string]interface{}) dynamodb.GlobalSecondaryInd

func getGlobalSecondaryIndex(indexName string, indexList []*dynamodb.GlobalSecondaryIndexDescription) (*dynamodb.GlobalSecondaryIndexDescription, error) {
for _, gsi := range indexList {
if *(gsi.IndexName) == indexName {
if *gsi.IndexName == indexName {
return gsi, nil
}
}
Expand Down Expand Up @@ -726,7 +726,7 @@ func waitForTableToBeActive(tableName string, meta interface{}) error {
return err
}

activeState = *(result.Table.TableStatus) == "ACTIVE"
activeState = *result.Table.TableStatus == "ACTIVE"

// Wait for a few seconds
if !activeState {
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_dynamodb_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func dynamoDbAttributesToMap(attributes *[]*dynamodb.AttributeDefinition) map[st
attrmap := make(map[string]string)

for _, attrdef := range *attributes {
attrmap[*(attrdef.AttributeName)] = *(attrdef.AttributeType)
attrmap[*attrdef.AttributeName] = *attrdef.AttributeType
}

return attrmap
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func resourceAwsEipRead(d *schema.ResourceData, meta interface{}) error {

// Verify AWS returned our EIP
if len(describeAddresses.Addresses) != 1 ||
(domain == "vpc" && *describeAddresses.Addresses[0].AllocationId != id) ||
domain == "vpc" && *describeAddresses.Addresses[0].AllocationId != id ||
*describeAddresses.Addresses[0].PublicIp != id {
if err != nil {
return fmt.Errorf("Unable to find EIP: %#v", describeAddresses.Addresses)
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_elb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func TestResourceAwsElbListenerHash(t *testing.T) {
for tn, tc := range cases {
leftHash := resourceAwsElbListenerHash(tc.Left)
rightHash := resourceAwsElbListenerHash(tc.Right)
if (leftHash == rightHash) != tc.Match {
if leftHash == rightHash != tc.Match {
t.Fatalf("%s: expected match: %t, but did not get it", tn, tc.Match)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func testAccCheckAWSPolicyAttachmentAttributes(users []string, roles []string, g
}
}
if uc != 0 || rc != 0 || gc != 0 {
return fmt.Errorf("Error: Number of attached users, roles, or groups was incorrect:\n expected %d users and found %d\nexpected %d roles and found %d\nexpected %d groups and found %d", len(users), (len(users) - uc), len(roles), (len(roles) - rc), len(groups), (len(groups) - gc))
return fmt.Errorf("Error: Number of attached users, roles, or groups was incorrect:\n expected %d users and found %d\nexpected %d roles and found %d\nexpected %d groups and found %d", len(users), len(users)-uc, len(roles), len(roles)-rc, len(groups), len(groups)-gc)
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions builtin/providers/aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ func readBlockDevicesFromInstance(instance *ec2.Instance, conn *ec2.EC2) (map[st
instanceBlockDevices := make(map[string]*ec2.InstanceBlockDeviceMapping)
for _, bd := range instance.BlockDeviceMappings {
if bd.Ebs != nil {
instanceBlockDevices[*(bd.Ebs.VolumeId)] = bd
instanceBlockDevices[*bd.Ebs.VolumeId] = bd
}
}

Expand Down Expand Up @@ -755,9 +755,9 @@ func readBlockDevicesFromInstance(instance *ec2.Instance, conn *ec2.EC2) (map[st
}

func blockDeviceIsRoot(bd *ec2.InstanceBlockDeviceMapping, instance *ec2.Instance) bool {
return (bd.DeviceName != nil &&
return bd.DeviceName != nil &&
instance.RootDeviceName != nil &&
*bd.DeviceName == *instance.RootDeviceName)
*bd.DeviceName == *instance.RootDeviceName
}

func fetchRootDeviceName(ami string, conn *ec2.EC2) (*string, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func verifyIPAddressParams(d *schema.ResourceData) error {
_, network := d.GetOk("network")
_, vpc := d.GetOk("vpc")

if (network && vpc) || (!network && !vpc) {
if network && vpc || !network && !vpc {
return fmt.Errorf(
"You must supply a value for either (so not both) the 'network' or 'vpc' parameter")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func resourceDockerContainerRead(d *schema.ResourceData, meta interface{}) error
}

if container.State.Running ||
(!container.State.Running && !d.Get("must_run").(bool)) {
!container.State.Running && !d.Get("must_run").(bool) {
break
}

Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/google/resource_compute_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func testAccCheckComputeInstanceDisk(instance *compute.Instance, source string,
}

for _, disk := range instance.Disks {
if strings.LastIndex(disk.Source, "/"+source) == (len(disk.Source)-len(source)-1) && disk.AutoDelete == delete && disk.Boot == boot {
if strings.LastIndex(disk.Source, "/"+source) == len(disk.Source)-len(source)-1 && disk.AutoDelete == delete && disk.Boot == boot {
return nil
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func resourceComputeSecGroupV2Delete(d *schema.ResourceData, meta interface{}) e
}

func resourceSecGroupRulesV2(d *schema.ResourceData) []secgroups.CreateRuleOpts {
rawRules := (d.Get("rule")).([]interface{})
rawRules := d.Get("rule").([]interface{})
createRuleOptsList := make([]secgroups.CreateRuleOpts, len(rawRules))
for i, raw := range rawRules {
rawMap := raw.(map[string]interface{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func resourcePoolMonitorIDsV1(d *schema.ResourceData) []string {
}

func resourcePoolMembersV1(d *schema.ResourceData) []members.CreateOpts {
memberOptsRaw := (d.Get("member")).(*schema.Set)
memberOptsRaw := d.Get("member").(*schema.Set)
memberOpts := make([]members.CreateOpts, memberOptsRaw.Len())
for i, raw := range memberOptsRaw.List() {
rawMap := raw.(map[string]interface{})
Expand Down
4 changes: 2 additions & 2 deletions command/flag_kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestFlagKV(t *testing.T) {
for _, tc := range cases {
f := new(FlagKV)
err := f.Set(tc.Input)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("bad error. Input: %#v", tc.Input)
}

Expand Down Expand Up @@ -95,7 +95,7 @@ foo = "bar"

f := new(FlagKVFile)
err := f.Set(path)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("bad error. Input: %#v", tc.Input)
}

Expand Down
2 changes: 1 addition & 1 deletion communicator/winrm/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func safeDuration(dur string, defaultDur time.Duration) time.Duration {

func formatDuration(duration time.Duration) string {
h := int(duration.Hours())
m := int(duration.Minutes()) - (h * 60)
m := int(duration.Minutes()) - h*60
s := int(duration.Seconds()) - (h*3600 + m*60)

res := "PT"
Expand Down
2 changes: 1 addition & 1 deletion config/append_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestAppend(t *testing.T) {

for i, tc := range cases {
actual, err := Append(tc.c1, tc.c2)
if (err != nil) != tc.err {
if err != nil != tc.err {
t.Fatalf("%d: error fail", i)
}

Expand Down
2 changes: 1 addition & 1 deletion config/interpolate_funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ func testFunction(t *testing.T, config testFunctionConfig) {
}

out, _, err := lang.Eval(ast, langEvalConfig(config.Vars))
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Case #%d:\ninput: %#v\nerr: %s", i, tc.Input, err)
}

Expand Down
2 changes: 1 addition & 1 deletion config/interpolate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestNewInterpolatedVariable(t *testing.T) {

for i, tc := range cases {
actual, err := NewInterpolatedVariable(tc.Input)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("%d. Error: %s", i, err)
}
if !reflect.DeepEqual(actual, tc.Result) {
Expand Down
2 changes: 1 addition & 1 deletion config/lang/check_identifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestIdentifierCheck(t *testing.T) {

visitor := &IdentifierCheck{Scope: tc.Scope}
err = visitor.Visit(node)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input)
}
}
Expand Down
4 changes: 2 additions & 2 deletions config/lang/check_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestTypeCheck(t *testing.T) {

visitor := &TypeCheck{Scope: tc.Scope}
err = visitor.Visit(node)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input)
}
}
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestTypeCheck_implicit(t *testing.T) {
// Do the first pass...
visitor := &TypeCheck{Scope: tc.Scope, Implicit: implicitMap}
err = visitor.Visit(node)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input)
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion config/lang/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func TestEval(t *testing.T) {
}

out, outType, err := Eval(node, &EvalConfig{GlobalScope: tc.Scope})
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input)
}
if outType != tc.ResultType {
Expand Down
2 changes: 1 addition & 1 deletion config/lang/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func TestParse(t *testing.T) {

for _, tc := range cases {
actual, err := Parse(tc.Input)
if (err != nil) != tc.Error {
if err != nil != tc.Error {
t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input)
}
if !reflect.DeepEqual(actual, tc.Result) {
Expand Down
2 changes: 1 addition & 1 deletion config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,5 @@ func dirFiles(dir string) ([]string, []string, error) {
func isIgnoredFile(name string) bool {
return strings.HasPrefix(name, ".") || // Unix-like hidden files
strings.HasSuffix(name, "~") || // vim
(strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#")) // emacs
strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#") // emacs
}
2 changes: 1 addition & 1 deletion config/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestMerge(t *testing.T) {

for i, tc := range cases {
actual, err := Merge(tc.c1, tc.c2)
if (err != nil) != tc.err {
if err != nil != tc.err {
t.Fatalf("%d: error fail", i)
}

Expand Down
2 changes: 1 addition & 1 deletion config/module/detect_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestFileDetector_noPwd(t *testing.T) {
f := new(FileDetector)
for i, tc := range noPwdFileTests {
out, ok, err := f.Detect(tc.in, tc.pwd)
if (err != nil) != tc.err {
if err != nil != tc.err {
t.Fatalf("%d: err: %s", i, err)
}
if !ok {
Expand Down
Loading

0 comments on commit e4845f7

Please sign in to comment.