aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/alldocs.go
diff options
context:
space:
mode:
authorKirill Che <g4s8.public@gmail.com>2023-09-08 07:51:47 +0000
committerGopher Robot <gobot@golang.org>2023-09-20 18:22:36 +0000
commitd5138e580c2404f2b8f03d2e1e32b2226cb6bbbc (patch)
treecd15a78bec11c2699f1c24b6c2c8d268e0ebad48 /src/cmd/go/alldocs.go
parenta72d1e5bf4eedec97dbc79bce3b5dc8a76c1b2ac (diff)
downloadgo-d5138e580c2404f2b8f03d2e1e32b2226cb6bbbc.tar.gz
go-d5138e580c2404f2b8f03d2e1e32b2226cb6bbbc.zip
cmd/go: improve go build documentation
The existing documentation for `go help build` does not match the current behavior of `go build`. This commit fixes inconsistency between documentation and behavior as suggested in #60836 ticket. Fixes #60836 Change-Id: I22f24f84815f50fecfa8c51b7f1c24e8e0cd8bc8 GitHub-Last-Rev: 7613930a3d6eb10fc61f29e4bf1b7b0fc9584cf8 GitHub-Pull-Request: golang/go#61438 Reviewed-on: https://go-review.googlesource.com/c/go/+/511015 Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/go/alldocs.go')
-rw-r--r--src/cmd/go/alldocs.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 3174c6af32..392a21148b 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -79,11 +79,16 @@
//
// When compiling packages, build ignores files that end in '_test.go'.
//
-// When compiling a single main package, build writes
-// the resulting executable to an output file named after
-// the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe')
-// or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
-// The '.exe' suffix is added when writing a Windows executable.
+// When compiling a single main package, build writes the resulting
+// executable to an output file named after the last non-major-version
+// component of the package import path. The '.exe' suffix is added
+// when writing a Windows executable.
+// So 'go build example/sam' writes 'sam' or 'sam.exe'.
+// 'go build example.com/foo/v2' writes 'foo' or 'foo.exe', not 'v2.exe'.
+//
+// When compiling a package from a list of .go files, the executable
+// is named after the first source file.
+// 'go build ed.go rx.go' writes 'ed' or 'ed.exe'.
//
// When compiling multiple packages or a single non-main package,
// build compiles the packages but discards the resulting object,