Skip to content

Commit

Permalink
fix golint
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-henglu committed Nov 11, 2024
1 parent 0500284 commit 33f68be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/migrate_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ provider "azurerm" {
ErrorWriter: os.Stderr,
},
}
p, err := terraform.Plan()
p, err := terraform.Plan(nil)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -182,7 +182,7 @@ provider "azurerm" {
}

// check no plan-diff
plan, err := terraform.Plan()
plan, err := terraform.Plan(nil)
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/plan_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *PlanCommand) Synopsis() string {
func (c *PlanCommand) Plan(terraform *tf.Terraform, isPlanOnly bool) []types.AzureResource {
// get azapi resource from state
log.Printf("[INFO] running terraform plan...")
p, err := terraform.Plan(c.varFile)
p, err := terraform.Plan(&c.varFile)
if err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions tf/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ func (t *Terraform) Show() (*tfjson.State, error) {
return t.exec.Show(context.TODO())
}

func (t *Terraform) Plan(varFile string) (*tfjson.Plan, error) {
func (t *Terraform) Plan(varFile *string) (*tfjson.Plan, error) {
planOptions := []tfexec.PlanOption{tfexec.Out(planfile)}
if varFile != "" {
planOptions = append(planOptions, tfexec.VarFile(varFile))
if varFile != nil && *varFile != "" {
planOptions = append(planOptions, tfexec.VarFile(*varFile))
}
_, err := t.exec.Plan(context.TODO(), planOptions...)
if err != nil {
Expand Down

0 comments on commit 33f68be

Please sign in to comment.