aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-08-20 21:42:02 -0400
committerIan Lance Taylor <iant@golang.org>2018-08-22 15:51:18 +0000
commit4383edf1c622ec5c85dce698cdfdbca9fffcaf04 (patch)
tree870500117833d17f29713102619f4ceb982d3610
parente1ad7cdf4f976e2985d1ea8cf36c97850c6cfd67 (diff)
downloadgo-4383edf1c622ec5c85dce698cdfdbca9fffcaf04.tar.gz
go-4383edf1c622ec5c85dce698cdfdbca9fffcaf04.zip
[release-branch.go1.11] cmd/go: fix 'go help go.mod' example
Dropped the example referred to in the text when copying this text out of 'go help mod fix'. Fixes #27083. Change-Id: I63dfa3033fa2b2408019eef9d8b5a055aa803c57 Reviewed-on: https://go-review.googlesource.com/130140 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 27ed675b4bbb63b5b5d84a21be583ef6147a2084) Reviewed-on: https://go-review.googlesource.com/130618 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
-rw-r--r--src/cmd/go/alldocs.go30
-rw-r--r--src/cmd/go/internal/modload/help.go14
2 files changed, 35 insertions, 9 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index c67e3f5a1c..ebbd154f3e 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -905,13 +905,15 @@
// corresponding to this Go struct:
//
// type Module struct {
-// Path string // module path
-// Version string // module version
-// Error string // error loading module
-// Info string // absolute path to cached .info file
-// GoMod string // absolute path to cached .mod file
-// Zip string // absolute path to cached .zip file
-// Dir string // absolute path to cached source root directory
+// Path string // module path
+// Version string // module version
+// Error string // error loading module
+// Info string // absolute path to cached .info file
+// GoMod string // absolute path to cached .mod file
+// Zip string // absolute path to cached .zip file
+// Dir string // absolute path to cached source root directory
+// Sum string // checksum for path, version (as in go.sum)
+// GoModSum string // checksum for go.mod (as in go.sum)
// }
//
// See 'go help modules' for more about module queries.
@@ -1614,7 +1616,19 @@
//
// The go command automatically updates go.mod each time it uses the
// module graph, to make sure go.mod always accurately reflects reality
-// and is properly formatted.
+// and is properly formatted. For example, consider this go.mod file:
+//
+// module M
+//
+// require (
+// A v1
+// B v1.0.0
+// C v1.0.0
+// D v1.2.3
+// E dev
+// )
+//
+// exclude D v1.2.3
//
// The update rewrites non-canonical version identifiers to semver form,
// so A's v1 becomes v1.0.0 and E's dev becomes the pseudo-version for the
diff --git a/src/cmd/go/internal/modload/help.go b/src/cmd/go/internal/modload/help.go
index 9a12b24482..f2f3419724 100644
--- a/src/cmd/go/internal/modload/help.go
+++ b/src/cmd/go/internal/modload/help.go
@@ -420,7 +420,19 @@ See 'go help mod edit'.
The go command automatically updates go.mod each time it uses the
module graph, to make sure go.mod always accurately reflects reality
-and is properly formatted.
+and is properly formatted. For example, consider this go.mod file:
+
+ module M
+
+ require (
+ A v1
+ B v1.0.0
+ C v1.0.0
+ D v1.2.3
+ E dev
+ )
+
+ exclude D v1.2.3
The update rewrites non-canonical version identifiers to semver form,
so A's v1 becomes v1.0.0 and E's dev becomes the pseudo-version for the