run
packagestandard library go1.25.5
Go to latest Published: Dec 2, 2025 License:BSD-3-Clause
Opens a new window with list of versions in this module.
Latest LatestThis package is not in the latest version of its module.
Opens a new window with license information.
Imports:10 Opens a new window with list of imports.
Imported by:0 Opens a new window with list of known importers.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package run implements the “go run” command.
Index¶
Constants¶
This section is empty.
Variables¶
View Source
var CmdRun = &base.Command{UsageLine: "go run [build flags] [-exec xprog] package [arguments...]",Short: "compile and run Go program",Long: `Run compiles and runs the named main Go package.Typically the package is specified as a list of .go source files from a singledirectory, but it may also be an import path, file system path, or patternmatching a single known package, as in 'go run .' or 'go run my/cmd'.If the package argument has a version suffix (like @latest or @v1.0.0),"go run" builds the program in module-aware mode, ignoring the go.mod file inthe current directory or any parent directory, if there is one. This is usefulfor running programs without affecting the dependencies of the main module.If the package argument doesn't have a version suffix, "go run" may run inmodule-aware mode or GOPATH mode, depending on the GO111MODULE environmentvariable and the presence of a go.mod file. See 'go help modules' for details.If module-aware mode is enabled, "go run" runs in the context of the mainmodule.By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.If the -exec flag is given, 'go run' invokes the binary using xprog:'xprog a.out arguments...'.If the -exec flag is not given, GOOS or GOARCH is different from the systemdefault, and a program named go_$GOOS_$GOARCH_exec can be foundon the current search path, 'go run' invokes the binary using that program,for example 'go_js_wasm_exec a.out arguments...'. This allows execution ofcross-compiled programs when a simulator or other execution method isavailable.By default, 'go run' compiles the binary without generating the informationused by debuggers, to reduce build time. To include debugger information inthe binary, use 'go build'.The exit status of Run is not the exit status of the compiled binary.For more about build flags, see 'go help build'.For more about specifying packages, see 'go help packages'.See also: go build.`,}Functions¶
This section is empty.
Types¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.