diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index 83557eff8..589108348 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -23,7 +23,7 @@ type Builder struct { // Prepare processes the build configuration parameters. func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { - c, warnings, errs := NewConfig(TemplateFuncs, raws...) + c, warnings, errs := NewConfig(raws...) if errs != nil { return warnings, errs } diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index d4f37a569..9605f2f4c 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -63,9 +63,9 @@ type Config struct { ctx interpolate.Context } -func NewConfig(funcMap map[string]interface{}, raws ...interface{}) (*Config, []string, error) { +func NewConfig(raws ...interface{}) (*Config, []string, error) { c := new(Config) - c.ctx.Funcs = funcMap + c.ctx.Funcs = TemplateFuncs err := config.Decode(c, &config.DecodeOpts{ Interpolate: true, InterpolateContext: &c.ctx, diff --git a/builder/googlecompute/config_test.go b/builder/googlecompute/config_test.go index cd36ba619..551692b29 100644 --- a/builder/googlecompute/config_test.go +++ b/builder/googlecompute/config_test.go @@ -181,7 +181,7 @@ func TestConfigPrepare(t *testing.T) { raw[tc.Key] = tc.Value } - _, warns, errs := NewConfig(TemplateFuncs, raw) + _, warns, errs := NewConfig(raw) if tc.Err { testConfigErr(t, warns, errs, tc.Key) @@ -240,7 +240,7 @@ func TestConfigPrepareAccelerator(t *testing.T) { } } - _, warns, errs := NewConfig(TemplateFuncs, raw) + _, warns, errs := NewConfig(raw) if tc.Err { testConfigErr(t, warns, errs, strings.TrimRight(errStr, ", ")) @@ -269,7 +269,7 @@ func TestConfigDefaults(t *testing.T) { for _, tc := range cases { raw := testConfig(t) - c, warns, errs := NewConfig(TemplateFuncs, raw) + c, warns, errs := NewConfig(raw) testConfigOk(t, warns, errs) actual := tc.Read(c) @@ -280,7 +280,7 @@ func TestConfigDefaults(t *testing.T) { } func TestImageName(t *testing.T) { - c, _, _ := NewConfig(TemplateFuncs, testConfig(t)) + c, _, _ := NewConfig(testConfig(t)) if !strings.HasPrefix(c.ImageName, "packer-") { t.Fatalf("ImageName should have 'packer-' prefix, found %s", c.ImageName) } @@ -290,7 +290,7 @@ func TestImageName(t *testing.T) { } func TestRegion(t *testing.T) { - c, _, _ := NewConfig(TemplateFuncs, testConfig(t)) + c, _, _ := NewConfig(testConfig(t)) if c.Region != "us-east1" { t.Fatalf("Region should be 'us-east1' given Zone of 'us-east1-a', but is %s", c.Region) } @@ -314,7 +314,7 @@ func testConfig(t *testing.T) map[string]interface{} { } func testConfigStruct(t *testing.T) *Config { - c, warns, errs := NewConfig(TemplateFuncs, testConfig(t)) + c, warns, errs := NewConfig(testConfig(t)) if len(warns) > 0 { t.Fatalf("bad: %#v", len(warns)) }