hcl2_upgrade: fix liniting issues with fmt.Sprintf

Some literal strings without format-string directives nor arguments were
littered around the hcl2_upgrade command's code, which is pointed out by
the linters.

Since they serve no purpose, we remove them.
pull/12085/head
Lucas Bajolet 4 years ago committed by Lucas Bajolet
parent 3c249c0d42
commit 296562614f

@ -155,7 +155,7 @@ func (c *HCL2UpgradeCommand) RunContext(_ context.Context, cla *HCL2UpgradeArgs)
hdl, ret := c.GetConfigFromJSON(&cla.MetaArgs)
if ret != 0 {
c.Ui.Error(fmt.Sprintf("Failed to get config from JSON"))
c.Ui.Error("Failed to get config from JSON")
return 1
}
@ -425,16 +425,16 @@ func transposeTemplatingCalls(s []byte) []byte {
return fmt.Sprintf("${data.%s}", a)
},
"template_dir": func() string {
return fmt.Sprintf("${path.root}")
return "${path.root}"
},
"pwd": func() string {
return fmt.Sprintf("${path.cwd}")
return "${path.cwd}"
},
"packer_version": func() string {
return fmt.Sprintf("${packer.version}")
return "${packer.version}"
},
"uuid": func() string {
return fmt.Sprintf("${uuidv4()}")
return "${uuidv4()}"
},
"lower": func(a string) (string, error) {
funcErrors = multierror.Append(funcErrors, UnhandleableArgumentError{
@ -487,10 +487,10 @@ func transposeTemplatingCalls(s []byte) []byte {
return fmt.Sprintf("{{ clean_resource_name `%s` }}", a), nil
},
"build_name": func() string {
return fmt.Sprintf("${build.name}")
return "${build.name}"
},
"build_type": func() string {
return fmt.Sprintf("${build.type}")
return "${build.type}"
},
}

Loading…
Cancel
Save