Skip to content

Commit 1a6c0c6

Browse files
committed
cmd/go: document GoVersion field in Module struct
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent c5babcc commit 1a6c0c6

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

src/cmd/go/alldocs.go

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/list/list.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,18 @@ When listing modules, the -f flag still specifies a format template
202202
applied to a Go struct, but now a Module struct:
203203
204204
type Module struct {
205-
Path string // module path
206-
Version string // module version
207-
Versions []string // available module versions (with -versions)
208-
Replace *Module // replaced by this module
209-
Time *time.Time // time version was created
210-
Update *Module // available update, if any (with -u)
211-
Main bool // is this the main module?
212-
Indirect bool // is this module only an indirect dependency of main module?
213-
Dir string // directory holding files for this module, if any
214-
GoMod string // path to go.mod file for this module, if any
215-
Error *ModuleError // error loading module
205+
Path string // module path
206+
Version string // module version
207+
Versions []string // available module versions (with -versions)
208+
Replace *Module // replaced by this module
209+
Time *time.Time // time version was created
210+
Update *Module // available update, if any (with -u)
211+
Main bool // is this the main module?
212+
Indirect bool // is this module only an indirect dependency of main module?
213+
Dir string // directory holding files for this module, if any
214+
GoMod string // path to go.mod file for this module, if any
215+
GoVersion string // go version used in module
216+
Error *ModuleError // error loading module
216217
}
217218
218219
type ModuleError struct {

src/cmd/go/internal/modinfo/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ type ModulePublic struct {
2020
Indirect bool `json:",omitempty"` // module is only indirectly needed by main module
2121
Dir string `json:",omitempty"` // directory holding local copy of files, if any
2222
GoMod string `json:",omitempty"` // path to go.mod file describing module, if any
23-
Error *ModuleError `json:",omitempty"` // error loading module
2423
GoVersion string `json:",omitempty"` // go version used in module
24+
Error *ModuleError `json:",omitempty"` // error loading module
2525
}
2626

2727
type ModuleError struct {

0 commit comments

Comments
 (0)