aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api/main_test.go
AgeCommit message (Collapse)Author
19 hoursall: prealloc slice with possible minimum capabilitiesShulhan
2026-03-02all: test: remove unneeded loop variablesAriel Otilibili
This CL follows from the abandoned CL 722961. Alan Donovan asked if modernize would catch these changes; it does in part. Here is how modernize was used: 1. Build the Go compiler from latest master 2. Clone x/tools and build modernize with the newest compiler 3. Then, do: PATH=PATH_TO_BIN:$PATH go list ./... | xargs env PATH=PATH_TO_BIN:$PATH GOMOD=off MODERNIZE -forvar -fix -test -debug fpstv 4. For assurance, move into a package directory (i.e, cmd), and redo Step 3. From the obtained result, it seems modernize did not remove the loop variable when: - the range notation was not used - the loop variable was not directly under the for directive. Which does happens here: # git ls-files | xargs -I {} perl -nE 'print "$ARGV:$.:$_" if /\s+(\w+) := \1$/' {} | grep _test [...] cmd/compile/internal/types2/api_test.go:2423: i := i md/go/internal/modload/query_test.go:182: tt := tt md/go/internal/web/url_test.go:17: tc := tc cmd/go/internal/web/url_test.go:49: tc := tc cmd/internal/par/queue_test.go:54: i := i runtime/syscall_windows_test.go:781: arglen := arglen Link: https://go-review.googlesource.com/c/go/+/722961/comments/e8d47866_fc399fa1 Co-authored-by: Plamerdi Makela <plamerdi447@gmail.com> Fixes #76411 Change-Id: I0c191cdca70dbea6efaf6796dca9c60e2afcd9ea GitHub-Last-Rev: 77c3e11fc21a4ede70b733b567a1690edb944dc1 GitHub-Pull-Request: golang/go#77694 Reviewed-on: https://go-review.googlesource.com/c/go/+/746502 Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2025-02-19go/*: use go/types.Func.Signature and go/ast.PreorderDaniel Martí
In the few obvious candidates that I found after a bit of grepping. Change-Id: I36af79c46d29e4422bce1f43bbbac9db7de2001a Reviewed-on: https://go-review.googlesource.com/c/go/+/650656 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-18cmd: change from sort functions to slices functionsIan Lance Taylor
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. We did this outside of bootstrap tools in CL 587655. Now that the bootstrap compiler is 1.22, we can do this in more code. Change-Id: I9ed2dd473758cacd14f76a0639368523ccdff72f Reviewed-on: https://go-review.googlesource.com/c/go/+/626038 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-09-04all: fix printf(var) mistakes detected by latest printf checkerAlan Donovan
These will cause build failures once we vendor x/tools. In once case I renamed a function err to errf to indicate that it is printf-like. Updates golang/go#68796 Change-Id: I04d57b34ee5362f530554b7e8b817f70a9088d12 Reviewed-on: https://go-review.googlesource.com/c/go/+/610739 Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Tim King <taking@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2024-04-09cmd/api: handle types.AliasAlan Donovan
This is covered by the existing tests under gotypesalias=1. Change-Id: Ia17f35fe580b745fa4bdaf4689dfe9c2ed6ebc5b Reviewed-on: https://go-review.googlesource.com/c/go/+/577735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
2024-01-26cmd/api: include type arguments in APIMatthew Dempsky
T[A] and T[B] are different types, but we were writing them both as just "T". Reported by Russ. Change-Id: I27db35946b6d3a1fad6c56c785fa6d850ad71d00 Reviewed-on: https://go-review.googlesource.com/c/go/+/558716 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-04cmd/api: fix panic on exported basic type aliasesDevon H. O'Dell
The order of emitting named type and type aliases in the `Walker`'s `emitType` function is inverted. When the type alias references a basic type, this causes a panic as the type assertion on `*types.Named` fails. This change reorders the logic such that type aliases are emitted prior to this type assertion. Fixes #64958 Change-Id: I52dbe13999978912ded788d9cf4948103869bcfa Reviewed-on: https://go-review.googlesource.com/c/go/+/554076 Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-11-14cmd/api: use api/next directory for beta versionsDmitri Shuralyov
Even though we don't issue beta pre-releases of Go at this time, it can still be useful to build them without publishing as part of testing the release infrastructure. For such versions, use the next directory content so that the API check doesn't produce a false positive during the earlier stages of the development cycle, before the next directory is merged into a combined and eventually frozen api file. For #29205. Change-Id: Ib5e962670de1df22f7df64dd237b555953096808 Reviewed-on: https://go-review.googlesource.com/c/go/+/542000 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-09-07cmd/api: don't try to parse JSON from stderr of go listIan Lance Taylor
Just send the go list stderr to our stderr. Change-Id: Iacda573bbe7accbcecb6a957e5d42b55afd10c58 Reviewed-on: https://go-review.googlesource.com/c/go/+/526775 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-08-16cmd/api: rename api.go to main_test.goRuss Cox
This makes cmd/api no longer an importable package. In CL 453258 I forgot that there was no direct prohibition on importing packages from cmd - we just rely on the fact that cmd/* is all package main and everything else is cmd/internal. Fixes #62069. Change-Id: Ifed738d333b40663f85eca8f83025fcea5df89a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/520038 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>