var CmdRun … func init() { … } func runRun(ctx context.Context, cmd *base.Command, args []string) { … } // shouldUseOutsideModuleMode returns whether 'go run' will load packages in // module-aware mode, ignoring the go.mod file in the current directory. It // returns true if the first argument contains "@", does not begin with "-" // (resembling a flag) or end with ".go" (a file). The argument must not be a // local or absolute file path. // // These rules are slightly different than other commands. Whether or not // 'go run' uses this mode, it interprets arguments ending with ".go" as files // and uses arguments up to the last ".go" argument to comprise the package. // If there are no ".go" arguments, only the first argument is interpreted // as a package path, since there can be only one package. func shouldUseOutsideModuleMode(args []string) bool { … } // buildRunProgram is the action for running a binary that has already // been compiled. We ignore exit status. func buildRunProgram(b *work.Builder, ctx context.Context, a *work.Action) error { … }