Skip to content

Commit dcb1363

Browse files
mellisBryan C. Mills
authored and
Bryan C. Mills
committed
cmd/go: parse dot-separated identifiers in build metadata
Per https://semver.org/#spec-item-10, build metadata may include a series of dot separated identifiers. Fixes #28647 Change-Id: I98655c62584a822953df71fba32b4a2cafe7a04b Reviewed-on: https://go-review.googlesource.com/c/148835 Reviewed-by: Bryan C. Mills <[email protected]>
1 parent 8bb3ae1 commit dcb1363

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/cmd/go/internal/semver/semver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func parseBuild(v string) (t, rest string, ok bool) {
263263
i := 1
264264
start := 1
265265
for i < len(v) {
266-
if !isIdentChar(v[i]) {
266+
if !isIdentChar(v[i]) && v[i] != '.' {
267267
return
268268
}
269269
if v[i] == '.' {

src/cmd/go/internal/semver/semver_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var tests = []struct {
4444
{"v1.2.3", "v1.2.3"},
4545
{"v1.2.3+meta", "v1.2.3"},
4646
{"v1.2.3+meta-pre", "v1.2.3"},
47+
{"v1.2.3+meta-pre.sha.256a", "v1.2.3"},
4748
}
4849

4950
func TestIsValid(t *testing.T) {

0 commit comments

Comments
 (0)