961f456a1d
Quoting the new docs: « If the arguments to build are a list of .go files, build treats them as a list of source files specifying a single package. 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 multiple packages or a single non-main package, build compiles the packages but discards the resulting object, serving only as a check that the packages can be built. The -o flag, only allowed when compiling a single package, forces build to write the resulting executable or object to the named output file, instead of the default behavior described in the last two paragraphs. » There is a change in behavior here, namely that 'go build -o x.a x.go' where x.go is not a command (not package main) did not write any output files (back to at least Go 1.2) but now writes x.a. This seems more reasonable than trying to explain that -o is sometimes silently ignored. Otherwise the behavior is unchanged. The lines being deleted in goFilesPackage look like they are setting up 'go build x.o' to write 'x.a', but they were overridden by the p.target = "" in runBuild. Again back to at least Go 1.2, 'go build x.go' for a non-main package has never produced output. It seems better to keep it that way than to change it, both for historical consistency and for consistency with 'go build strings' and 'go build std'. All of this behavior is now tested. Fixes #10865. Change-Id: Iccdf21f366fbc8b5ae600a1e50dfe7fc3bff8b1c Reviewed-on: https://go-review.googlesource.com/13024 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dave Day <djd@golang.org> |
||
---|---|---|
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
For documentation about how to install and use Go, visit https://golang.org/ or load doc/install-source.html in your web browser.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Please report issues here: https://golang.org/issue/new
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Please note that we do not use pull requests.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
--
Binary Distribution Notes
If you have just untarred a binary Go distribution, you need to set the environment variable $GOROOT to the full path of the go directory (the one containing this file). You can omit the variable if you unpack it into /usr/local/go, or if you rebuild from sources by running all.bash (see doc/install-source.html). You should also add the Go binary directory $GOROOT/bin to your shell's path.
For example, if you extracted the tar file into $HOME/go, you might put the following in your .profile:
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
See https://golang.org/doc/install or doc/install.html for more details.