From 4bfe18b40d0749c073b3c4ba23f5c908436815d0 Mon Sep 17 00:00:00 2001 From: Emil Hessman Date: Sun, 2 Nov 2014 13:56:44 +0100 Subject: [PATCH] argument and verb formatting fixes reported by go vet builtin/providers/aws/tags_test.go:56: unrecognized printf verb 'i' builtin/providers/aws/tags_test.go:59: unrecognized printf verb 'i' config/config_test.go:101: possible formatting directive in Fatal call config/config_test.go:157: possible formatting directive in Fatal call config/module/get_file_test.go:91: missing argument for Fatalf(%s): format reads arg 1, have only 0 args helper/schema/schema.go:341: arg v.Type for printf verb %s of wrong type: schema.ValueType helper/schema/schema.go:656: missing argument for Errorf(%s): format reads arg 2, have only 1 args helper/schema/schema.go:912: arg schema.Type for printf verb %s of wrong type: schema.ValueType terraform/context.go:178: arg v.Type() for printf verb %s of wrong type: github.com/hashicorp/terraform/config.VariableType terraform/context.go:486: arg c.Operation for printf verb %s of wrong type: terraform.walkOperation terraform/diff_test.go:100: arg actual for printf verb %s of wrong type: terraform.DiffChangeType terraform/diff_test.go:235: arg actual for printf verb %s of wrong type: terraform.DiffChangeType --- builtin/providers/aws/tags_test.go | 4 ++-- config/config_test.go | 4 ++-- config/module/get_file_test.go | 2 +- helper/schema/schema.go | 6 +++--- terraform/context.go | 4 ++-- terraform/diff_test.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/builtin/providers/aws/tags_test.go b/builtin/providers/aws/tags_test.go index eb30f346e..6e89492ca 100644 --- a/builtin/providers/aws/tags_test.go +++ b/builtin/providers/aws/tags_test.go @@ -53,10 +53,10 @@ func TestDiffTags(t *testing.T) { cm := tagsToMap(c) rm := tagsToMap(r) if !reflect.DeepEqual(cm, tc.Create) { - t.Fatalf("%i: bad create: %#v", i, cm) + t.Fatalf("%d: bad create: %#v", i, cm) } if !reflect.DeepEqual(rm, tc.Remove) { - t.Fatalf("%i: bad remove: %#v", i, rm) + t.Fatalf("%d: bad remove: %#v", i, rm) } } } diff --git a/config/config_test.go b/config/config_test.go index 1574ba83a..7b7348fd9 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -98,7 +98,7 @@ func TestConfigValidate_countUserVar(t *testing.T) { func TestConfigValidate_countVar(t *testing.T) { c := testConfig(t, "validate-count-var") if err := c.Validate(); err != nil { - t.Fatal("err: %s", err) + t.Fatalf("err: %s", err) } } @@ -154,7 +154,7 @@ func TestConfigValidate_outputBadField(t *testing.T) { func TestConfigValidate_pathVar(t *testing.T) { c := testConfig(t, "validate-path-var") if err := c.Validate(); err != nil { - t.Fatal("err: %s", err) + t.Fatalf("err: %s", err) } } diff --git a/config/module/get_file_test.go b/config/module/get_file_test.go index 7cc69bccb..4c9f6126a 100644 --- a/config/module/get_file_test.go +++ b/config/module/get_file_test.go @@ -88,7 +88,7 @@ func TestFileGetter_dirSymlink(t *testing.T) { // Make a symlink if err := os.Symlink(dst2, dst); err != nil { - t.Fatalf("err: %s") + t.Fatalf("err: %s", err) } // With a dir that exists that isn't a symlink diff --git a/helper/schema/schema.go b/helper/schema/schema.go index 7cd0fe711..be5a56aa3 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -338,7 +338,7 @@ func (m schemaMap) Input( case TypeString: value, err = m.inputString(input, k, v) default: - panic(fmt.Sprintf("Unknown type for input: %s", v.Type)) + panic(fmt.Sprintf("Unknown type for input: %#v", v.Type)) } if err != nil { @@ -653,7 +653,7 @@ func (m schemaMap) diffString( var err error n, err = schema.DefaultFunc() if err != nil { - return fmt.Errorf("%s, error loading default: %s", err) + return fmt.Errorf("%s, error loading default: %s", k, err) } } } @@ -909,7 +909,7 @@ func (m schemaMap) validatePrimitive( return nil, []error{err} } default: - panic(fmt.Sprintf("Unknown validation type: %s", schema.Type)) + panic(fmt.Sprintf("Unknown validation type: %#v", schema.Type)) } return nil, nil diff --git a/terraform/context.go b/terraform/context.go index e2d8bbd33..81735063f 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -175,7 +175,7 @@ func (c *Context) Input(mode InputMode) error { case config.VariableTypeString: // Good! default: - panic(fmt.Sprintf("Unknown variable type: %s", v.Type())) + panic(fmt.Sprintf("Unknown variable type: %#v", v.Type())) } var defaultString string @@ -483,7 +483,7 @@ func (c *walkContext) Walk() error { case walkValidate: walkFn = c.validateWalkFn() default: - panic(fmt.Sprintf("unknown operation: %s", c.Operation)) + panic(fmt.Sprintf("unknown operation: %#v", c.Operation)) } if err := g.Walk(walkFn); err != nil { diff --git a/terraform/diff_test.go b/terraform/diff_test.go index dcee2b335..47e78c5e8 100644 --- a/terraform/diff_test.go +++ b/terraform/diff_test.go @@ -97,7 +97,7 @@ func TestModuleDiff_ChangeType(t *testing.T) { for i, tc := range cases { actual := tc.Diff.ChangeType() if actual != tc.Result { - t.Fatalf("%d: %s", i, actual) + t.Fatalf("%d: %#v", i, actual) } } } @@ -232,7 +232,7 @@ func TestInstanceDiff_ChangeType(t *testing.T) { for i, tc := range cases { actual := tc.Diff.ChangeType() if actual != tc.Result { - t.Fatalf("%d: %s", i, actual) + t.Fatalf("%d: %#v", i, actual) } } }