From 36f225dea0fe5146f0036ea12b196903860da441 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 10 Oct 2014 14:50:35 -0700 Subject: [PATCH] fmt --- builtin/providers/aws/resource_aws_subnet.go | 2 +- builtin/providers/aws/structure_test.go | 6 +- .../providers/google/resource_compute_disk.go | 2 +- .../google/resource_compute_instance.go | 2 +- config/config_test.go | 2 +- config/interpolate_walk.go | 4 +- helper/resource/wait_test.go | 4 +- helper/schema/schema_test.go | 8 +- log.go | 2 +- terraform/graph_dot.go | 78 +++++++++---------- terraform/graph_test.go | 18 ++--- terraform/terraform_test.go | 1 - terraform/ui_output_mock.go | 8 +- 13 files changed, 68 insertions(+), 69 deletions(-) diff --git a/builtin/providers/aws/resource_aws_subnet.go b/builtin/providers/aws/resource_aws_subnet.go index 53d54e3df9..35b6fba3c4 100644 --- a/builtin/providers/aws/resource_aws_subnet.go +++ b/builtin/providers/aws/resource_aws_subnet.go @@ -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 diff --git a/builtin/providers/aws/structure_test.go b/builtin/providers/aws/structure_test.go index f5b28eb1d8..7621535fb7 100644 --- a/builtin/providers/aws/structure_test.go +++ b/builtin/providers/aws/structure_test.go @@ -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) diff --git a/builtin/providers/google/resource_compute_disk.go b/builtin/providers/google/resource_compute_disk.go index 5daf304cda..378b0171ee 100644 --- a/builtin/providers/google/resource_compute_disk.go +++ b/builtin/providers/google/resource_compute_disk.go @@ -42,7 +42,7 @@ func resourceComputeDisk() *schema.Resource { }, "type": &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, Optional: true, ForceNew: true, }, diff --git a/builtin/providers/google/resource_compute_instance.go b/builtin/providers/google/resource_compute_instance.go index d99a95563e..696d8ca912 100644 --- a/builtin/providers/google/resource_compute_instance.go +++ b/builtin/providers/google/resource_compute_instance.go @@ -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 { diff --git a/config/config_test.go b/config/config_test.go index abd2c0bbc6..b3721493dc 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -243,7 +243,7 @@ func TestConfigValidate_varModuleInvalid(t *testing.T) { } func TestNameRegexp(t *testing.T) { - cases := []struct{ + cases := []struct { Input string Match bool }{ diff --git a/config/interpolate_walk.go b/config/interpolate_walk.go index 83c7baa865..a26df9b98a 100644 --- a/config/interpolate_walk.go +++ b/config/interpolate_walk.go @@ -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 diff --git a/helper/resource/wait_test.go b/helper/resource/wait_test.go index 768ed88a61..34ca6ce188 100644 --- a/helper/resource/wait_test.go +++ b/helper/resource/wait_test.go @@ -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) } @@ -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") } diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 27b685b71b..dc3839e83a 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -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, }, }, @@ -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, }, }, diff --git a/log.go b/log.go index de90ca758d..70046b3477 100644 --- a/log.go +++ b/log.go @@ -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). diff --git a/terraform/graph_dot.go b/terraform/graph_dot.go index ce4a08d7fd..5b66d2753f 100644 --- a/terraform/graph_dot.go +++ b/terraform/graph_dot.go @@ -221,49 +221,49 @@ func graphDotAddResources( // Handle the meta resources /* - 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 - } - edges = append(edges, e) + edgeBuf.Reset() + for _, n := range g.Nouns { + _, ok := n.Meta.(*GraphNodeResourceMeta) + if !ok { + continue } - } else { - edges = n.Edges() - } - // Do not draw if we have no edges - if len(edges) == 0 { - 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) + } + } else { + edges = n.Edges() + } - 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)) + // 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)) + } + } + if edgeBuf.Len() > 0 { + buf.WriteString(edgeBuf.String()) + buf.WriteString("\n") } - } - if edgeBuf.Len() > 0 { - buf.WriteString(edgeBuf.String()) - buf.WriteString("\n") - } */ } diff --git a/terraform/graph_test.go b/terraform/graph_test.go index 1eaff78f44..f37a1081f4 100644 --- a/terraform/graph_test.go +++ b/terraform/graph_test.go @@ -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) + 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) - } + expected2 := diff.RootModule().Resources["aws_instance.foo"] + actual2 := rn.Resource.Diff + if !reflect.DeepEqual(actual2, expected2) { + t.Fatalf("bad: %#v", actual2) + } */ } diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index 6eee2c51d5..98c078a737 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -921,4 +921,3 @@ STATE: ` - diff --git a/terraform/ui_output_mock.go b/terraform/ui_output_mock.go index 8e16ac9afb..7852bc4237 100644 --- a/terraform/ui_output_mock.go +++ b/terraform/ui_output_mock.go @@ -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) }