aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api/run.go
AgeCommit message (Collapse)Author
2022-11-28cmd/api: rewrite as package testRuss Cox
No one ever runs 'go tool api', because the invocation has gotten unwieldy enough that it's not practical. And we don't support it as a standalone tool for other packages - it's not even in the distribution. Making it an ordinary package test lets us invoke it more easily from cmd/dist (as go test cmd/api -check) and avoids the increasingly baroque code in run.go to build a command line. Left in cmd/api even though it's no longer a command because (1) it uses a package from cmd/vendor and (2) it uses internal/testenv. Otherwise it could be misc/api. Fixes #56845. Change-Id: I00a13d9c19b1e259fa0e6bb93d1a4dca25f0e8c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/453258 Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Russ Cox <rsc@golang.org>
2022-11-10cmd/api: point to API docs in all.bash failureRuss Cox
When people add new API and get an all.bash failure, they often don't know about the API checker at all. Point to the README in the failure message, to try to help them find what they need to know. Change-Id: I6b148ec414d212033b371357a5e8c6ab79bb50a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/449015 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-05-02all: use os/exec instead of internal/execabsRuss Cox
We added internal/execabs back in January 2021 in order to fix a security problem caused by os/exec's handling of the current directory. Now that os/exec has that code, internal/execabs is superfluous and can be deleted. This commit rewrites all the imports back to os/exec and deletes internal/execabs. For #43724. Change-Id: Ib9736baf978be2afd42a1225e2ab3fd5d33d19df Reviewed-on: https://go-review.googlesource.com/c/go/+/381375 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-03-16cmd/api: remove debug printRuss Cox
Left over from CL 392414. Change-Id: I32ff1d660ba03d6c2005ad247e2129daf83aac04 Reviewed-on: https://go-review.googlesource.com/c/go/+/393361 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-03-14cmd/api: require proposal # for new API featuresRuss Cox
Having the proposal numbers recorded in the API files should help significantly when it comes time to audit the new API additions at the end of each release cycle. Change-Id: Id18e8cbdf892228a10ac17e4e21c7e17de5d4ff7 Reviewed-on: https://go-review.googlesource.com/c/go/+/392414 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-10-28all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox
When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-03cmd/api: disallow silent API additions after api/go1.n.txt is createdDmitri Shuralyov
At this time, the golang.org/s/release process arranges such that the api/go1.n.txt file is created when a Go 1.N Beta 1 release is being cut. The API check is currently configured so that tests don't fail visibly even if api/go1.n.txt becomes a subset of the actual API additions in the upcoming Go 1.N release as long as 'go version' has "devel" in it. The first time that 'go version' output drops the "devel" substring during testing is after the release-branch.go1.N branch is created as part of the process to cut a Go 1.N Release Candidate 1 release. The month or so between Beta 1 and RC 1 is well into the freeze and deliberate API changes are rare and very intentional. There seems to be agreement that it's healthy to make the API check stricter during that time period. Doing so will ensure that api/go1.n.txt cannot get stale after creation without anyone noticing, and may catch CLs that don't have the intended diff on the API. This CL changes behavior to be simple and clear: from the moment an api/go1.n.txt file corresponding to the current Go version in development is added to the tree, silent API additions stop being permitted. This CL also moves the magical "override the value of -allow_new flag if runtime.Version() contains 'devel' string" behavior from cmd/api command to the run.go script that calls it, making the CLI of cmd/api itself less surprising. Fixes #43956. Change-Id: I89468207573f7ccdbc9f12625dcdd3ef2bcf8f10 Reviewed-on: https://go-review.googlesource.com/c/go/+/315350 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-21all: introduce and use internal/execabsRoland Shoemaker
Introduces a wrapper around os/exec, internal/execabs, for use in all commands. This wrapper prevents exec.LookPath and exec.Command from running executables in the current directory. All imports of os/exec in non-test files in cmd/ are replaced with imports of internal/execabs. This issue was reported by RyotaK. Fixes CVE-2021-3115 Fixes #43783 Change-Id: I0423451a6e27ec1e1d6f3fe929ab1ef69145c08f Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955304 Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284783 Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Trust: Roland Shoemaker <roland@golang.org>
2017-12-11cmd/api: don’t rely on hardcoded go versionsAndrew Bonventre
Instead of requiring that cmd/api/run.go be edited upon each release to include the next Go version number, look in $GOROOT/api for files with the prefix go1* and use those instead to perform API checks. Change-Id: I5d9407f2bd368ff5e62f487cccdd245641ca9c9b Reviewed-on: https://go-review.googlesource.com/83355 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-07api: promote next to go1.10Andrew Bonventre
Change-Id: I2a4347540ecb94a9f124a228dc31452620ab0645 Reviewed-on: https://go-review.googlesource.com/82335 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-20all: correct location of go toolHiroshi Ioka
In general, there are no guarantee that `go` command exist on $PATH. This CL tries to get `go` command from $GOROOT/bin instead. There are three kinds of code we should handle: For normal code, the CL implements goCmd() or goCmdName(). For unit tests, the CL uses testenv.GoTool() or testenv.GoToolPath(). For integration tests, the CL sets PATH=$GOROOT/bin:$PATH in cmd/dist. Note that make.bash sets PATH=$GOROOT/bin:$PATH in the build process. So this change is only useful when we use toolchain manually. Updates #21875 Change-Id: I963b9f22ea732dd735363ececde4cf94a5db5ca2 Reviewed-on: https://go-review.googlesource.com/64650 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-14api: promote next to go1.9Chris Broadfoot
Change-Id: I27aa87607aa82b400411a60c6bdb6f9a42ff97c1 Reviewed-on: https://go-review.googlesource.com/45776 Run-TryBot: Chris Broadfoot <cbro@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-01api: promote next.txt to go1.8.txt, update go toolgo1.8beta1Chris Broadfoot
Change-Id: I37f2893ce14009efe095aac3bc811d650c66bf2a Reviewed-on: https://go-review.googlesource.com/33761 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-06-02api: promote next.txt to go1.7.txt and update api toolgo1.7beta1Andrew Gerrand
Change-Id: Idb348be00f949da553aa6aab62836f59dfee298d Reviewed-on: https://go-review.googlesource.com/23671 Reviewed-by: Chris Broadfoot <cbro@golang.org> Run-TryBot: Andrew Gerrand <adg@golang.org>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-12-17api: create go1.6.txtgo1.6beta1Brad Fitzpatrick
Change-Id: If2b30ab412d6799c8be01eb007462d6b58660ece Reviewed-on: https://go-review.googlesource.com/18014 Reviewed-by: Chris Broadfoot <cbro@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-21api: add go1.5.txt API file, reset next.txtBrad Fitzpatrick
Fixes #11752 Change-Id: If4196b4bbba4f1485608bfafa98fa54781177273 Reviewed-on: https://go-review.googlesource.com/12325 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-04-08cmd/api: update api checker to use go/types from std repoRobert Griesemer
The old code checked out a specific version of go/types from the x/tools repo. With go/types being part of the std repo, this is not necessary anymore. Also, for the same reason, the api tool is now built like any other regular command. There's no need to build it for each run. Removed the respective +build tags. Change-Id: I5088e4867223d676957084c24651ec05452ac495 Reviewed-on: https://go-review.googlesource.com/8564 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2014-12-23cmd/api: work around Windows rename issue on the buildersBrad Fitzpatrick
More cmd/api/run.go hell. Fixes #9407 Change-Id: If8fb446a2471d6372beb0534c9ab6824029b404c Reviewed-on: https://go-review.googlesource.com/2054 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Minux Ma <minux@golang.org>
2014-12-22cmd/api: fix race in run.go with multiple builders on a machineBrad Fitzpatrick
Fixes #9407 Change-Id: I765e8009c7ee22473ac8c2d81c7f6c8ec9866c51 Reviewed-on: https://go-review.googlesource.com/1980 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-12cmd/api: update the API checker to Go 1.4 and gitBrad Fitzpatrick
Still using the ancient go/types API. Updating that to the modern API should be a separate effort in a separate change. Change-Id: Ic1c5ae3c13711d34fe757507ecfc00ee883810bf Reviewed-on: https://go-review.googlesource.com/1404 Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-12[release-branch.go1.4] api: create go1.4.txtRuss Cox
I read through and vetted these but others should look too. LGTM=bradfitz, adg R=r, minux, bradfitz, adg CC=adg, golang-codereviews, gri, iant https://golang.org/cl/182560043
2014-11-10undo CL 169000043 / 05b838013df9Andrew Gerrand
This was a mistake. The cmd/api tool depends on an old version of go/types. ««« original CL description cmd/api: use golang.org/x/... import paths LGTM=bradfitz, rsc R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/169000043 »»» TBR=rsc, bradfitz R=bradfitz, rsc CC=golang-codereviews https://golang.org/cl/169320043
2014-11-10undo CL 166380043 / 0b54a0927656Andrew Gerrand
This was a mistake; the cmd/api tool depends on an old version of go/types. ««« original CL description cmd/api: bump go.tools golden CL hash TBR=bradfitz R=rsc CC=golang-codereviews https://golang.org/cl/166380043 »»» TBR=bradfitz, rsc R=bradfitz, rsc CC=golang-codereviews https://golang.org/cl/167430043
2014-11-10cmd/api: bump go.tools golden CL hashAndrew Gerrand
TBR=bradfitz R=rsc CC=golang-codereviews https://golang.org/cl/166380043
2014-11-10cmd/api: use golang.org/x/... import pathsAndrew Gerrand
LGTM=bradfitz, rsc R=rsc, bradfitz CC=golang-codereviews https://golang.org/cl/169000043
2014-09-04cmd/api: don't depend on os/user or USER to check apiBrad Fitzpatrick
The -nocgo builder failed because it has cgo disabled as well as no USER environment variable: http://build.golang.org/log/2250abb82f5022b72a12997b8ff89fcdeff094c9 # Checking API compatibility. Error getting current user: user: Current not implemented on linux/amd64 exit status 1 Don't require the environment variable here. LGTM=minux R=dave, adg, minux CC=golang-codereviews https://golang.org/cl/140290043
2014-06-02api: add go1.3.txtBrad Fitzpatrick
Update #8112 LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/104790045
2014-01-14cmd/api: ensure GOPATH always points to the correct go.toolsAlex Brainman
R=golang-codereviews, dave, bradfitz CC=golang-codereviews https://golang.org/cl/51000043
2013-10-18api: add go1.2.txt, use in testsAndrew Gerrand
R=golang-dev, iant CC=golang-dev https://golang.org/cl/14860043
2013-10-14cmd/api: make it work even when cgo is disabledShenghou Ma
make use of $USER or %USERNAME% to determine the current user. Fixes #6578. R=golang-dev, bradfitz, alex.brainman CC=golang-dev https://golang.org/cl/14649043
2013-09-22cmd/api: always do API check if hg is availableBrad Fitzpatrick
Fixes #6124 R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/13500046
2013-09-11cmd/api: make api check directory per-userRobert Daniel Kortschak
Fixes #6353. R=golang-dev, bradfitz, alex.brainman CC=golang-dev https://golang.org/cl/13652043
2013-08-24cmd/api: be more robust against OS deleting temp filesBrad Fitzpatrick
OS X in particular deletes tmp files (but not directories) pretty reliably. Ask hg whether the go.tools directory in tmp is good before using it. Fixes issue Rob and others were reporting, which I just hit myself now. R=golang-dev, r CC=golang-dev https://golang.org/cl/13084049
2013-08-24cmd/api: ignore GOARCH when building cmd/api.Brad Fitzpatrick
This was breaking people setting GOARCH=386 before running all.bash on amd64 machines. cmd/go puts different architecture binaries where "go tool" can't find them. R=golang-dev, r, khr CC=golang-dev https://golang.org/cl/13139044
2013-08-12cmd/api: don't fail API check if there's no networkBrad Fitzpatrick
If the hg checkout of go.tools fails, check for Internet connectivity before failing. R=golang-dev, shivakumar.gn CC=golang-dev https://golang.org/cl/12814043
2013-08-09cmd/api: eliminate duplicate package import workRuss Cox
On my Mac, cuts the API checks from 15 seconds to 6 seconds. Also clean up some tag confusion: go run list-of-files ignores tags. R=bradfitz, gri CC=golang-dev https://golang.org/cl/12699048
2013-08-08cmd/api: show output of api tool even if exit status is 0Brad Fitzpatrick
We weren't seeing additions. (stuff to put in next.txt) R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12678043
2013-08-08cmd/api: update run.go to fetch from go.tools when neededBrad Fitzpatrick
R=gri CC=golang-dev https://golang.org/cl/12639043
2013-08-07build: change how cmd/api is run in run.bash and run.batBrad Fitzpatrick
In prep for Robert's forthcoming cmd/api rewrite which depends on the go.tools subrepo, we'll need to be more careful about how and when we run cmd/api. Rather than implement this policy in both run.bash and run.bat, this change moves the policy and mechanism into cmd/api/run.go, which will then evolve. The plan is in a TODO in run.go. R=golang-dev, gri CC=golang-dev https://golang.org/cl/12482044