]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: document GoVersion field in Module struct
authorDmitri Shuralyov <dmitshur@golang.org>
Mon, 4 Mar 2019 14:07:29 +0000 (09:07 -0500)
committerDmitri Shuralyov <dmitshur@golang.org>
Wed, 6 Mar 2019 21:35:04 +0000 (21:35 +0000)
The 'go version' statement was added during Go 1.11 development in
CL 125940. That CL added the GoVersion field to modinfo.ModulePublic
struct, but did not document it in cmd/go documentation. This was
consistent with the CL description, which stated "We aren't planning
to use this or advertise it much yet".

CL 147281, applied during Go 1.12 development, was a change to start
adding the 'go version' statement when initializing go.mod. The 'go
version' statement is now being used, and it has been documented in
the Go 1.12 release notes at https://golang.org/doc/go1.12#modules.
It's now due time to documement the GoVersion field in cmd/go as well.

Keep the Error field bottom-most, both because it makes sense not to
place it in the middle of other fields, and for consistency with the
field order in struct Package, where the Error information is located
at the very bottom.

Regenerate alldocs.go by running mkalldocs.sh.

Updates #28221
Updates #23969

Change-Id: Iaf43a0da4f6a2489d861092a1d4e002a532952cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/164878
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/alldocs.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/modinfo/info.go

index 6445a6b5e8a92f5a808d7bad5772df9240258684..6ceeef0f47ae83b9b73b9f4f9ef213347a1ff227 100644 (file)
 // applied to a Go struct, but now a Module struct:
 //
 //     type Module struct {
-//         Path     string       // module path
-//         Version  string       // module version
-//         Versions []string     // available module versions (with -versions)
-//         Replace  *Module      // replaced by this module
-//         Time     *time.Time   // time version was created
-//         Update   *Module      // available update, if any (with -u)
-//         Main     bool         // is this the main module?
-//         Indirect bool         // is this module only an indirect dependency of main module?
-//         Dir      string       // directory holding files for this module, if any
-//         GoMod    string       // path to go.mod file for this module, if any
-//         Error    *ModuleError // error loading module
+//         Path      string       // module path
+//         Version   string       // module version
+//         Versions  []string     // available module versions (with -versions)
+//         Replace   *Module      // replaced by this module
+//         Time      *time.Time   // time version was created
+//         Update    *Module      // available update, if any (with -u)
+//         Main      bool         // is this the main module?
+//         Indirect  bool         // is this module only an indirect dependency of main module?
+//         Dir       string       // directory holding files for this module, if any
+//         GoMod     string       // path to go.mod file for this module, if any
+//         GoVersion string       // go version used in module
+//         Error     *ModuleError // error loading module
 //     }
 //
 //     type ModuleError struct {
index 0c576b61285955e01618989ccfeca6f400822b00..e482c393b63d026cddd2ebdd19d4e103db11a22b 100644 (file)
@@ -202,17 +202,18 @@ When listing modules, the -f flag still specifies a format template
 applied to a Go struct, but now a Module struct:
 
     type Module struct {
-        Path     string       // module path
-        Version  string       // module version
-        Versions []string     // available module versions (with -versions)
-        Replace  *Module      // replaced by this module
-        Time     *time.Time   // time version was created
-        Update   *Module      // available update, if any (with -u)
-        Main     bool         // is this the main module?
-        Indirect bool         // is this module only an indirect dependency of main module?
-        Dir      string       // directory holding files for this module, if any
-        GoMod    string       // path to go.mod file for this module, if any
-        Error    *ModuleError // error loading module
+        Path      string       // module path
+        Version   string       // module version
+        Versions  []string     // available module versions (with -versions)
+        Replace   *Module      // replaced by this module
+        Time      *time.Time   // time version was created
+        Update    *Module      // available update, if any (with -u)
+        Main      bool         // is this the main module?
+        Indirect  bool         // is this module only an indirect dependency of main module?
+        Dir       string       // directory holding files for this module, if any
+        GoMod     string       // path to go.mod file for this module, if any
+        GoVersion string       // go version used in module
+        Error     *ModuleError // error loading module
     }
 
     type ModuleError struct {
index 7341ce44d20ae01bd1876a27f1d2eafd5ec616da..07248d1a61cb837be4d1cc7e6574407f6eb651a1 100644 (file)
@@ -20,8 +20,8 @@ type ModulePublic struct {
        Indirect  bool          `json:",omitempty"` // module is only indirectly needed by main module
        Dir       string        `json:",omitempty"` // directory holding local copy of files, if any
        GoMod     string        `json:",omitempty"` // path to go.mod file describing module, if any
-       Error     *ModuleError  `json:",omitempty"` // error loading module
        GoVersion string        `json:",omitempty"` // go version used in module
+       Error     *ModuleError  `json:",omitempty"` // error loading module
 }
 
 type ModuleError struct {