Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 10, 2014
1 parent b43cfa3 commit 36f225d
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 68 deletions.
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func resource_aws_subnet_destroy(
_, err := ec2conn.DeleteSubnet(s.ID)
return err
}
if err := resource.Retry(10 * time.Second, f); err != nil {
if err := resource.Retry(10*time.Second, f); err != nil {
ec2err, ok := err.(*ec2.Error)
if ok && ec2err.Code == "InvalidSubnetID.NotFound" {
return nil
Expand Down
6 changes: 3 additions & 3 deletions builtin/providers/aws/structure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ func Test_flattenIPPerms(t *testing.T) {
func Test_expandListeners(t *testing.T) {
expanded := []interface{}{
map[string]interface{}{
"instance_port": 8000,
"lb_port": 80,
"instance_port": 8000,
"lb_port": 80,
"instance_protocol": "http",
"lb_protocol": "http",
"lb_protocol": "http",
},
}
listeners, err := expandListeners(expanded)
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/google/resource_compute_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func resourceComputeDisk() *schema.Resource {
},

"type": &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
Expand Down
2 changes: 1 addition & 1 deletion builtin/providers/google/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
}
}

if v, ok := d.GetOk(prefix + ".type"); ok {
if v, ok := d.GetOk(prefix + ".type"); ok {
diskTypeName := v.(string)
diskType, err := readDiskType(config, zone, diskTypeName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func TestConfigValidate_varModuleInvalid(t *testing.T) {
}

func TestNameRegexp(t *testing.T) {
cases := []struct{
cases := []struct {
Input string
Match bool
}{
Expand Down
4 changes: 2 additions & 2 deletions config/interpolate_walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type interpolationWalker struct {
//
// If Replace is true, then the return value of F will be used to
// replace the interpolation.
F interpolationWalkerFunc
Replace bool
F interpolationWalkerFunc
Replace bool

// ContextF is an advanced version of F that also receives the
// location of where it is in the structure. This lets you do
Expand Down
4 changes: 2 additions & 2 deletions helper/resource/wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestRetry(t *testing.T) {
return fmt.Errorf("error")
}

err := Retry(2 * time.Second, f)
err := Retry(2*time.Second, f)
if err != nil {
t.Fatalf("err: %s", err)
}
Expand All @@ -32,7 +32,7 @@ func TestRetry_timeout(t *testing.T) {
return fmt.Errorf("always")
}

err := Retry(1 * time.Second, f)
err := Retry(1*time.Second, f)
if err == nil {
t.Fatal("should error")
}
Expand Down
8 changes: 4 additions & 4 deletions helper/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ func TestSchemaMap_Diff(t *testing.T) {
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "0",
New: "",
Old: "0",
New: "",
NewComputed: true,
},
},
Expand Down Expand Up @@ -713,8 +713,8 @@ func TestSchemaMap_Diff(t *testing.T) {
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "0",
New: "",
Old: "0",
New: "",
NewComputed: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion log.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// These are the environmental variables that determine if we log, and if
// we log whether or not the log should go to a file.
const EnvLog = "TF_LOG" //Set to True
const EnvLog = "TF_LOG" //Set to True
const EnvLogFile = "TF_LOG_PATH" //Set to a file

// logOutput determines where we should send logs (if anywhere).
Expand Down
74 changes: 37 additions & 37 deletions terraform/graph_dot.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,49 +221,49 @@ func graphDotAddResources(

// Handle the meta resources
/*
edgeBuf.Reset()
for _, n := range g.Nouns {
_, ok := n.Meta.(*GraphNodeResourceMeta)
if !ok {
continue
}
edgeBuf.Reset()
for _, n := range g.Nouns {
_, ok := n.Meta.(*GraphNodeResourceMeta)
if !ok {
continue
}
// Determine which edges to add
var edges []digraph.Edge
if hasDiff {
for _, e := range n.Edges() {
rn, ok := e.Tail().(*depgraph.Noun).Meta.(*GraphNodeResource)
if !ok {
continue
}
if rn.Resource.Diff == nil || rn.Resource.Diff.Empty() {
continue
// Determine which edges to add
var edges []digraph.Edge
if hasDiff {
for _, e := range n.Edges() {
rn, ok := e.Tail().(*depgraph.Noun).Meta.(*GraphNodeResource)
if !ok {
continue
}
if rn.Resource.Diff == nil || rn.Resource.Diff.Empty() {
continue
}
edges = append(edges, e)
}
edges = append(edges, e)
} else {
edges = n.Edges()
}
} else {
edges = n.Edges()
}
// Do not draw if we have no edges
if len(edges) == 0 {
continue
}
// Do not draw if we have no edges
if len(edges) == 0 {
continue
}
uniqueName := fmt.Sprintf("%d_%s", opts.depth, n)
for _, e := range edges {
target := e.Tail()
uniqueTarget := fmt.Sprintf("%d_%s", opts.depth, target)
edgeBuf.WriteString(fmt.Sprintf(
"\t\"%s\" -> \"%s\";\n",
uniqueName,
uniqueTarget))
uniqueName := fmt.Sprintf("%d_%s", opts.depth, n)
for _, e := range edges {
target := e.Tail()
uniqueTarget := fmt.Sprintf("%d_%s", opts.depth, target)
edgeBuf.WriteString(fmt.Sprintf(
"\t\"%s\" -> \"%s\";\n",
uniqueName,
uniqueTarget))
}
}
if edgeBuf.Len() > 0 {
buf.WriteString(edgeBuf.String())
buf.WriteString("\n")
}
}
if edgeBuf.Len() > 0 {
buf.WriteString(edgeBuf.String())
buf.WriteString("\n")
}
*/
}

Expand Down
20 changes: 10 additions & 10 deletions terraform/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,16 +463,16 @@ func TestGraphAddDiff(t *testing.T) {
}

/*
TODO: test this somewhere
// Verify that the state has been added
n := g.Noun("aws_instance.foo")
rn := n.Meta.(*GraphNodeResource)
expected2 := diff.RootModule().Resources["aws_instance.foo"]
actual2 := rn.Resource.Diff
if !reflect.DeepEqual(actual2, expected2) {
t.Fatalf("bad: %#v", actual2)
}
TODO: test this somewhere
// Verify that the state has been added
n := g.Noun("aws_instance.foo")
rn := n.Meta.(*GraphNodeResource)
expected2 := diff.RootModule().Resources["aws_instance.foo"]
actual2 := rn.Resource.Diff
if !reflect.DeepEqual(actual2, expected2) {
t.Fatalf("bad: %#v", actual2)
}
*/
}

Expand Down
1 change: 0 additions & 1 deletion terraform/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,4 +921,3 @@ STATE:
<no state>
`

8 changes: 4 additions & 4 deletions terraform/ui_output_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package terraform

// MockUIOutput is an implementation of UIOutput that can be used for tests.
type MockUIOutput struct {
OutputCalled bool
OutputMessage string
OutputFn func(string)
OutputCalled bool
OutputMessage string
OutputFn func(string)
}

func (o *MockUIOutput) Output(v string) {
o.OutputCalled = true
o.OutputMessage= v
o.OutputMessage = v
if o.OutputFn != nil {
o.OutputFn(v)
}
Expand Down

0 comments on commit 36f225d

Please sign in to comment.