From d961eb0a4a5533bce14e31ae810bd6baabf98d76 Mon Sep 17 00:00:00 2001 From: Dan Gillespie Date: Fri, 19 Feb 2016 17:08:59 -0800 Subject: [PATCH] renamed print to printf to satisfy govet --- cli/cli.go | 2 +- cli/deploy.go | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index e2b3f3a..f43d843 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -40,7 +40,7 @@ func (c SpreadCli) printf(message string, data ...interface{}) { fmt.Fprintf(c.out, message, data...) } -func (c SpreadCli) fatal(message string, data ...interface{}) { +func (c SpreadCli) fatalf(message string, data ...interface{}) { c.printf(message, data...) os.Exit(1) } diff --git a/cli/deploy.go b/cli/deploy.go index babe3a8..3a38b28 100644 --- a/cli/deploy.go +++ b/cli/deploy.go @@ -10,7 +10,7 @@ import ( "github.com/codegangsta/cli" ) -// Version returns the current spread version +// Deploy allows the creation of deploy.Deployments remotely func (s SpreadCli) Deploy() *cli.Command { return &cli.Command{ Name: "deploy", @@ -20,18 +20,18 @@ func (s SpreadCli) Deploy() *cli.Command { Action: func(c *cli.Context) { srcDir := c.Args().First() if len(srcDir) == 0 { - s.fatal("A directory to deploy from must be specified") + s.fatalf("A directory to deploy from must be specified") } input, err := dir.NewFileInput(srcDir) if err != nil { - s.fatal(inputError(srcDir, err)) + s.fatalf(inputError(srcDir, err)) } e, err := input.Build() if err != nil { println("build") - s.fatal(inputError(srcDir, err)) + s.fatalf(inputError(srcDir, err)) } dep, err := e.Deployment() @@ -39,32 +39,32 @@ func (s SpreadCli) Deploy() *cli.Command { // check if has pod; if not deploy objects pods, _ := input.Entities(entity.EntityPod) if len(pods) != 0 { - s.fatal("Failed to deploy: %v", err) + s.fatalf("Failed to deploy: %v", err) } objects, err := input.Objects() if err != nil { - s.fatal(inputError(srcDir, err)) + s.fatalf(inputError(srcDir, err)) } else if len(objects) == 0 { - s.fatal("Couldn't find objects to deploy in '%s'", srcDir) + s.fatalf("Couldn't find objects to deploy in '%s'", srcDir) } dep = new(deploy.Deployment) for _, obj := range objects { err = dep.Add(obj) if err != nil { - s.fatal(inputError(srcDir, err)) + s.fatalf(inputError(srcDir, err)) } } } else if err != nil { println("deploy") - s.fatal(inputError(srcDir, err)) + s.fatalf(inputError(srcDir, err)) } context := c.Args().Get(1) cluster, err := deploy.NewKubeClusterFromContext(context) if err != nil { - s.fatal("Failed to deploy: %v", err) + s.fatalf("Failed to deploy: %v", err) } s.printf("Deploying %d objects using the %s.", dep.Len(), displayContext(context)) @@ -73,7 +73,7 @@ func (s SpreadCli) Deploy() *cli.Command { err = cluster.Deploy(dep, update) if err != nil { //TODO: make better error messages (one to indicate a deployment already existed; another one if a deployment did not exist but some other error was thrown - s.fatal("Did not deploy.: %v", err) + s.fatalf("Did not deploy.: %v", err) } s.printf("Deployment successful!")