MCPcopy Index your code
hub / github.com/coder/coder / GreaterThan

Method GreaterThan

scripts/releaser/version.go:59–83  ·  view source on GitHub ↗
(b version)

Source from the content-addressed store, hash-verified

57}
58
59func (v version) GreaterThan(b version) bool {
60 if v.Major != b.Major {
61 return v.Major > b.Major
62 }
63 if v.Minor != b.Minor {
64 return v.Minor > b.Minor
65 }
66 if v.Patch != b.Patch {
67 return v.Patch > b.Patch
68 }
69 // A release without prerelease suffix is greater than one
70 // with a prerelease suffix (v2.32.0 > v2.32.0-rc.0).
71 if v.Pre == "" && b.Pre != "" {
72 return true
73 }
74 if v.Pre != "" && b.Pre == "" {
75 return false
76 }
77 // Both have prerelease: compare numerically for RC versions.
78 if v.IsRC() && b.IsRC() {
79 return v.rcNumber() > b.rcNumber()
80 }
81 // Fallback for non-RC prerelease strings.
82 return v.Pre > b.Pre
83}
84
85func (v version) Equal(b version) bool {
86 return v.Major == b.Major && v.Minor == b.Minor && v.Patch == b.Patch && v.Pre == b.Pre

Callers 3

runReleaseFunction · 0.95
TestVersionGreaterThanFunction · 0.80
sortVersionsDescFunction · 0.80

Calls 2

IsRCMethod · 0.95
rcNumberMethod · 0.95

Tested by 1

TestVersionGreaterThanFunction · 0.64