run

Imports

Imports #

"context"
"go/build"
"path/filepath"
"strings"
"cmd/go/internal/base"
"cmd/go/internal/cfg"
"cmd/go/internal/load"
"cmd/go/internal/modload"
"cmd/go/internal/str"
"cmd/go/internal/work"

Constants & Variables

CmdRun var #

var CmdRun = *ast.UnaryExpr

Functions

buildRunProgram function #

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

init function #

func init()

runRun function #

func runRun(ctx context.Context, cmd *base.Command, args []string)

shouldUseOutsideModuleMode function #

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

Generated with Arrow