display version correctly

This commit is contained in:
Matthew Hooker 2017-03-16 11:38:43 -07:00
parent 56d73a5b83
commit f0e83beaaa
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ func (c *VersionCommand) Run(args []string) int {
var versionString bytes.Buffer var versionString bytes.Buffer
fmt.Fprintf(&versionString, "Packer v%s", c.Version) fmt.Fprintf(&versionString, "Packer v%s", c.Version)
if c.VersionPrerelease != "" { if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, ".%s", c.VersionPrerelease) fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)
if c.Revision != "" { if c.Revision != "" {
fmt.Fprintf(&versionString, " (%s)", c.Revision) fmt.Fprintf(&versionString, " (%s)", c.Revision)

View File

@ -20,7 +20,7 @@ func FormattedVersion() string {
var versionString bytes.Buffer var versionString bytes.Buffer
fmt.Fprintf(&versionString, "%s", Version) fmt.Fprintf(&versionString, "%s", Version)
if VersionPrerelease != "" { if VersionPrerelease != "" {
fmt.Fprintf(&versionString, ".%s", VersionPrerelease) fmt.Fprintf(&versionString, "-%s", VersionPrerelease)
if GitCommit != "" { if GitCommit != "" {
fmt.Fprintf(&versionString, " (%s)", GitCommit) fmt.Fprintf(&versionString, " (%s)", GitCommit)