summaryrefslogtreecommitdiff
path: root/src/cmd/api/goapi_test.go
Commit message (Collapse)AuthorAgeFilesLines
* internal/testenv: add GOROOT and use it to fix tests broken with -trimpathBryan C. Mills2022-03-181-0/+2
| | | | | | | | | | | | | | | This fixes many (but not all) of the tests that currently fail (due to a bogus path reported by runtime.GOROOT) when run with 'go test -trimpath std cmd'. Updates #51461 Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986 Reviewed-on: https://go-review.googlesource.com/c/go/+/391806 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
* all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox2020-12-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/api: omit outside dependencies when listing the packages in "std"Bryan C. Mills2020-09-141-0/+13
| | | | | | | | | | | | | | | | | | As of CL 251159, when 'go list -deps std' is run within GOROOT/src, it treats the vendored external dependencies as real module dependencies, not standard-library "vendor/" packages (which still exist in that case, but are treated as distinct packages outside the "std" module). Fixes #41358 Updates #30241 Change-Id: Ic23eae9829d90e74a340d49ca9052e9191597410 Reviewed-on: https://go-review.googlesource.com/c/go/+/254738 Run-TryBot: Bryan C. Mills <bcmills@google.com> Trust: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
* cmd/dist: remove darwin/386, darwin/arm as valid portsBrad Fitzpatrick2020-04-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This only removes the ability to build it, and removes it as a src/buildall.bash target (which uses go tool dist list). Now: $ go tool dist list | grep ^darwin darwin/amd64 darwin/arm64 After this, remaining is removing leftover port--specific code in the tree. Updates #37610 Updates #37611 Change-Id: I00f03b2355c2e152f75e57abd3063be243529d2d Reviewed-on: https://go-review.googlesource.com/c/go/+/226985 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
* cmd/api: make NewWatcher populate its own package and import metadataBryan C. Mills2020-03-251-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially undoes the optimizations of CL 177597, but makes up some of the difference by caching the package list and import metadata and making the initial calls concurrently, including in TestMain. That reduces the critical path from two sequential 'go list' invocations to just one (run many times concurrently), and eliminates the need for assumptions about the consistency of the 'std' dependency graph across platforms (and hard-coded special cases for packages that violate those assumptions). In the process, this simplifies and fixes TestBenchmark (which has been silently broken since CL 164623). This increases 'time go tool dist test api' on my workstation from 0m8.4s / 0m13.8s / 0m1.7s to 0m10.5s / 0m23.1s / 0m5.1s, compared to 0m12.4s / 0m23.2s / 0m4.7s before CL 177597. (That is, this change retains about half of the wall-time speedup, but almost none of the user-time speedup.) Tested manually using 'go test -race -bench=. cmd/api'. Fixes #37951 Change-Id: Icd537e035e725e1ee7c41d97da5c6651233b927e Reviewed-on: https://go-review.googlesource.com/c/go/+/224619 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
* cmd/api: fix no go files package panicBaokun Lee2019-03-041-0/+13
| | | | | | | | | | Fixes #29837 Change-Id: I7d57c24d2133932c076df6f41dd6589f777b65dd Reviewed-on: https://go-review.googlesource.com/c/158877 Run-TryBot: Baokun Lee <nototon@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/api: explicit tagKey with GOOS and GOARCHMeng Zhuo2018-10-051-0/+15
| | | | | | | | | | | | | | The origin tagKey is just dirname if no tags input which will cause pkgCache missmatch if other imported pkg explicit on GOARCH or GOOS This CL will add GOOS and GOARCH to tagKey Fixes #8425 Fixes #21181 Change-Id: Ifc189cf6746d753ad7c7e5bb60621297fc0a4e35 Reviewed-on: https://go-review.googlesource.com/c/138315 Reviewed-by: Robert Griesemer <gri@golang.org>
* all: correct location of go toolHiroshi Ioka2017-09-201-1/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* cmd/api: fix benchmark to ignore internal packagesIan Lance Taylor2016-02-201-1/+1
| | | | | | | | Change-Id: I8ee46287ae0744efa83ad343997ad6835520fa5c Reviewed-on: https://go-review.googlesource.com/19688 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: link to https instead of httpBrad Fitzpatrick2015-07-111-1/+1
| | | | | | | | | | | | | The one in misc/makerelease/makerelease.go is particularly bad and probably warrants rotating our keys. I didn't update old weekly notes, and reverted some changes involving test code for now, since we're late in the Go 1.5 freeze. Otherwise, the rest are all auto-generated changes, and all manually reviewed. Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d Reviewed-on: https://go-review.googlesource.com/12048 Reviewed-by: Rob Pike <r@golang.org>
* go/importer: added go/importer package, adjusted go/typesRobert Griesemer2015-04-151-2/+4
| | | | | | | | | | | | | | | | | | - The go/importer package provides access to compiler-specific importers. - Adjusted go/internal/gcimporter and go/types as needed. - types.Check was removed - not much simpler than calling types.Config.Check. - Package "unsafe" is now handled by the type checker; importers are not called for it anymore. - In std lib tests, re-use importer for faster testing (no need to re-import previously imported packages). - Minor cleanups. The code still needs cleanups before submitting. Change-Id: Idd456da2e9641688fe056504367348926feb0755 Reviewed-on: https://go-review.googlesource.com/8767 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Griesemer <gri@golang.org>
* cmd/api: make the test more robustShenghou Ma2015-04-081-1/+1
| | | | | | | | | | | Previously, the TestCompareAPI test would fail if runtime.Version() is "dev", or, more importantly, "go1.5"; because compareAPI depends on runtime.Version and -allow_new flag. Move that logic out make its test more robust. Change-Id: I8f40daa1838b8acd26adac8848762d95315053b0 Reviewed-on: https://go-review.googlesource.com/8622 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/api: re-enable TestGolden on naclShenghou Ma2015-04-081-8/+0
| | | | | | | | | | Fixes #10369. Change-Id: If0a6d2b33c6862c9f7f862bdc997f2204072c6dc Reviewed-on: https://go-review.googlesource.com/8620 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/api: update api checker to use go/types from std repoRobert Griesemer2015-04-081-3/+10
| | | | | | | | | | | | | | | | 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>
* build: adjustments for move from src/pkg to srcRuss Cox2014-09-081-2/+2
| | | | | | | | | | | | | | | | | | | This CL adjusts code referring to src/pkg to refer to src. Immediately after submitting this CL, I will submit a change doing 'hg mv src/pkg/* src'. That change will be too large to review with Rietveld but will contain only the 'hg mv'. This CL will break the build. The followup 'hg mv' will fix it. For more about the move, see golang.org/s/go14nopkg. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/134570043
* cmd/api: ignore internal packagesBrad Fitzpatrick2014-07-211-0/+20
| | | | | | | | | | We might want to add a go/build.IsInternal(pkg string) bool later, but this works for now. LGTM=dave, rsc R=rsc, dave CC=golang-codereviews https://golang.org/cl/113300044
* cmd/api: add a benchmark over the standard libraryBrad Fitzpatrick2013-08-081-0/+27
| | | | | | R=golang-dev, gri CC=golang-dev https://golang.org/cl/12603045
* cmd/api: rewrite using go/typesRobert Griesemer2013-08-081-4/+4
| | | | | | | | | | | | - adjusted test files so that they actually type-check - adjusted go1.txt, go1.1.txt, next.txt - to run, provide build tag: api_tool Fixes #4538. R=bradfitz CC=golang-dev https://golang.org/cl/12300043
* cmd/api: don't print out except.txt removed features to stdoutBrad Fitzpatrick2013-05-141-1/+1
| | | | | | | | It's just noise. They've already been acknowledged in except.txt. R=golang-dev, r CC=golang-dev https://golang.org/cl/9392047
* cmd/api: handle contexts re-convergingBrad Fitzpatrick2012-10-301-3/+18
| | | | | | | | Fixes #4303 R=golang-dev, adg CC=golang-dev https://golang.org/cl/6816058
* cmd/api: add more testsBrad Fitzpatrick2012-10-301-0/+51
| | | | | | | | | | | | | Feature extraction was tested before, but not the final diffs. This CL breaks function main into a smaller main + testable compareAPI. No functional changes. R=golang-dev, adg CC=golang-dev https://golang.org/cl/6820057
* go/build: replace FindTree, ScanDir, Tree, DirInfo with Import, PackageRuss Cox2012-03-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an API change, but one I have been promising would happen when it was clear what the go command needed. This is basically a complete replacement of what used to be here. build.Tree is gone. build.DirInfo is expanded and now called build.Package. build.FindTree is now build.Import(package, srcDir, build.FindOnly). The returned *Package contains information that FindTree returned, but applicable only to a single package. build.ScanDir is now build.ImportDir. build.FindTree+build.ScanDir is now build.Import. The new Import API allows specifying the source directory, in order to resolve local imports (import "./foo") and also allows scanning of packages outside of $GOPATH. They will come back with less information in the Package, but they will still work. The old go/build API exposed both too much and too little. This API is much closer to what the go command needs, and it works well enough in the other places where it is used. Path is gone, so it can no longer be misused. (Fixes issue 2749.) This CL updates clients of go/build other than the go command. The go command changes are in a separate CL, to be submitted at the same time. R=golang-dev, r, alex.brainman, adg CC=golang-dev https://golang.org/cl/5713043
* build: move goapi, quietgcc, cgo, gotype, ebnflint into go-toolRuss Cox2012-01-311-0/+76
R=golang-dev, r CC=golang-dev https://golang.org/cl/5552054