rearrange and document version pkg

This commit is contained in:
Mike Bloy 2019-09-04 18:27:09 -05:00
parent e100208845
commit b7143ed450

View File

@ -1,3 +1,4 @@
// Package version implements version parsing logic
package version
import (
@ -8,15 +9,6 @@ import (
"strings"
)
// Info : data structure for program version information
type info struct {
Major int
Minor int
Patch int
Prerelease []string
BuildMeta []string
}
// gitDescribe : Git's "git describe --always --dirty" output
var gitDescribe = ""
@ -29,6 +21,15 @@ var OsArch = fmt.Sprintf("%s (%s)", runtime.GOOS, runtime.GOARCH)
// Version : the complete version data
var Version = parseGitDescribe(gitDescribe)
// Info : data structure for program version information
type info struct {
Major int
Minor int
Patch int
Prerelease []string
BuildMeta []string
}
// Equal compares two Info structs for equality
func (i info) Equal(o info) bool {
if i.Major != o.Major || i.Minor != o.Minor || i.Patch != o.Patch {