Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Commit

Permalink
ldflags should be strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanl committed Mar 23, 2016
1 parent 8214a72 commit a59617f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"fmt"
"strconv"

"github.com/bryanl/doit"
"github.com/spf13/cobra"
Expand All @@ -22,14 +23,17 @@ func Version() *Command {
if doit.Build != "" {
doit.DoitVersion.Build = doit.Build
}
if doit.Major != 0 {
doit.DoitVersion.Major = doit.Major
if doit.Major != "" {
i, _ := strconv.Atoi(doit.Major)
doit.DoitVersion.Major = i
}
if doit.Minor != 0 {
doit.DoitVersion.Minor = doit.Minor
if doit.Minor != "" {
i, _ := strconv.Atoi(doit.Minor)
doit.DoitVersion.Minor = i
}
if doit.Patch != 0 {
doit.DoitVersion.Patch = doit.Patch
if doit.Patch != "" {
i, _ := strconv.Atoi(doit.Patch)
doit.DoitVersion.Patch = i
}
if doit.Label != "" {
doit.DoitVersion.Label = doit.Label
Expand Down
6 changes: 3 additions & 3 deletions doit.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ var (
Build string

// Major is doctl's major version.
Major int
Major string

// Minor is doctl's minor version.
Minor int
Minor string

// Patch is doctl's patch version.
Patch int
Patch string

// Label is doctl's label.
Label string
Expand Down

0 comments on commit a59617f

Please sign in to comment.