Skip to content

Commit

Permalink
renamed print to printf to satisfy govet
Browse files Browse the repository at this point in the history
  • Loading branch information
ethernetdan committed Feb 20, 2016
1 parent 1f088ca commit d961eb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
22 changes: 11 additions & 11 deletions cli/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,51 +20,51 @@ 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()
if err == entity.ErrMissingContainer {
// 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))
Expand All @@ -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!")
Expand Down

0 comments on commit d961eb0

Please sign in to comment.