Skip to content

Commit bb359f0

Browse files
fix: Bump minimum go to 1.22 (#21)
1 parent ab8d576 commit bb359f0

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

.github/variables/go-versions.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
latest=1.23
22
penultimate=1.22
3-
min=1.17
3+
min=1.22

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
GOLANGCI_LINT_VERSION=v1.60.1
2+
GOLANGCI_LINT_VERSION=v2.11.1
33

44
LINTER=./bin/golangci-lint
55
LINTER_VERSION_FILE=./bin/.golangci-lint-version-$(GOLANGCI_LINT_VERSION)

go.mod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
module github.com/launchdarkly/go-semver
22

3-
go 1.13
3+
go 1.22
44

55
require github.com/stretchr/testify v1.6.1
6+
7+
require (
8+
github.com/davecgh/go-spew v1.1.0 // indirect
9+
github.com/pmezard/go-difflib v1.0.0 // indirect
10+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
11+
)

parse.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
// ParseMode is an enum-like type used with ParseAs.
88
type ParseMode int
99

10-
var invalidSemverError = errors.New("invalid semantic version")
10+
var errInvalidSemver = errors.New("invalid semantic version")
1111

1212
const (
1313
// ParseModeStrict is the default parsing mode, requiring a strictly correct version string with
@@ -45,46 +45,46 @@ func ParseAs(s string, mode ParseMode) (Version, error) {
4545
if mode == ParseModeAllowMissingMinorAndPatch {
4646
result.major, term, ok = requirePositiveIntegerComponent(&scanner, dotOrHyphenOrPlusTerminator)
4747
if !ok {
48-
return Version{}, invalidSemverError
48+
return Version{}, errInvalidSemver
4949
}
5050
if term == '.' {
5151
result.minor, term, ok = requirePositiveIntegerComponent(&scanner, dotOrHyphenOrPlusTerminator)
5252
if !ok {
53-
return Version{}, invalidSemverError
53+
return Version{}, errInvalidSemver
5454
}
5555
if term == '.' {
5656
result.patch, term, ok = requirePositiveIntegerComponent(&scanner, hyphenOrPlusTerminator)
5757
if !ok {
58-
return Version{}, invalidSemverError
58+
return Version{}, errInvalidSemver
5959
}
6060
}
6161
}
6262
} else {
6363
result.major, term, ok = requirePositiveIntegerComponent(&scanner, dotTerminator)
6464
if !ok || term != '.' {
65-
return Version{}, invalidSemverError
65+
return Version{}, errInvalidSemver
6666
}
6767
result.minor, term, ok = requirePositiveIntegerComponent(&scanner, dotTerminator)
6868
if !ok || term != '.' {
69-
return Version{}, invalidSemverError
69+
return Version{}, errInvalidSemver
7070
}
7171
result.patch, term, ok = requirePositiveIntegerComponent(&scanner, hyphenOrPlusTerminator)
7272
if !ok {
73-
return Version{}, invalidSemverError
73+
return Version{}, errInvalidSemver
7474
}
7575
}
7676

7777
if term == '-' {
7878
result.prerelease, term = scanner.readUntil(plusTerminator)
7979
if result.prerelease == "" || term == scannerNonASCII || !validatePrerelease(result.prerelease) {
80-
return Version{}, invalidSemverError
80+
return Version{}, errInvalidSemver
8181
}
8282
}
8383

8484
if term == '+' {
8585
result.build, term = scanner.readUntil(noTerminator)
8686
if result.build == "" || term == scannerNonASCII || !validateBuild(result.build) {
87-
return Version{}, invalidSemverError
87+
return Version{}, errInvalidSemver
8888
}
8989
}
9090

scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (s *simpleASCIIScanner) peek() int8 {
3131
if s.pos >= s.length {
3232
return scannerEOF
3333
}
34-
var ch uint8 = s.source[s.pos]
34+
ch := s.source[s.pos]
3535
if ch == 0 || ch > unicode.MaxASCII {
3636
return scannerNonASCII
3737
}

0 commit comments

Comments
 (0)