aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/run/run.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/internal/run/run.go')
-rw-r--r--src/cmd/go/internal/run/run.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go
index 9e9e49ec898..931fdcef8f4 100644
--- a/src/cmd/go/internal/run/run.go
+++ b/src/cmd/go/internal/run/run.go
@@ -65,6 +65,7 @@ func init() {
CmdRun.Run = runRun // break init loop
work.AddBuildFlags(CmdRun, work.DefaultBuildFlags)
+ base.AddWorkfileFlag(&CmdRun.Flag)
CmdRun.Flag.Var((*base.StringsFlag)(&work.ExecCmd), "exec", "")
}
@@ -73,6 +74,8 @@ func printStderr(args ...interface{}) (int, error) {
}
func runRun(ctx context.Context, cmd *base.Command, args []string) {
+ modload.InitWorkfile()
+
if shouldUseOutsideModuleMode(args) {
// Set global module flags for 'go run cmd@version'.
// This must be done before modload.Init, but we need to call work.BuildInit