Skip to content

Commit

Permalink
hcl2_upgrade: fix liniting issues with fmt.Sprintf
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lbajolet-hashicorp committed Oct 26, 2022
1 parent 8eba29d commit 125e601
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions command/hcl2_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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}"
},
}

Expand Down

0 comments on commit 125e601

Please sign in to comment.