aboutsummaryrefslogtreecommitdiff
path: root/src/make.bat
AgeCommit message (Collapse)Author
2025-08-11cmd/dist: require Go 1.24.6 as minimum bootstrap toolchainDmitri Shuralyov
This is a minimal change to start to require the new minimum bootstrap. Taking advantage of the newer bootstrap to simplify and improve code is left to be done in separate CLs. For #69315. Change-Id: I4bef752b2adb67e969d585d97e680d26afefc6f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/694535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-03make.bat: fix GOROOT_BOOTSTRAP detection0x2b3bfa0
Due to a flaw in the %GOROOT_BOOTSTRAP% detection logic, the last Go executable found by `where go` was taking precedence over the first one. In batch scripts, environment variable expansion happens when each line of the script is read, not when it is executed. Thus, the check in the loop for GOROOT_BOOTSTRAP being unset would always be true, even when the variable had been set in a previous loop iteration. See SET /? for more information. Change-Id: I15ddcbe771a902acb47a1f07ba7f4cb8a311e0dc Reviewed-on: https://go-review.googlesource.com/c/go/+/653535 Auto-Submit: Carlos Amedee <carlos@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-11make.bat,race.bat: simplify --dist-tool handlingqmuntal
make.bat accepts the --dist-tool flag on multiple flag positions and also allows omitting the trailing dash. Doing so adds complexity and is not aligned with the make.bash and make.rc behavior. Remove that flexibility to simplify the code and make it more consistent. This also fixes a bug where dist.exe wouldn't be removed from cmd\dist when running make.bat --dist-tool. Also, there is no need for race.bat to invoke make.bat with --dist-tool. It uses it to get the GOHOSTARCH env value, but we can already get that from the built-in PROCESSOR_ARCHITECTURE env variable. Change-Id: Ia673562c1ae6aff9bd3ec7aa8cdd25ff187eeb79 Reviewed-on: https://go-review.googlesource.com/c/go/+/648615 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-11{all,clean,make,race,run}.bat: simplify error handlingqmuntal
The bat files can use "if" + parentheses to make it easier to understand how the if-case is handled rather than the more cryptic "if" + "goto". While here, replace some "goto"s with direct "exit" calls. Change-Id: I20e1804439b5088f8f1e5cbf8676f3d58560109d Reviewed-on: https://go-review.googlesource.com/c/go/+/648375 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-07make.bat: pass through all arguments to "dist bootstrap"qmuntal
nolocal is (almost) no longer needed after CL 647115. If we remove it, then we can pass through all arguments to the Go command, which is useful for running tests with additional flags, like -json or -v. This CL also updates all.bat to use "go tool dist" instead of "%GOTOOLDIR%/dist", as %GOTOOLDIR% is no longer set after making make.bat uncoditionally set nolocal. Change-Id: I97dc687faa5686d023f7d7d2b96637295995fe67 Reviewed-on: https://go-review.googlesource.com/c/go/+/647117 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-07{all,clean,make,race,run}.bat: use || instead of "if errorlevel 1"qmuntal
"if errorlevel 1" is and old construct that returns true if the errorlevel is greater than or equal to 1. There are better alternatives since Windows NT. For example, the || operator runs the RHS operand if the preceding command failed, determined by checking that the errorlevel is different from 0. This approach is more robust -it also works with negative errorlevels- and is less verbose. Change-Id: I2070d654d8f9dd41a6cd586ba5ad5f4fea0638ed Reviewed-on: https://go-review.googlesource.com/c/go/+/647136 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2025-02-07{all,clean,make,race,run}.bat: remove %GOBUILDEXIT% and %GOBUILDFAIL%qmuntal
%GOBUILDEXIT% is used to avoid closing the terminal window when the build or the tests fail on a dev machine. It is only set in CI to get a non-zero exit code in case of failure. %GOBUILDFAIL% is used to pass the exit code from a child batch file to the parent batch file. It is set to 1 in the child batch file if the build or the tests fail. These two variables add complexity to the batch files and impose some limitations on how they are implemented. For example, the child files can't use setlocal, as it would make the parent file unable to read the %GOBUILDFAIL% variable. This CL removes these two variables and replaces them with unconditional calls to "exit /b 1" in case of failure, which is more idiomatic and composable. The trick is that the "/b" parameter makes the exit only apply to the current batch file, not the entire shell session (unless the bat file is the root, in which case the parameter is ignored), so the parent batch file can continue executing, potentially checking the errorlevel of the child batch file (which we always set to 1). Change-Id: Ib053fb181ab14d58679551e03485700de77878d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/647115 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-08-20cmd/dist: require Go 1.22.6 as minimum bootstrap toolchainDmitri Shuralyov
This is a minimal change to start to require the new minimum bootstrap. Taking advantage of the newer bootstap to simplify and improve code is left to be done in separate CLs. For #64751. Change-Id: I1d4f883fae3026354a199174d51e79a36cd2dc53 Reviewed-on: https://go-review.googlesource.com/c/go/+/606156 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-21cmd: remove support for GOROOT_FINALConstantin Konstantinidis
Fixes #62047 Change-Id: If7811c1eb9073fb09b7006076998f8b2e1810bfb Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/539975 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-08-28make.bat: don't try to download a newer toolchainqmuntal
Calling `go env GOROOT` and `go version` will try to download a newer toolchain if the current one is too old. This is not what we want when building the toolchain itself. Avoid this by setting `GO111MODULE=off`. While here, align the unset variables with nogoenv(), present in make.bash and make.rc. Fixes #62201 Fixes #62281 Change-Id: I2d3ac817c2fb161f7a31bf83e32ba934e773b6c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/523015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-07-24make.bash,bat,rc: use Go 1.20.6 instead of Go 1.17.13Russ Cox
This was missed in the update of the bootstrap toolchain and should help people who don't set GOROOT_BOOTSTRAP and instead assume these scripts will find the right one. For #54265. Change-Id: I37a0d0976006d13b73df00013780be5abf202e91 Reviewed-on: https://go-review.googlesource.com/c/go/+/512275 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-04-11cmd/dist: add -distpack flag to build distribution archivesRuss Cox
We want to enable others to reproduce the exact distribution archives we are serving on go.dev/dl. Today the code for building those archives lives in golang.org/x/build, which is fundamentally tied to running on the Go team build infrastructure and not easy for others to run. This CL adds a new flag -distpack to cmd/dist, usually invoked as make.bash -distpack, to build the distribution archives using code in the main repository that anyone can run. Starting in Go 1.21, the Go team build infrastructure will run this instead of its current custom code to build those archives. The current builds are not reproducible even given identical infrastructure, because the archives are stamped with the current time. It is helpful to have a timestamp in the archives indicating when the code is from, but that time needs to be reproducible. To ensure this, the new -distpack flag extends the VERSION file to include a time stamp, which it uses as the modification time for all files in the archive. The new -distpack flag is implemented by a separate program, cmd/distpack, instead of being in cmd/dist, so that it can be compiled by the toolchain being distributed and not the bootstrap toolchain. Otherwise details like the exact compression algorithms might vary from one bootstrap toolchain to another and produce non-reproducible builds. So there is a new 'go tool distpack', but it's omitted from the distributions themselves, just as 'go tool dist' is. make.bash already accepts any flags for cmd/dist, including -distpack. make.bat is less sophisticated and looks for each known flag, so this CL adds an update to look for -distpack. The CL also changes make.bat to accept the idiomatic Go -flagname in addition to the non-idiomatic (for Go) --flagname. Previously it insisted on the --flag form. I have confirmed that using make.bash -distpack produces the identical distribution archives for windows/amd64, linux/amd64, darwin/amd64, and darwin/arm64 whether it is run on windows/amd64, linux/amd64, or darwin/amd64 hosts. For #24904. Change-Id: Ie6d69365ee3d7294d05b4f96ffb9159b41918074 Reviewed-on: https://go-review.googlesource.com/c/go/+/470676 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Carlos Amedee <amedee@google.com>
2023-01-19make.bat: support existing toolchain paths with spacesKevin Parsons
Previously if the default go toolchain (from "where go") contained spaces, then running make.bat would fail. Fixes it to correctly treat paths with spaces. This is especially useful given that the default Go install path is under "C:\Program Files". Fixes #57918 Change-Id: Icacf8dd5178b608225f02e4a11a8753d78bed262 GitHub-Last-Rev: 4cd8a790e41353bb6bb2bfc36db1013ab0dcae6d GitHub-Pull-Request: golang/go#57836 Reviewed-on: https://go-review.googlesource.com/c/go/+/462275 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-17all: use Go 1.17.13 for bootstrapRuss Cox
Previously we used Go 1.17, but we realized thanks to tickling a pre-Go1.17.3 bug that if we are going to change the bootstrap toolchain that we should default to the latest available point release at the time we make the switch, not the initial major release, so as to avoid bugs that were fixed in the point releases. This CL updates the default search locations and the release notes. Users who run make.bash and depend on finding $HOME/sdk/go1.17 may need to run go install golang.org/dl/go1.17.13@latest go1.17.13 download to provide a Go 1.17.13 toolchain to their builds. Change-Id: I3a2511f088cf852470a7216a5a41ae775fb561b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/439419 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-15build: update comments about Go 1.4 in make.bash, make.bat, make.rcRuss Cox
A few lingering references to Go 1.4 remain. Fix them, and document the ones that should stay. For #44505. Fixes #54301. Change-Id: Ieb9c0f08e4d1890ea3fdfd9c8df5493934ae7493 Reviewed-on: https://go-review.googlesource.com/c/go/+/423354 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-14make.bat: handle spaces in path when determining bootstrap versiondjdv
Single quotes don't account for whitespace in this context, which causes output to look like this: $ ./make.bat 'C:\Program' is not recognized as an internal or external command, operable program or batch file. Building Go cmd/dist using C:\Program Files\Go. (go version =) When it should look like this: Building Go cmd/dist using C:\Program Files\Go. (go1.19 windows/amd64) For #44505. Change-Id: I71328add5c74bd2829c0e23224cfa6252395ff2c GitHub-Last-Rev: a01fda6b5226c3f1898056d1104c8bf7fc58ef99 GitHub-Pull-Request: golang/go#54270 Reviewed-on: https://go-review.googlesource.com/c/go/+/421356 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-08-03make.bat, make.rc: show bootstrap toolchain versionRuss Cox
Print the bootstrap toolchain version on Plan 9 and Windows, same as on all Unix systems since CL 204757 (Nov 2019). This makes it easier to see what is going on in a build. For #44505. Change-Id: I50cdd5e15a7c8b908e33e92780f8a3bca65c91ef Reviewed-on: https://go-review.googlesource.com/c/go/+/419452 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-05-12make.bat: call env.bat with .\env.batYasuhiro Matsumoto
When set NoDefaultCurrentDirectoryInExePath=1, call env.bat does not work. Change-Id: If63b02e236079681bdadadbdebc0b39abce01219 Reviewed-on: https://go-review.googlesource.com/c/go/+/405774 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2022-04-05cmd/dist: move more environment logic into cmd/dist from make and run scriptsBryan C. Mills
'go tool dist env' outputs different (and fewer) environment variables than 'go env'. The 'go tool dist env' variables should be authoritative, whereas many printed by 'go env' are merely informational (and not intended to be overridden in the actual environment). Fixes #52009 Change-Id: Ic0590153875183135cebf7ca55ead7c2b4038569 Reviewed-on: https://go-review.googlesource.com/c/go/+/398061 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-04make.bash: disable GOEXPERIMENT when using bootstrap toolchainRuss Cox
When using Go 1.4 this doesn't matter, but when using Go 1.17, the bootstrap toolchain will complain about unknown GOEXPERIMENT settings. Clearly GOEXPERIMENT is for the toolchain being built, not the bootstrap. Already submitted as CL 395879 on the dev.boringcrypto branch, but needed on master to set up GOEXPERIMENT=boringcrypto builder ahead of merge. For #51940. Change-Id: Ib6a4099cca799b4d5df1974cdb5471adb0fd557d Reviewed-on: https://go-review.googlesource.com/c/go/+/397894 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-21build: force GOWORK=off in make.{bash,bat,rc}Dmitri Shuralyov
While building Go from source, workspace mode should be disabled, even if the external environment tries to configure it otherwise. Fixes #51558. Change-Id: Icd7577860271f59a8f94406214b111280e4b65b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/393879 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2021-12-08build: for default bootstrap, use Go 1.17 if present, falling back to Go 1.4Russ Cox
Preparation for #44505, but safe for Go 1.18. Also fixes the default build on Macs, at least for people who have a $HOME/go1.17 or have run go install golang.org/dl/go1.17@latest go1.17 download Replay of CL 369914 after revert in CL 370138. Only change is adding 'export GOROOT_BOOTSTRAP' in make.bash. Change-Id: I8ced4e87a9dc0f05cc49095578b401ae6212ac85 Reviewed-on: https://go-review.googlesource.com/c/go/+/370274 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-08Revert "build: for default bootstrap, use Go 1.17 if present, falling back ↵Michael Pratt
to Go 1.4" This reverts https://golang.org/cl/369914. Reason for revert: Breaking previously working toolchain builds. For #44505. Change-Id: I09ae20e50109a600d036358118077d27669df39c Reviewed-on: https://go-review.googlesource.com/c/go/+/370138 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-07build: for default bootstrap, use Go 1.17 if present, falling back to Go 1.4Russ Cox
Preparation for #44505, but safe for Go 1.18. Also fixes the default build on Macs, at least for people who have a $HOME/go1.17 or have run go install golang.org/dl/go1.17@latest go1.17 download Change-Id: I822f93e75498620fad87db2436376148c42f6bff Reviewed-on: https://go-review.googlesource.com/c/go/+/369914 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-11src/make.*: make --no-clean flag a no-op that prints a warningMatthew Dempsky
This flag is undocumented and is no longer useful. Users who want to install additional toolchains without cleaning the installed packages should just use `go install`. This CL changes cmd/dist to print a warning that --no-clean is deprecated and to advise users to use `go install std cmd` instead, and then otherwise ignores it: ``` $ ./make.bash --no-clean Building Go cmd/dist using $GOROOT_BOOTSTRAP. (devel +b7a85e0003 linux/amd64) warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead Building Go toolchain1 using $GOROOT_BOOTSTRAP. ``` Fixes #47204. Change-Id: I275031832098401a49e491e324e8de3427973630 Reviewed-on: https://go-review.googlesource.com/c/go/+/341392 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-09-13make.bat: fix compare between GOROOT and srcdir paths, when either contains ↵Dominic Della Valle
whitespace. CL 96455 brings CL 57753 to Windows However, a path comparison within it was left unquoted. If the Go source directory resides in a path containing whitespace, the interpreter will compare against the first portion of the path string, and treat the remainder as an expression. This patch amends that. For example, consider the path `C:\Users\Dominic Della Valle\Projects\Go\goroot\src` Issuing `make.bat` will print out `'Della' is not recognized as an internal or external command, operable program or batch file.` before proceeding. Change-Id: Ifcec159baeec940c29c61aa721c64c13c6fd8c14 GitHub-Last-Rev: 809ddbb4dbc80d834f8108ca44c2826016d78d1c GitHub-Pull-Request: golang/go#41319 Reviewed-on: https://go-review.googlesource.com/c/go/+/253898 Run-TryBot: Giovanni Bajo <rasky@develer.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com> Trust: Giovanni Bajo <rasky@develer.com>
2020-06-08all: treat all files as binary, but check in .bat with CRLFDmitri Shuralyov
This is a followup to CL 96495. It should be simpler and more robust to achieve .bat files having CRLF line endings by treating it as a binary file, like all other files, and checking it in with the desired CRLF line endings. A test is used to check the entire Go tree, short of directories starting with "." and named "testdata", for any .bat files that have anything other than strict CRLF line endings. This will help catch any accidental modifications to existing .bat files or check ins of new .bat files. Importantly, this is compatible with how Gerrit serves .tar.gz files, making it so that CRLF line endings are preserved. The Go project is supported on many different environments, some of which may have limited git implementations available, or none at all. Relying on fewer git features and special rules makes it easier to have confidence in the exact content of all files. Additionally, Go development started in Subversion, moved to Perforce, then Mercurial, and now uses Git.¹ Reducing its reliance on git-specific features will help if there will be another transition in the project's future. There are only 5 .bat files in the entire Go source tree, so a new one being added is a rare event, and we prefer to do things in Go instead. We still have the option of improving the experience for developers by adding a pre-commit converter for .bat files to the git-codereview tool. ¹ https://groups.google.com/d/msg/golang-dev/sckirqOWepg/YmyT7dWJiocJ Fixes #39391. For #37791. Change-Id: I6e202216322872f0307ac96f1b8d3f57cb901e6b Reviewed-on: https://go-review.googlesource.com/c/go/+/236437 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-22build: add default GOROOT_BOOTSTRAP in WindowsGiovanni Bajo
CL 57753 added support to make.bash and make.rc to default GOROOT_BOOTSTRAP to 'go env GOROOT'. This patch does the same in make.bat for Windows. Updates #18545 Fixes #28641 Change-Id: I9152cc5080ed219b4de5bad0bd12d7725422ee1a Reviewed-on: https://go-review.googlesource.com/c/go/+/96455 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-03-22build: force all Windows batch files to CRLFGiovanni Bajo
Batch files should use CRLF endings. LF endings mostly work but in some situations they cause random errors like goto commands failing for mysterious reasons. See golang.org/issue/37791 for more information. Next CL triggered one of such bug (a label was not being recognized), so prepare for it by converting to CRLF. This CL also touches all existing batch files to force git to update the line endings (unfortunately, changing .gitattributes only has effect next time the file is checked out or modified). Fixes #37791 Updates #9281 Change-Id: I6f9a114351cb7ac9881914400aa210c930eb8cc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/96495 Run-TryBot: Giovanni Bajo <rasky@develer.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-04-23cmd/go: add env -w and env -u to set and unset default env varsRuss Cox
Setting environment variables for go command configuration is too difficult and system-specific. This CL adds go env -w, to change the default settings more easily, in a portable way. It also adds go env -u, to unset those changes. See https://golang.org/design/30411-env for details. Fixes #30411. Change-Id: I36e83f55b666459f8f7f482432a4a6ee015da71d Reviewed-on: https://go-review.googlesource.com/c/go/+/171137 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-11cmd,std: add go.mod filesBryan C. Mills
Updates #30241 Updates #30228 Change-Id: Ida0fe8263bf44e0498fed2048e22283ba5716835 Reviewed-on: https://go-review.googlesource.com/c/go/+/164622 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-11-16build: clear GO111MODULE during make.bash etcRuss Cox
The standard build assumes the variable is unset. Make it so, like we do for GOFLAGS, GOBIN, and so on. Change-Id: I4ad5695f8021b08bd1a35dd99112970a813d247c Reviewed-on: https://go-review.googlesource.com/c/149959 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-25src/make.bat: add missing go.exe extensionGoo
Got error: 'go' is not an internal or external command, nor is it a runnable program Change-Id: Ie45a3a12252fa01b67ca09ef8fbb5b4bbf728fe7 GitHub-Last-Rev: 451815cacd9bfc509fa0aab3be54303797e605a2 GitHub-Pull-Request: golang/go#27214 Reviewed-on: https://go-review.googlesource.com/131397 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-25cmd/dist: fix compilation on windowsFlorin Pățan
Add missing extensions to binary files in order to allow execution. Change-Id: Idfe4c72c80c26b7b938023bc7bbe1ef85e1aa7b0 Change-Id: Idfe4c72c80c26b7b938023bc7bbe1ef85e1aa7b0 GitHub-Last-Rev: ed9d8124270c30b7f25f89656432ef5089466c7e GitHub-Pull-Request: golang/go#26464 Reviewed-on: https://go-review.googlesource.com/124936 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-01cmd/go: add $GOFLAGS environment variableRuss Cox
People sometimes want to turn on a particular go command flag by default. In Go 1.11 we have at least two different cases where users may need this. 1. Linking can be noticeably slower on underpowered systems due to DWARF, and users may want to set -ldflags=-w by default. 2. For modules, some users or CI systems will want vendoring always, so they want -getmode=vendor (soon to be -mod=vendor) by default. This CL generalizes the problem to “set default flags for the go command.” $GOFLAGS can be a space-separated list of flag settings, but each space-separated entry in the list must be a standalone flag. That is, you must do 'GOFLAGS=-ldflags=-w' not 'GOFLAGS=-ldflags -w'. The latter would mean to pass -w to go commands that understand it (if any do; if not, it's an error to mention it). For #26074. For #26318. Fixes #26585. Change-Id: I428f79c1fbfb9e41e54d199c68746405aed2319c Reviewed-on: https://go-review.googlesource.com/126656 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2018-02-26build: small cleanup in error message in make.batGiovanni Bajo
Contrary to bash, double quotes cannot be used to group arguments in Windows shell, so they were being printed as literals by the echo command. Since a literal '>' is present in the string, it is sufficient to escape it correctly through '^'. Change-Id: Icc8c92b3dc8d813825adadbe3d921a38d44a1a94 Reviewed-on: https://go-review.googlesource.com/97056 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-10-31build: quiet make.bash, make.bat, make.rcRuss Cox
The signal-to-noise ratio is too low. Stop printing the name of every package. Can still get the old output with make.bash -v. Change-Id: Ib2c82e037166e6d2ddc31ae2a4d29af5becce574 Reviewed-on: https://go-review.googlesource.com/74351 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-10-25build: move final steps of make.bash, make.bat, make.rc into cmd/distRuss Cox
This CL expands the job of "dist bootstrap" to be "finish make.bash". I need to change that logic in upcoming CLs related to cmd/go changes, and I'd rather not change it in three places in three different shell script languages. Change-Id: I545dc215e408289e4d0b28f7c2ffcd849d89ad3b Reviewed-on: https://go-review.googlesource.com/72870 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-05-19build: unset GOBIN during buildBrad Fitzpatrick
Fixes #14340 Change-Id: I43e1624fafc972fb868708c3857fc8acf1bfbbd7 Reviewed-on: https://go-review.googlesource.com/23255 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2016-02-24cmd/go, go/build: add support for Fortrankortschak
This change adds support for Fortran files (.f, .F, .for, .f90) to the go tool, in a similar fashion to Objective-C/C++. Only gfortran is supported out of the box so far but leaves other Fortran compiler toolchains the ability to pass the correct link options via CGO_LDFLAGS. A simple test (misc/cgo/fortran) has been added and plugged into the general test infrastructure. This test is only enabled when the $FC environment variable is defined (or if 'gfortran' was found in $PATH.) Derived from CL 4114. Change-Id: Ifc855091942f95c6e9b17d91c17ceb4eee376408 Reviewed-on: https://go-review.googlesource.com/19670 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-17doc: replace references to {5..9}{g,l} with go tool compile and go tool linkJeremy Jackins
I updated some references to 6g, 6l and friends that I came across, as those programs don't exist anymore. I also fixed some echos in make.rc to match other make.* scripts while I was there. Change-Id: Ib84532cd4688cf65174dd9869e5d42af98a20a48 Reviewed-on: https://go-review.googlesource.com/11162 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-02build: update Windows make.bat to use CC_FOR_TARGET.Hyang-Ah (Hana) Kim
Change-Id: Ie4d8bedb9408372dff64e9a7fd857e1be4ee59e1 Reviewed-on: https://go-review.googlesource.com/6401 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-23[dev.cc] cmd/go: fix expansion of 'std', add 'cmd'Russ Cox
The wildcard 'std' is defined in documentation to be all the packages in the Go standard library. It has also historically matched commands in the main repo, but as we implement core commands in Go, that becomes problematic. We need a wildcard that means just the library, and since 'std' is already documented to have that definition, make it so. Add a new wildcard 'cmd' for the commands in the main repo ($GOROOT). Commands that want both can say 'std cmd' (or 'cmd std') to get the effect of the old 'std'. Update make.bash etc to say both std and cmd most of the time. Exception: in race.bash, do not install race-enabled versions of the actual commands. This avoids trying to write binaries while using them, but more importantly it avoids enabling the race detector and its associated memory overhead for the already memory-hungry compilers. Change-Id: I26bb06cb13b636dfbe71a015ee0babeb270a0275 Reviewed-on: https://go-review.googlesource.com/5550 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2015-01-21[dev.cc] build: do not 'clean -i std' between dist and go_bootstrapRuss Cox
Executing 'clean -i std' removes installed Go programs, including the toolchain binaries we need for building. It's not clear why the 'clean -i std' is here in the first place. cmd/dist just removed the entire pkg tree, so everything is new. The only reason for 'clean -i std' would be if you don't trust that dist compiled the packages properly. If that's true for some reason, we can fix cmd/dist, or add -a to the install commands that follow. Perhaps clean -i std should not remove tools, or perhaps std should not expand to any tools. Not sure. Also remove banner from make.bat and make.rc that was already removed from make.bash. cmd/dist prints it now. Also fix array size error in liblink/objfile.c. Fixes dev.cc build. Change-Id: I60855e001a682efce55ad9aa307a8f3ee47f7366 Reviewed-on: https://go-review.googlesource.com/3100 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-14[dev.cc] build: do not pass GOHOSTOS and GOHOSTARCH to Go 1.4 buildRuss Cox
Go 1.4 should build what it knows how to build. GOHOSTOS and GOHOSTARCH are for the Go 1.5 build only. Change-Id: Id0f367f03485100a896e61cfdace4ac44a22e16d Reviewed-on: https://go-review.googlesource.com/2818 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-14[dev.cc] build: fix cross-compilationRuss Cox
Fixes #9574. Change-Id: Ifd7ecccb25e934f9aba284b2d72b6b22f18cb0b6 Reviewed-on: https://go-review.googlesource.com/2812 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-12build: update Windows make.bat for Go-based distBrad Fitzpatrick
These are corresponding Windows changes for the GOROOT_BOOTSTRAP and dist changes in https://golang.org/cl/2470 Change-Id: I21da2d63a60d8ae278ade9bb71ae0c314a2cf9b5 Reviewed-on: https://go-review.googlesource.com/2674 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2014-12-13build: change all.bash output to be more markdown-friendlyRuss Cox
People keep pasting all.bash output into GitHub bugs, which turns the # lines into <h1> headlines. Add some more #s so that the bug reports are more readable. Not ideal but seems like the best of a few bad options. Change-Id: I4c69930ec304b2d504d7cd66221281a8577b87ae Reviewed-on: https://go-review.googlesource.com/1286 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-09-07build: fix windows make.batRuss Cox
The Unix make.bash builds cmd/dist from *.c. make.bat apparently does not. TBR=r CC=golang-codereviews https://golang.org/cl/137280043
2014-07-21make.bat: do not exit builder on successful completion of make.bat (fixes build)Alex Brainman
LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews https://golang.org/cl/118020043