Skip to content

Commit

Permalink
staticcheck: fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sontags committed Jan 4, 2020
1 parent ae5965d commit ffc55d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewApp() *App {

func (a App) debug(out string) {
if a.cfg.rootDebug {
fmt.Fprintf(os.Stderr, out)
fmt.Fprint(os.Stderr, out)
}
}

Expand Down
4 changes: 1 addition & 3 deletions plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ func BuildExecutionPlan(workspaces []*Workspace, roots []string, debug func(stri
// get a list of all workspaces that already have been planned
planned := []*Workspace{}
for _, i := range plan {
for _, j := range i {
planned = append(planned, j)
}
planned = append(planned, i...)
}

// get a list of uniq unplanned workspaces
Expand Down
14 changes: 7 additions & 7 deletions workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (ws Workspace) getRemoteState() (RemoteState, error) {
for filename, file := range ws.Files {
terraformMatches := refs["terraform"].FindAll(file.Raw, -1)
if len(terraformMatches) > 1 {
return rs, fmt.Errorf("Too many remote state definitions found in %s", filename)
return rs, fmt.Errorf("too many remote state definitions found in %s", filename)
} else if len(terraformMatches) < 1 {
continue
}
Expand Down Expand Up @@ -368,9 +368,9 @@ func (ws Workspace) getManualDependencies(workspaces map[string]*Workspace) ([]R
submaches := re.FindAllStringSubmatch(string(m), -1)
for _, sm := range submaches {
match := sm[0]
seg := strings.SplitN(strings.Trim(match, "{{}}"), ".", 2)
seg := strings.SplitN(strings.Trim(match, "{}"), ".", 2)
if len(seg) != 2 {
return d, fmt.Errorf("Reference '%s' seems to be malformed\n", match)
return d, fmt.Errorf("reference '%s' seems to be malformed", match)
}

workspacePath := seg[0]
Expand Down Expand Up @@ -409,9 +409,9 @@ func (ws Workspace) getManualInputs(workspaces map[string]*Workspace) ([]Input,
submaches := re.FindAllSubmatch([]byte(m), -1)
for _, sm := range submaches {
match := string(sm[0])
seg := strings.SplitN(strings.Trim(match, "{{}}"), ".", 2)
seg := strings.SplitN(strings.Trim(match, "{}"), ".", 2)
if len(seg) != 2 {
return inputs, fmt.Errorf("Reference '%s' seems to be malformed\n", match)
return inputs, fmt.Errorf("reference '%s' seems to be malformed", match)
}

workspacePath := filepath.FromSlash(seg[0])
Expand All @@ -428,7 +428,7 @@ func (ws Workspace) getManualInputs(workspaces map[string]*Workspace) ([]Input,
}
}
if o == nil {
return inputs, fmt.Errorf("Reference to '%s' in workspace '%s' does not exist\n", outputName, workspacePath)
return inputs, fmt.Errorf("reference to '%s' in workspace '%s' does not exist", outputName, workspacePath)
}

input := Input{
Expand Down Expand Up @@ -504,7 +504,7 @@ func (m Manual) render(inputs []Input) (string, error) {

out, err := cmd.Output()
if err != nil {
errOut := fmt.Errorf("Could not run command '%s %s' in '%s': %s", command, strings.Join(args, " "), chdir, err.Error())
errOut := fmt.Errorf("could not run command '%s %s' in '%s': %s", command, strings.Join(args, " "), chdir, err.Error())
return rendered, errOut
}
outStr := strings.TrimSpace(string(out))
Expand Down

0 comments on commit ffc55d4

Please sign in to comment.