rename some version variables to more conventional names
This commit is contained in:
parent
33e2e45346
commit
cd146dc643
@ -17,20 +17,20 @@ type Info struct {
|
||||
}
|
||||
|
||||
// Equal compares two Info structs for equality
|
||||
func (t Info) Equal(o Info) bool {
|
||||
if t.Major != o.Major || t.Minor != o.Minor || t.Patch != o.Patch {
|
||||
func (i Info) Equal(o Info) bool {
|
||||
if i.Major != o.Major || i.Minor != o.Minor || i.Patch != o.Patch {
|
||||
return false
|
||||
}
|
||||
if len(t.Prerelease) != len(o.Prerelease) || len(t.BuildInfo) != len(o.BuildInfo) {
|
||||
if len(i.Prerelease) != len(o.Prerelease) || len(i.BuildInfo) != len(o.BuildInfo) {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < len(t.Prerelease); i++ {
|
||||
if t.Prerelease[i] != o.Prerelease[i] {
|
||||
for j := 0; j < len(i.Prerelease); j++ {
|
||||
if i.Prerelease[j] != o.Prerelease[j] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(t.BuildInfo); i++ {
|
||||
if t.BuildInfo[i] != o.BuildInfo[i] {
|
||||
for j := 0; j < len(i.BuildInfo); j++ {
|
||||
if i.BuildInfo[j] != o.BuildInfo[j] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -38,19 +38,19 @@ func (t Info) Equal(o Info) bool {
|
||||
}
|
||||
|
||||
// String returns a human friendly version string
|
||||
func (t Info) String() string {
|
||||
func (i Info) String() string {
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "v%d.%d.%d", t.Major, t.Minor, t.Patch)
|
||||
if len(t.Prerelease) > 0 {
|
||||
fmt.Fprintf(&b, "-%s", strings.Join(t.Prerelease, "."))
|
||||
fmt.Fprintf(&b, "v%d.%d.%d", i.Major, i.Minor, i.Patch)
|
||||
if len(i.Prerelease) > 0 {
|
||||
fmt.Fprintf(&b, "-%s", strings.Join(i.Prerelease, "."))
|
||||
}
|
||||
if len(t.BuildInfo) > 0 {
|
||||
fmt.Fprintf(&b, "+%s", strings.Join(t.BuildInfo, "."))
|
||||
if len(i.BuildInfo) > 0 {
|
||||
fmt.Fprintf(&b, "+%s", strings.Join(i.BuildInfo, "."))
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
/*
|
||||
/* reStr is a regular expression string to parse the output of git describe
|
||||
Match groups:
|
||||
|
||||
1. version number (without "v")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user