Skip to content

Commit 7f96e9f

Browse files
committed
goenv: remove WantGoVersion
1 parent d6f569d commit 7f96e9f

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

goenv/version.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ func Parse(version string) (major, minor, patch int, err error) {
6868
return major, minor, patch, nil
6969
}
7070

71-
// WantGoVersion returns true if Go version s is >= major and minor.
72-
// Returns false if s is not a valid Go version string. See [Parse] for more information.
73-
func WantGoVersion(s string, major, minor int) bool {
74-
ma, mi, _, err := Parse(s)
75-
if err != nil {
76-
return false
77-
}
78-
return ma > major || (ma == major && mi >= minor)
79-
}
80-
8171
// Compare compares two Go version strings.
8272
// The result will be 0 if a == b, -1 if a < b, and +1 if a > b.
8373
// If either a or b is not a valid Go version, it is treated as "go0.0"

goenv/version_test.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,6 @@ func TestParse(t *testing.T) {
3939
}
4040
}
4141

42-
func TestWantGoVersion(t *testing.T) {
43-
tests := []struct {
44-
v string
45-
major int
46-
minor int
47-
want bool
48-
}{
49-
{"", 0, 0, false},
50-
{"go", 0, 0, false},
51-
{"go1", 0, 0, false},
52-
{"go.0", 0, 0, false},
53-
{"go1.0", 1, 0, true},
54-
{"go1.1", 1, 1, true},
55-
{"go1.23", 1, 23, true},
56-
{"go1.23.5", 1, 23, true},
57-
{"go1.23.5-rc6", 1, 23, true},
58-
{"go2.0", 1, 23, true},
59-
{"go2.0", 2, 0, true},
60-
}
61-
for _, tt := range tests {
62-
t.Run(tt.v, func(t *testing.T) {
63-
got := WantGoVersion(tt.v, tt.major, tt.minor)
64-
if got != tt.want {
65-
t.Errorf("WantGoVersion(%q, %d, %d): expected %t; got %t",
66-
tt.v, tt.major, tt.minor, tt.want, got)
67-
}
68-
})
69-
}
70-
}
71-
7242
func TestCompare(t *testing.T) {
7343
tests := []struct {
7444
a string

0 commit comments

Comments
 (0)