Fixed some gometalinter issues

This commit is contained in:
Britton Forsyth 2017-06-07 10:52:03 -07:00
parent f33b20e6cf
commit 00ade9f28a
5 changed files with 13 additions and 12 deletions

View file

@ -117,7 +117,7 @@ func deploy(cmd *cobra.Command, info *envCmdInfo, opts deployOptions) {
var header bytes.Buffer
printPrelude(&header, result, opts, false)
header.WriteString(fmt.Sprintf("%vDeploying changes:%v\n", colors.SpecUnimportant, colors.Reset))
fmt.Printf(colors.Colorize(&header))
fmt.Print(colors.Colorize(&header))
// Print a nice message if the update is an empty one.
empty := checkEmpty(info.Ctx.Diag, result.Plan)
@ -149,7 +149,7 @@ func deploy(cmd *cobra.Command, info *envCmdInfo, opts deployOptions) {
env := result.Info.Env
saveEnv(env, checkpoint, opts.Output, true /*overwrite*/)
fmt.Printf(colors.Colorize(&summary))
fmt.Print(colors.Colorize(&summary))
}
}
}
@ -198,7 +198,7 @@ func (prog *deployProgress) Before(step resource.Step) {
var b bytes.Buffer
b.WriteString(fmt.Sprintf("Applying step #%v [%v]%v\n", stepnum, stepop, extra))
printStep(&b, step, prog.Summary, false, "")
fmt.Printf(colors.Colorize(&b))
fmt.Print(colors.Colorize(&b))
}
func (prog *deployProgress) After(step resource.Step, state resource.State, err error) {
@ -211,7 +211,7 @@ func (prog *deployProgress) After(step resource.Step, state resource.State, err
if step.Op() == resource.OpCreate {
var b bytes.Buffer
printResourceOutputProperties(&b, step, "")
fmt.Printf(colors.Colorize(&b))
fmt.Print(colors.Colorize(&b))
}
} else {
// Issue a true, bonafide error.
@ -234,6 +234,6 @@ func (prog *deployProgress) After(step resource.Step, state resource.State, err
}
b.WriteString(colors.Reset)
b.WriteString("\n")
fmt.Printf(colors.Colorize(&b))
fmt.Print(colors.Colorize(&b))
}
}

View file

@ -104,7 +104,7 @@ func (eci *envCmdInfo) Close() error {
func confirmPrompt(msg string, name tokens.QName) bool {
prompt := fmt.Sprintf(msg, name)
fmt.Printf(
fmt.Print(
colors.ColorizeText(fmt.Sprintf("%v%v%v\n", colors.SpecAttention, prompt, colors.Reset)))
fmt.Printf("Please confirm that this is what you'd like to do by typing (\"%v\"): ", name)
reader := bufio.NewReader(os.Stdin)
@ -172,7 +172,7 @@ func removeEnv(env *resource.Env) {
deleteEnv(env)
msg := fmt.Sprintf("%sEnvironment '%s' has been removed!%s\n",
colors.SpecAttention, env.Name, colors.Reset)
fmt.Printf(colors.ColorizeText(msg))
fmt.Print(colors.ColorizeText(msg))
}
// backupEnv makes a backup of an existing file, in preparation for writing a new one. Instead of a copy, it
@ -271,7 +271,7 @@ func saveEnv(env *resource.Env, snap resource.Snapshot, file string, existok boo
// If it's not ok for the file to already exist, ensure that it doesn't.
if !existok {
if _, err := os.Stat(file); err == nil {
if _, locerr := os.Stat(file); locerr == nil {
cmdutil.Sink().Errorf(errors.ErrorIO, goerr.Errorf("file '%v' already exists", file))
return false
}

View file

@ -31,6 +31,7 @@ import (
"github.com/pulumi/lumi/pkg/util/cmdutil"
)
// NewLumiCmd creates a new Lumi Cmd instance.
func NewLumiCmd() *cobra.Command {
var logFlow bool
var logToStderr bool

View file

@ -277,7 +277,7 @@ func printClass(tok tokens.Type, class *ast.Class, exportOnly bool, indent strin
mods = append(mods, "@"+att.Decorator.Tok.String())
}
}
fmt.Printf(modString(mods))
fmt.Print(modString(mods))
if class.Extends != nil {
fmt.Printf("\n%vextends %v", indent+tab+tab, string(class.Extends.Tok))
@ -295,7 +295,7 @@ func printClass(tok tokens.Type, class *ast.Class, exportOnly bool, indent strin
memtok := tokens.NewClassMemberToken(tok, member)
printClassMember(memtok, (*class.Members)[member], exportOnly, indent+tab)
}
fmt.Printf(indent)
fmt.Print(indent)
}
fmt.Printf("}\n")
}

View file

@ -193,7 +193,7 @@ func printPlan(d diag.Sink, result *planResult, opts deployOptions) {
// Now walk the plan's steps and and pretty-print them out.
prelude.WriteString(fmt.Sprintf("%vPlanned changes:%v\n", colors.SpecUnimportant, colors.Reset))
fmt.Printf(colors.Colorize(&prelude))
fmt.Print(colors.Colorize(&prelude))
// Print a nice message if the update is an empty one.
if empty := checkEmpty(d, result.Plan); !empty {
@ -213,7 +213,7 @@ func printPlan(d diag.Sink, result *planResult, opts deployOptions) {
// Print a summary of operation counts.
printSummary(&summary, counts, opts.ShowReplaceSteps, true)
fmt.Printf(colors.Colorize(&summary))
fmt.Print(colors.Colorize(&summary))
}
}