aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/work/build.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/internal/work/build.go')
-rw-r--r--src/cmd/go/internal/work/build.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
index e0aa691659..21b2289dff 100644
--- a/src/cmd/go/internal/work/build.go
+++ b/src/cmd/go/internal/work/build.go
@@ -267,6 +267,11 @@ func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) {
}
if mask&OmitModCommonFlags == 0 {
base.AddModCommonFlags(&cmd.Flag)
+ } else {
+ // Add the overlay flag even when we don't add the rest of the mod common flags.
+ // This only affects 'go get' in GOPATH mode, but add the flag anyway for
+ // consistency.
+ cmd.Flag.StringVar(&fsys.OverlayFile, "overlay", "", "")
}
cmd.Flag.StringVar(&cfg.BuildContext.InstallSuffix, "installsuffix", "", "")
cmd.Flag.Var(&load.BuildLdflags, "ldflags", "")
@@ -279,8 +284,6 @@ func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) {
cmd.Flag.BoolVar(&cfg.BuildTrimpath, "trimpath", false, "")
cmd.Flag.BoolVar(&cfg.BuildWork, "work", false, "")
- cmd.Flag.StringVar(&fsys.OverlayFile, "overlay", "", "")
-
// Undocumented, unstable debugging flags.
cmd.Flag.StringVar(&cfg.DebugActiongraph, "debug-actiongraph", "", "")
cmd.Flag.StringVar(&cfg.DebugTrace, "debug-trace", "", "")
@@ -840,11 +843,6 @@ func installOutsideModule(ctx context.Context, args []string) {
}
// Check that named packages are all provided by the same module.
- for _, mod := range modload.LoadedModules() {
- if mod.Path == installMod.Path && mod.Version != installMod.Version {
- base.Fatalf("go install: %s: module requires a higher version of itself (%s)", installMod, mod.Version)
- }
- }
for _, pkg := range mainPkgs {
if pkg.Module == nil {
// Packages in std, cmd, and their vendored dependencies