summaryrefslogtreecommitdiff
path: root/src/cmd/go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/go, cmd/link: if -no-pie doesn't work, try -nopieIan Lance Taylor2017-07-201-9/+16
| | | | | | | | | | | | GCC says -no-pie, clang says -nopie. Fixes #21042 Change-Id: Iadc83ea7a48ea0debc5064c1ee8da4ebff752044 Reviewed-on: https://go-review.googlesource.com/49710 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: fix test when go source tree has POSIX ACLJess Frazelle2017-07-201-3/+7
| | | | | | | | | | | | Fixes TestGoBuildUmask when the user has a POSIX ACL on the Go source tree. Fixes #17909. Change-Id: I5bc19099af8353afd41071258f4f317612b4c8c1 Reviewed-on: https://go-review.googlesource.com/50370 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: update BuildContext.GOROOT and build.Tooldir with computed GOROOTIan Lance Taylor2017-07-142-13/+19
| | | | | | | | | | | | This is necessary to make a relocated GOROOT work correctly. Fixes #20997 Change-Id: I18624bd2e109721066cd9e4a887a12583ab79f5d Reviewed-on: https://go-review.googlesource.com/48550 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* testing: roll back CL 44352 (show in-progress tests upon SIGINT)Ian Lance Taylor2017-07-132-51/+0
| | | | | | | | | | | | | | | | CL 44352 changed the behavior of SIGINT, which can break tests that themselves use SIGINT. I think we can only implement this if the testing package has a way to know whether the code under test is using SIGINT, but os/signal does not provide an API for that. Roll back for 1.9 and think about this again for 1.10. Updates #19397 Change-Id: I021c314db2b9d0a80d0088b120a6ade685459990 Reviewed-on: https://go-review.googlesource.com/48370 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: fix docs for -timeoutRuss Cox2017-07-062-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The text before CL 45816 was: -timeout t If a test runs longer than t, panic. The default is 10 minutes (10m). CL 45816 was supposed to be about clarifying test vs test binary, and it did add the clarification of referring to "duration d", but it also introduced incorrect text about timeout 0. The new text in this CL preserves the good change and eliminates the incorrect one: -timeout d If a test binary runs longer than duration d, panic. The default is 10 minutes (10m). For #14780. Change-Id: I4f79d6e48ed9295bc9f34a36aa90d3b03b40d7f5 Reviewed-on: https://go-review.googlesource.com/47571 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: skip broken TestExecutableGOROOT/RelocatedExeBrad Fitzpatrick2017-06-271-0/+2
| | | | | | | | | | | | Test just doesn't work. Updates #20284 Change-Id: I31c3f771e68dcdc471767594a1467e19fbf5fe88 Reviewed-on: https://go-review.googlesource.com/46830 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@google.com>
* cmd/go: update helpdoc.go about '-buildmode'Dong-hee Na2017-06-272-6/+6
| | | | | | | | | | | | After https://golang.org/cl/46421 is landed. helpdoc.go should be updated that -buildmode=c-shared requires only one main package. Fixes #15082 Change-Id: I30a0ee956e6c4655c975ecdaa905887bd474952c Reviewed-on: https://go-review.googlesource.com/46810 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: add more info in t.Fatal messagego1.9beta2Brad Fitzpatrick2017-06-261-1/+1
| | | | | | | | Updates #20284 Change-Id: I4d55d6adec4e8efb54285ca27bb4fa39c76582c3 Reviewed-on: https://go-review.googlesource.com/46719 Reviewed-by: Chris Broadfoot <cbro@golang.org>
* cmd/go: fix TestExecutableGOROOT when GOROOT_FINAL is setRuss Cox2017-06-231-60/+62
| | | | | | | | | | | | | | | | If GOROOT_FINAL was set during the build, the default GOROOT will not be testGOROOT. Determine the default GOROOT by reading the right source file instead of guessing. (GOROOT_FINAL may no longer be set when the test is actually run.) Also refactor a bit. Fixes #20284. Change-Id: I2274595a235bee10c3f3a5ffecf4bb976f4d9982 Reviewed-on: https://go-review.googlesource.com/46428 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: be more precise when a directory cannot be builtRuss Cox2017-06-237-16/+74
| | | | | | | | | | | | | | | Maybe there are no Go files at all. Maybe they are all excluded by build constraints. Maybe there are only test Go files. Be specific. Fixes #17008. Fixes parts of #20760. Change-Id: If6ac82ba0ed437772e76e06763263747d3bc4f65 Reviewed-on: https://go-review.googlesource.com/46427 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: report possibly-relevant ignored symlinks during pattern matchRuss Cox2017-06-232-3/+42
| | | | | | | | | | | | | | We can't follow symlinks for fear of directory cycles and other problems, but we can at least notice potentially-relevant symlinks that are being ignored and report them. Fixes #17662. Change-Id: I1fce00bd5b80ea8df45dac8b61bfa08076ec5f4b Reviewed-on: https://go-review.googlesource.com/46425 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: detect case-insensitive import path collisionRuss Cox2017-06-233-16/+26
| | | | | | | | | | | | | | We already detect this collision when both imports are used anywhere in a single program. Also detect it when they are in different targets being processed together. Fixes #20264. Change-Id: I5d3c822aae136053fbcb5ed167e1d67f9b847a0f Reviewed-on: https://go-review.googlesource.com/46424 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: detect Go assembly before assembling with gccRuss Cox2017-06-234-0/+33
| | | | | | | | | | | | | Avoids confusing errors from the GNU assembler processing Go assembly source code. Fixes #19448. Change-Id: Ic2c68b2521847cca5a3d078a092e5c60ec340840 Reviewed-on: https://go-review.googlesource.com/46423 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: require -buildmode=c-shared to take one main packageRuss Cox2017-06-231-1/+1
| | | | | | | | | | | | | | | | | | | The current behavior is to filter out the non-main packages silently, which is confusing if there are only non-main packages. Instead, report an error unless it's used with a single main package. To be clear, I don't really know what I'm doing. It might be that multiple main packages are allowed, or even that we do want the filtering, but all.bash passes with this change, so I am taking that as a sign that we don't need that extra flexibility. Fixes #15082. Change-Id: I984d0f444a01c0ee0c3cd6646a75527ea99a9ebe Reviewed-on: https://go-review.googlesource.com/46421 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: read URL not Repository Root from svn infoRuss Cox2017-06-221-6/+11
| | | | | | | | | | | | | | | | This makes custom import path checks work even when the custom import metadata directs checking out a subtree of the subversion repository. (Git and Mercurial allow no such thing, so they are unaffected.) Fixes #20731. Change-Id: I635f3a2037d69a87c6dac7b08b0a0d8266abd250 Reviewed-on: https://go-review.googlesource.com/46417 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* testing: harmonize handling of prefix-matched benchmarksRuss Cox2017-06-203-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | If you have BenchmarkX1 with sub-benchmark Y and you have BenchmarkX2 with no sub-benchmarks, then go test -bench=X/Y runs BenchmarkX1 once with b.N=1 (to find out about Y) and then not again, because it has sub-benchmarks, but arguably also because we're interested in Y. In contrast, it runs BenchmarkX2 in full, even though clearly that is not relevant to the match X/Y. We do have to run X2 once with b.N=1 to probe for having X2/Y, but we should not run it with larger b.N. Fixes #20589. Change-Id: Ib86907e844f34dcaac6cd05757f57db1019201d0 Reviewed-on: https://go-review.googlesource.com/46031 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
* cmd/go: clarify test -run and -bench pattern matchingRuss Cox2017-06-162-18/+36
| | | | | | | | | | | | Make it clearer that -test=X/Y runs all the tests matching X, even if they don't have sub-tests matching Y. Fixes #20589. Change-Id: Ic27e89e748d60f67b50c68445ec0480066bdf207 Reviewed-on: https://go-review.googlesource.com/46030 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: improve documentation on defaults for getMarko Mudrinic2017-06-152-4/+4
| | | | | | | | | | | | | | | | | The existing docs states that, get looks for a branch or tag that matches the locally installed version of Go. First, this is only working for "go1", so it could be confusing. Second, "If no such version exists it retrieves the most recent version of the package". It's more the default branch, by git defaults, rather than most recent version. This should address the potential unclear parts. Fixes #20320 Change-Id: Id7d727d88dc350c9902974b64fa28c3766f7e245 Reviewed-on: https://go-review.googlesource.com/45890 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* testing: clarify -timeout flagKale Blankenship2017-06-152-4/+6
| | | | | | | | | | Fixes #20090 Change-Id: I881607e55cd946a703e74a7d8ae2bbde67546510 Reviewed-on: https://go-review.googlesource.com/45816 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: disable tool version check during bootstrapgo1.9beta1Brad Fitzpatrick2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | The check that the go tool version matched the go compiler version was too aggressive and didn't cover the bootstrapping case with make.bash. We never noticed because we never had a VERSION file in place. Repro: $ echo "go1.9beta1" > $GOROOT/VERSION $ cd $GOROOT/src $ ./make.bash No test, because x/build/cmd/release catches it. Updates #19064 Fixes #20674 Change-Id: Ibdd7a92377f4cc77d71ed548f02d48bde6550f67 Reviewed-on: https://go-review.googlesource.com/45778 Reviewed-by: Chris Broadfoot <cbro@golang.org>
* cmd/go: fix TestIssue7573 for absolute paths in -L optionsIan Lance Taylor2017-06-131-1/+1
| | | | | | | | | Updates #20266. Fixes #20664. Change-Id: Ifca30409fc7971497efb6d84f3f98760157c2233 Reviewed-on: https://go-review.googlesource.com/45650 Reviewed-by: Austin Clements <austin@google.com>
* cmd/go: adjust regexp that cleans cgo-related errorsRobert Griesemer2017-06-131-1/+1
| | | | | | | | | | | | | | The compiler now also prints column information - make sure we use the correct regexp for compiler error cleanups. Accept both, error positions with columns and without, since column printing may be disabled with -gcflags=-C. Fixes #20628. Change-Id: I46dc921dd5c29d7b8172cd19a3df57951f60d889 Reviewed-on: https://go-review.googlesource.com/45612 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* go/build: make -I/-L options in cgo flags absoluteIan Lance Taylor2017-06-131-3/+4
| | | | | | | | | | Fixes #20266. Change-Id: I51383820880e3d3566ef3d70650a0863756003ba Reviewed-on: https://go-review.googlesource.com/44291 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* cmd/go: initialize in get before loading packagesIan Lance Taylor2017-06-133-2/+19
| | | | | | | | | | | | | Otherwise the packages will not pick up the way that -installsuffix is changed by -buildmode and -race. Fixes #20512. Change-Id: Ieca32c958a531beb6331dff30d7e9a4998867dbb Reviewed-on: https://go-review.googlesource.com/44630 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* all: single space after periodBrad Fitzpatrick2017-06-0914-84/+84
| | | | | | | | | | | Done with grep & interactive search & replace, to double-check replacements. Not many remained after CL 20022. Fixes #18572 Change-Id: Idbe90ba3b584f9b9661d2bbd141607daaadfa41a Reviewed-on: https://go-review.googlesource.com/45270 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
* testing: show in-progress tests upon SIGINTMeir Fischer2017-06-092-0/+51
| | | | | | | | | | | | | | | | | | | Because of parallel tests, which have stalled executions, the RUN output of a test can be much earlier than its completion output resulting in hard-to-read verbose output. The tests are displayed in the order in which the output shows that they began, to make it easy to line up with the "RUN" output. Similarly, the definitions of when tests begin and complete is determined by when RUN and FAIL/SKIP/PASS are output since the focus of this code is on enhancing readability. Fixes #19397 Change-Id: I4d0ca3fd268b620484e7a190117f79a33b3dc461 Reviewed-on: https://go-review.googlesource.com/44352 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: ignore dot and underscore files in fmt, fix, and get -fixBrad Fitzpatrick2017-06-084-3/+28
| | | | | | | | | | | | | No test because as far as I can tell, there aren't existing tests for these. Fixes #18383 Change-Id: I06eaef05777a1474886167e3797c5bcd93189d1b Reviewed-on: https://go-review.googlesource.com/45156 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: fix TestBuildIDContainsArchModeEnv fail on arm64Wei Xiao2017-06-081-1/+1
| | | | | | | | | | | | | | | TestBuildIDContainsArchModeEnv fails on arm64 because defaultGO386 has different value from x86 (amd64/386). On arm64 defaultGO386 = '387' but on x86 defaultGO386 = 'sse2'. The difference will make the test succeed on x86 while fail on arm64 since it generates the same build ID. Fix it by explicitly setting GO386 instead of using default value Fixes #20608 Change-Id: I864b0e47325942d9513516bdf47f60391d18c0d0 Reviewed-on: https://go-review.googlesource.com/45112 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: reject unknown //go: comments in std libraryKeith Randall2017-06-061-0/+3
| | | | | | | | | | | Fixes #18331 Change-Id: Ie5c6685be3002533b84604ff1f13f2f0850f29e2 Reviewed-on: https://go-review.googlesource.com/45010 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* cmd/go: fix ugly "BUG" in go help message outputRuss Cox2017-06-052-6/+8
| | | | | | | | Change-Id: I4c579d0d02f6c9cbef1dc2bc2c93cff614538dea Reviewed-on: https://go-review.googlesource.com/44854 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: include Fortran files in build ID computationRuss Cox2017-06-051-0/+1
| | | | | | | | | | | | | | Otherwise removing a .f file won't trigger a rebuild. Noticed by inspection while working on the code. I don't have a good way to write a test for this, and I expect the code to change significantly in the next release, but might as well get it right for Go 1.9. Change-Id: I3f6f9f71b3a7d4f0be49a47419dac59899959e7c Reviewed-on: https://go-review.googlesource.com/44855 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: reject -buildmode=plugin if package is not mainAlexander Menzhinsky2017-06-052-9/+26
| | | | | | | | | | Fixes #17625 Change-Id: I09319b888b547c631a50dbfab9255cc08e8a2426 Reviewed-on: https://go-review.googlesource.com/40691 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: remove TestCoverageUsesActualSettingToOverrideEvenForRaceIan Lance Taylor2017-06-021-23/+0
| | | | | | | | | | | | The test no longer passes as of https://golang.org/cl/43777, which intentionally disables the feature that this test was checking for. Nobody noticed since the test is not run in -short mode. Updates #20435. Change-Id: I64f37fd94c01f22ead88470b6d9bfe8a151ddb1c Reviewed-on: https://go-review.googlesource.com/44650 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* cmd/go: include GOARM and GO386 in computed build IDBrad Fitzpatrick2017-05-234-2/+56
| | | | | | | | | | | | | | | | | | | | | | Now: $ GOARCH=arm GOARM=5 go install -x cmd/go ... followed by: $ GOARCH=arm GOARM= go install -x cmd/go ... actually does work. Previously the second "go install" would reuse the cached binaries from the GOARM=5 command and not rebuild. (Or vice versa from GOARM= to GOARM=5) And do the same for GO386. Fixes #9737 Change-Id: I9630aab34d06465d5033e6743dfe6592c8247aa0 Reviewed-on: https://go-review.googlesource.com/43855 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: warn on -race with -covermode=set.Dhananjay Nakrani2017-05-222-0/+22
| | | | | | | | | | Fixes #20435. Change-Id: I15576f36b26d01642c1187325baea82d3077e578 Reviewed-on: https://go-review.googlesource.com/43777 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: Document that -cover causes incorrect line numbersSteven Hartland2017-05-222-0/+11
| | | | | | | | | | | | | Due to the fact that -cover injects additional code to the original source, tests run with -cover will often have incorrect line numbers. Also includes docs for -list regexp missed by ba8ff87 Updates #6329 Change-Id: I87f0618ac31e96071bca61055cc17c0cbdee208a Reviewed-on: https://go-review.googlesource.com/38640 Reviewed-by: Rob Pike <r@golang.org>
* cmd/go: don't fail on missing runtime/internal/sys/zversion.goIan Lance Taylor2017-05-171-1/+4
| | | | | | | | | | | | | | | | | The generated file runtime/internal/sys/zversion.go is deleted by `go tool cmd dist clean` as part of running clean.bash. Don't treat a missing file as a reason to stop running the go tool; just treat is as meaning that runtime/internal/sys is stale. No test because I don't particularly want to clobber $GOROOT. Fixes #20385. Change-Id: I5251a99542cc93c33f627f133d7118df56e18af1 Reviewed-on: https://go-review.googlesource.com/43559 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: fix TestExecutableGOROOT if GOROOT is a symlinkIan Lance Taylor2017-05-171-8/+11
| | | | | | | | | | | Fixes #20365. Change-Id: If1a4866193cff3bc836d8bbf18b6a1f5deb9808d Reviewed-on: https://go-review.googlesource.com/43550 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
* cmd/go: fix TestExecutableGOROOT on WindowsIan Lance Taylor2017-05-121-3/+10
| | | | | | | | | | | | On Windows the drive letter is sometime "c:" and sometimes "C:". Fixes #20336. Change-Id: I38c86999af9522c51470d60016729d41cfec6b25 Reviewed-on: https://go-review.googlesource.com/43390 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: use filepath.Base for getting $CC name in TestCgoContainsSpaceHiroshi Ioka2017-05-121-3/+5
| | | | | | | | Change-Id: If7329b81073d7c98fdcb8a2c0b35f8708000606e Reviewed-on: https://go-review.googlesource.com/43332 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: fix TestCgoContainsSpaceHiroshi Ioka2017-05-121-13/+20
| | | | | | | | | | | | | | | | | | | TestCgoContainsSpace builds a small program which mimics $CC. Usually, $CC attempts to compile a trivial code to detect its own supported flags (i.e. "-no-pie", which must be passed on some systems), however the mimic didn't consider these cases. This CL solve the issue. Also, use the same name as $CC, it may solve other potential problems. Fixes #20324 Change-Id: I7a00ac016a5fd0667540f2a715371f8152edc395 Reviewed-on: https://go-review.googlesource.com/43330 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/build: accept spaces in cgo directivesHiroshi Ioka2017-05-101-0/+64
| | | | | | | | | | Fixes #7906 Change-Id: Ibcf9cd670593241921ab3c426ff7357f799ebc3e Reviewed-on: https://go-review.googlesource.com/43072 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: enable concurrent backend compilation by defaultJosh Bleecher Snyder2017-05-091-1/+1
| | | | | | | | | | | | | It can be disabled by setting the environment variable GO19CONCURRENTCOMPILATION=0, or with -gcflags=-c=1. Fixes #15756. Change-Id: I7acbf16330512b62ee14ecbab1f46b53ec5a67b6 Reviewed-on: https://go-review.googlesource.com/41820 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
* cmd/go: add support for concurrent backend compilationJosh Bleecher Snyder2017-05-091-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is disabled by default. It can be enabled by setting the environment variable GO19CONCURRENTCOMPILATION=1. Benchmarking results are presented in a grid. Columns are different values of c (compiler backend concurrency); rows are different values of p (process concurrency). 'go build -a std cmd', a 4 core raspberry pi 3: c=1 c=2 c=4 StdCmd/p=1 504s ± 2% 413s ± 4% 367s ± 3% StdCmd/p=2 314s ± 3% 266s ± 4% 267s ± 4% StdCmd/p=4 254s ± 5% 241s ± 5% 238s ± 6% 'go build -a std cmd', an 8 core darwin/amd64 laptop: c=1 c=2 c=4 c=6 c=8 StdCmd/p=1 40.4s ± 7% 31.0s ± 1% 27.3s ± 1% 27.8s ± 0% 27.7s ± 0% StdCmd/p=2 21.9s ± 1% 17.9s ± 1% 16.9s ± 1% 17.0s ± 1% 17.2s ± 0% StdCmd/p=4 17.4s ± 2% 14.5s ± 2% 13.3s ± 2% 13.5s ± 2% 13.6s ± 2% StdCmd/p=6 16.9s ± 1% 14.2s ± 2% 13.1s ± 2% 13.2s ± 2% 13.3s ± 2% StdCmd/p=8 16.7s ± 2% 14.2s ± 2% 13.2s ± 3% 13.2s ± 2% 13.4s ± 2% 'go build -a std cmd', a 96 core arm64 server: c=1 c=2 c=4 c=6 c=8 c=16 c=32 c=64 c=96 StdCmd/p=1 173s ± 1% 133s ± 1% 114s ± 1% 109s ± 1% 106s ± 0% 106s ± 1% 107s ± 1% 110s ± 1% 113s ± 1% StdCmd/p=2 94.2s ± 2% 71.5s ± 1% 61.7s ± 1% 58.7s ± 1% 57.5s ± 2% 56.9s ± 1% 58.0s ± 1% 59.6s ± 1% 61.0s ± 1% StdCmd/p=4 74.1s ± 2% 53.5s ± 1% 43.7s ± 2% 40.5s ± 1% 39.2s ± 2% 38.9s ± 2% 39.5s ± 3% 40.3s ± 2% 40.8s ± 1% StdCmd/p=6 69.3s ± 1% 50.2s ± 2% 40.3s ± 2% 37.3s ± 3% 36.0s ± 3% 35.3s ± 2% 36.0s ± 2% 36.8s ± 2% 37.5s ± 2% StdCmd/p=8 66.1s ± 2% 47.7s ± 2% 38.6s ± 2% 35.7s ± 2% 34.4s ± 1% 33.6s ± 2% 34.2s ± 2% 34.6s ± 1% 35.0s ± 1% StdCmd/p=16 63.4s ± 2% 45.3s ± 2% 36.3s ± 2% 33.3s ± 2% 32.0s ± 3% 31.6s ± 2% 32.1s ± 2% 32.5s ± 2% 32.7s ± 2% StdCmd/p=32 62.2s ± 1% 44.2s ± 2% 35.3s ± 2% 32.4s ± 2% 31.2s ± 2% 30.9s ± 2% 31.1s ± 2% 31.7s ± 2% 32.0s ± 2% StdCmd/p=64 62.2s ± 1% 44.3s ± 2% 35.4s ± 2% 32.4s ± 2% 31.2s ± 2% 30.9s ± 2% 31.2s ± 2% 31.8s ± 3% 32.2s ± 3% StdCmd/p=96 62.2s ± 2% 44.4s ± 2% 35.3s ± 2% 32.3s ± 2% 31.1s ± 2% 30.9s ± 3% 31.3s ± 2% 31.7s ± 1% 32.1s ± 2% benchjuju, an 8 core darwin/amd64 laptop: c=1 c=2 c=4 c=6 c=8 BuildJuju/p=1 55.3s ± 0% 46.3s ± 0% 41.9s ± 0% 41.4s ± 1% 41.3s ± 0% BuildJuju/p=2 33.7s ± 1% 28.4s ± 1% 26.7s ± 1% 26.6s ± 1% 26.8s ± 1% BuildJuju/p=4 24.7s ± 1% 22.3s ± 1% 21.4s ± 1% 21.7s ± 1% 21.8s ± 1% BuildJuju/p=6 20.6s ± 1% 19.3s ± 2% 19.4s ± 1% 19.7s ± 1% 19.9s ± 1% BuildJuju/p=8 20.6s ± 2% 19.5s ± 2% 19.3s ± 2% 19.6s ± 1% 19.8s ± 2% Updates #15756 Change-Id: I8a56e88953071a05eee764002024c54cd888a56c Reviewed-on: https://go-review.googlesource.com/41819 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: put user flags after code generation flagIan Lance Taylor2017-05-092-3/+31
| | | | | | | | | | | | | | | | This permits the user to override the code generation flag when they know better. This is always a good policy for all flags automatically inserted by the build system. Doing this now so that I can write a test for #20290. Update #20290 Change-Id: I5c6708a277238d571b8d037993a5a59e2a442e98 Reviewed-on: https://go-review.googlesource.com/42952 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: run tests that require symlinksAlex Brainman2017-05-091-20/+5
| | | | | | | | Change-Id: I19a724ea4eb1ba0ff558721650c89a949e53b7c7 Reviewed-on: https://go-review.googlesource.com/42895 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go, cmd/compile: match tool versionsDavid Crawshaw2017-05-043-0/+33
| | | | | | | | | | | | | | | | | | | This change passes runtime.Version from the go tool to the compiler. If the versions do not match, the compilation fails. The result is a go tool from one GOROOT will complain loudly if it is invoked with a different GOROOT value. Only release versions are checked, so that when developing Go you can still use "go install cmd/go" and "go install cmd/compile" separately. Fixes #19064 Change-Id: I17e184d07d3c1092b1d9af53ba55ed3ecf67791d Reviewed-on: https://go-review.googlesource.com/42595 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: use time.Time.Equal instead of == in some testsBrad Fitzpatrick2017-05-041-1/+1
| | | | | | | | | | | | | (Found by making time.Time uncomparable and rerunning std tests locally.) Change-Id: I4fa6fb0ba7334965362387e2f6541c17a27ac3aa Reviewed-on: https://go-review.googlesource.com/42616 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/go: use os.Executable to find GOROOTDavid Crawshaw2017-05-042-7/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, building a GOROOT using make.bash, and then moving the entire to a new path confused the go tool. Correct operation of the go tool under these conditions required either running make.bash again (not always possible if the new location was owned by a different system user) or setting the GOROOT environment variable. Setting GOROOT is unfortunate and discouraged, as it makes it too easy to use the go tool from one GOROOT and the compiler from another GOROOT. With this change, the go tool finds its GOROOT relative to its own location, using os.Executable. It checks it is in a GOROOT by searching for the GOROOT/pkg/tool directory, to avoid two plausible situations: ln -s $GOROOT/bin/go /usr/local/bin/go and PATH=$HOME/bin:$PATH GOPATH=$HOME ln -s $GOROOT/bin/go $HOME/bin/go Additionally, if the current executable path is not in a GOROOT, the tool will follow any symlinks for the executable and check to see if its original path is a GOROOT. Fixes #18678 Change-Id: I151d7d449d213164f98193cc176b616849e6332c Reviewed-on: https://go-review.googlesource.com/42533 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/go: error on space-separated list with commaDaniel Martí2017-04-282-0/+18
| | | | | | | | | | | | | | | | | Using 'go build -tags "foo,bar"' might seem to work when you wanted -tags "foo bar", since they make up a single tag that doesn't exist and the build is unaffected. Instead, error on any tag that contains a comma. Fixes #18800. Change-Id: I6641e03e2ae121c8878d6301c4311aef97026b73 Reviewed-on: https://go-review.googlesource.com/41951 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>