mirror of
https://github.com/golang/go
synced 2024-11-18 15:34:53 -07:00
7c4b6277d7
This change appends to the pkg.go.dev link the version of the module that is being used. To get this functionality, go/packages.Package now contains a module field which gets populated from the "go list" call. This module field is then used to get the version of the module that we are linking to. Updates golang/go#36501 Change-Id: I9668a6da0fd3ec8f4cde017986419c8d28196765 Reviewed-on: https://go-review.googlesource.com/c/tools/+/219079 Run-TryBot: Rohan Challa <rohan@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
// Package packagesinternal exposes internal-only fields from go/packages.
|
|
package packagesinternal
|
|
|
|
import "time"
|
|
|
|
// Fields must match go list;
|
|
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 used when loading this module, if any
|
|
GoVersion string // go version used in module
|
|
Error *ModuleError // error loading module
|
|
}
|
|
type ModuleError struct {
|
|
Err string // the error itself
|
|
}
|
|
|
|
var GetForTest = func(p interface{}) string { return "" }
|
|
|
|
var GetModule = func(p interface{}) *Module { return nil }
|