ModuleJSON holds information about a module.
// directory holding files for this module, if any
// path to go.mod file used when loading this module, if any
// go version used in module
// is this module only an indirect dependency of main module?
// is this the main module?
// module path
// replaced by this module
// time version was created
// available update, if any (with -u)
// module version
// available module versions (with -versions)
func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (bool, *ModuleJSON, error)
func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error)
Package-Level Functions (total 8, in which 5 are exported)
GoVersion reports the minor version number of the highest release
tag built into the go command on the PATH.
Note that this may be higher than the version of the go tool used
to build this application, and thus the versions of the standard
go/{scanner,parser,ast,types} packages that are linked into it.
In that case, callers should either downgrade to the version of
go used to build the application, or report an error that the
application is too old to use the go command on the PATH.
GoVersionOutput returns the complete output of the go version command.
ParseGoVersionOutput extracts the Go version string
from the output of the "go version" command.
Given an unrecognized form, it returns an empty string.
VendorEnabled reports whether vendoring is enabled. It takes a *Runner to execute Go commands
with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields,
of which only Verb and Args are modified to run the appropriate Go command.
Inspired by setDefaultBuildMod in modload/init.go
getMainModuleAnd114 gets one of the main modules' information and whether the
go command in use is 1.14+. This is the information needed to figure out
if vendoring should be enabled.
runCmdContext is like exec.CommandContext except it sends os.Interrupt
before os.Kill.
Package-Level Variables (total 3, in which 1 are exported)
DebugHangingGoCommands may be set by tests to enable additional
instrumentation (including panics) for debugging hanging Go commands.
See golang/go#54461 for details.
1.13: go: updates to go.mod needed, but contents have changed
1.14: go: updating go.mod: existing contents have changed since last read