Skip to content

Commit

Permalink
Fix build error caused by gometalinter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasell committed Jul 5, 2018
1 parent 089f004 commit a642754
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
14 changes: 4 additions & 10 deletions command/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package command

import (
"bytes"
"fmt"

"github.com/jrasell/levant/buildtime"
Expand All @@ -10,7 +9,6 @@ import (

// VersionCommand is a Command implementation that prints the version.
type VersionCommand struct {
Revision string
Version string
VersionPrerelease string
UI cli.Ui
Expand All @@ -28,18 +26,14 @@ func (c *VersionCommand) Synopsis() string {

// Run executes the version command.
func (c *VersionCommand) Run(_ []string) int {
var versionString bytes.Buffer

fmt.Fprintf(&versionString, "Levant v%s", c.Version)
if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
v := fmt.Sprintf("Levant v%s", c.Version)

if c.Revision != "" {
fmt.Fprintf(&versionString, " (%s)", c.Revision)
}
if c.VersionPrerelease != "" {
v = v + fmt.Sprintf("-%s", c.VersionPrerelease)
}

c.UI.Output(versionString.String())
c.UI.Output(v)
c.UI.Output(fmt.Sprintf("Date: %s", buildtime.BuildDate))
c.UI.Output(fmt.Sprintf("Commit: %s", buildtime.GitCommit))
c.UI.Output(fmt.Sprintf("Branch: %s", buildtime.GitBranch))
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ func RunCustom(args []string, commands map[string]cli.CommandFactory) int {

exitCode, err := cli.Run()
if err != nil {
fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
_, pErr := fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())

// If we are unable to log to stderr; try just printing the error to
// provide some insight.
if pErr != nil {
fmt.Print(pErr)
}

return 1
}

Expand Down

0 comments on commit a642754

Please sign in to comment.