summaryrefslogtreecommitdiffstats
path: root/man/go-run.1
blob: baf1c20d3f7e80c2d6a614022d6f6b46ddb06d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.\"                                      Hey, EMACS: -*- nroff -*-
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.TH GO-RUN 1 "2022-08-02"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
go-run \- compile and run Go program
.SH SYNOPSIS
.B go run
.RI [ "build flags" ]
.RB [ \-exec
.IR xprog ]
.I package
.RI [ arguments... ]
.SH DESCRIPTION
Run compiles and runs the named main Go package.
.br
Typically the package is specified as a list of .go source files from a single
directory, but it may also be an import path, file system path, or pattern
matching a single known package, as in 'go run .' or 'go run my/cmd'.
.P
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 in
the current directory or any parent directory, if there is one. This is useful
for running programs without affecting the dependencies of the main module.
.P
By default, 'go run' runs the compiled binary directly: 'a.out arguments...'.
.br
If the \-exec flag is given, 'go run' invokes the binary using xprog:

.Vb 1
\&        'xprog a.out arguments...'.
.Ve
.P
If the \-exec flag is not given, GOOS or GOARCH is different from the system
default, and a program named go_$GOOS_$GOARCH_exec can be found
on the current search path, 'go run' invokes the binary using that program,
for example 'go_js_wasm_exec a.out arguments...'. This allows execution of
cross-compiled programs when a simulator or other execution method is
available.
.P
By default, \(oqgo run\(cq compiles the binary without generating the information
used by debuggers, to reduce build time. To include debugger information in
the binary, use \(oqgo build\(cq.
.P
The exit status of Run is not the exit status of the compiled binary.
.P
For more about build flags, see 'go help build'.
.br
For more about specifying packages, see 'go help packages'.
.SH SEE ALSO
.BR go-build (1).
.SH AUTHOR
.PP
This manual page was written by Michael Stapelberg <stapelberg@debian.org>
and is maintained by the
Debian Go Compiler Team <team+go-compiler@tracker.debian.org>
based on the output of 'go help run'
for the Debian project (and may be used by others).