Bryan C. Mills submitted this change.
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
cmd/go: clarify errors for pseudo-version commit length
These error messages contain the expected shortened revision in braces,
but don't explicitly tell the user that this is the expected one.
Just unified it with the "does not match version-control timestamp" error which does the same...
Change-Id: I8e07df7bd776fd1b39c4c90c4788cb3d626ea00b
GitHub-Last-Rev: d14681ad086790f4e43c312c8a328d588acc6ec4
GitHub-Pull-Request: golang/go#42578
Reviewed-on: https://go-review.googlesource.com/c/go/+/269877
Trust: Bryan C. Mills <bcm...@google.com>
Trust: Jay Conrod <jayc...@google.com>
Reviewed-by: Jay Conrod <jayc...@google.com>
---
M src/cmd/go/internal/modfetch/coderepo.go
M src/cmd/go/testdata/script/mod_invalid_version.txt
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go
index dfef9f7..df835c3 100644
--- a/src/cmd/go/internal/modfetch/coderepo.go
+++ b/src/cmd/go/internal/modfetch/coderepo.go
@@ -567,11 +567,11 @@
if rev != info.Short {
switch {
case strings.HasPrefix(rev, info.Short):
- return fmt.Errorf("revision is longer than canonical (%s)", info.Short)
+ return fmt.Errorf("revision is longer than canonical (expected %s)", info.Short)
case strings.HasPrefix(info.Short, rev):
- return fmt.Errorf("revision is shorter than canonical (%s)", info.Short)
+ return fmt.Errorf("revision is shorter than canonical (expected %s)", info.Short)
default:
- return fmt.Errorf("does not match short name of revision (%s)", info.Short)
+ return fmt.Errorf("does not match short name of revision (expected %s)", info.Short)
}
}
diff --git a/src/cmd/go/testdata/script/mod_invalid_version.txt b/src/cmd/go/testdata/script/mod_invalid_version.txt
index f9317b6..428b8aa 100644
--- a/src/cmd/go/testdata/script/mod_invalid_version.txt
+++ b/src/cmd/go/testdata/script/mod_invalid_version.txt
@@ -57,20 +57,20 @@
go mod edit -require golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0
cd outside
! go list -m golang.org/x/text
-stderr 'go: examp...@v0.0.0 requires\n\tgolang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(14c0d48ead0c\)'
+stderr 'go: examp...@v0.0.0 requires\n\tgolang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(expected 14c0d48ead0c\)'
cd ..
! go list -m golang.org/x/text
-stderr 'golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(14c0d48ead0c\)'
+stderr 'golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0: invalid pseudo-version: revision is shorter than canonical \(expected 14c0d48ead0c\)'
# A pseudo-version with more than 12 digits of SHA-1 prefix is invalid.
cp go.mod.orig go.mod
go mod edit -require golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a
cd outside
! go list -m golang.org/x/text
-stderr 'go: examp...@v0.0.0 requires\n\tgolang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(14c0d48ead0c\)'
+stderr 'go: examp...@v0.0.0 requires\n\tgolang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(expected 14c0d48ead0c\)'
cd ..
! go list -m golang.org/x/text
-stderr 'golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(14c0d48ead0c\)'
+stderr 'golang.org/x/te...@v0.1.1-0.20170915032832-14c0d48ead0cd47e3104ada247d91be04afc7a5a: invalid pseudo-version: revision is longer than canonical \(expected 14c0d48ead0c\)'
# A pseudo-version that does not match the commit timestamp is invalid.
cp go.mod.orig go.mod
To view, visit change 269877. To unsubscribe, or for help writing mail filters, visit settings.