Граф коммитов

1002 Коммитов

Автор SHA1 Сообщение Дата
Oleksandr Redko f124b50345 cmd/stringer: streamline test subprocesses
- Execute the test binary itself as cmd/stringer instead of invoking (and
cleaning up after) 'go build'.
- Replace os.MkdirTemp with T.TempDir

Changes are similar to https://go.dev/cl/377836.

Change-Id: I5f9fca20e0f1f045826c385d556257fc5982ed53
GitHub-Last-Rev: f6c6b7735c
GitHub-Pull-Request: golang/tools#425
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464350
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-02-06 18:58:38 +00:00
cui fliter bd5dfbb418 all: fix some comments
Change-Id: I44a562ec6d71dcf638333a855083f46201ef9a5e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464236
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-01-31 16:03:41 +00:00
Fumitoshi Ukai 5bedd861b1 cmd/digraph: use ReadString rather than bufio.Scanner
if an input line is too long (more than bufio.MaxScanTokenSize), bufio.Scanner returns bufio.ErrToolong.

Use bufio's ReadString instead.

Fixes golang.org/go#57807

Change-Id: If4165213668a468b844ee6a0ae84263475504208
GitHub-Last-Rev: e7057d029e
GitHub-Pull-Request: golang/tools#423
Reviewed-on: https://go-review.googlesource.com/c/tools/+/462053
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
2023-01-18 02:12:24 +00:00
Russ Cox 8e94967361 cmd/fiximports: do not assume go list -json unmarshals into build.Package
Work planned for golang/go#56986 adds fields to go list -json
and build.Package of different types, but this program
assumes that you can unmarshal go list -json output
into a build.Package. We've never promised that,
and I'm unaware of any other programs that do it,
so fix this program. (If many programs made this
assumption, we'd want to consider whether they need
to stay compatible, but if it's just this old program,
it's not worth fixing.)

Change-Id: I8b402bb3e3db7ecff961e1f033f6c5cf967b8578
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461658
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
2023-01-17 01:51:57 +00:00
Bryan C. Mills a3c22fca0a cmd/cover: delete package
CL 461656 places the package in its own module.
Once that commit is tagged as 'cmd/cover/v…',
'go install golang.org/x/tools/cmd/cover@latest' will be able to
resolve the command from that module (to cover the unlikely event that
anyone still builds and uses the tool).

Fixes golang/go#56783.

Change-Id: I4baa5fcc4b5273fad4cc7bf150e411f2776b12d2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/451596
TryBot-Bypass: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-01-12 14:58:48 +00:00
Bryan C. Mills 98dcb0ee06 cmd/cover: remove replace directive
This makes it so that 'go install golang.org/x/tools/cmd/cover@latest'
will continue to work. ('go install pkg@version' does not allow
replace directives.)

For golang/go#56783.

Change-Id: I9f899eee36ab4118367b0a3118f701b7b9a5cceb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461656
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-01-11 22:53:55 +00:00
Bryan C. Mills a7f7db3f17 cmd/cover: carve out deprecated command into its own module
Since cmd/cover imports x/tools/cover (which is not itself
deprecated), its go.mod file needs to require a version of x/tools
that includes cover but not cmd/cover.
Arbitrarily choose x/tools v0.6.0 as the likely next x/tools release
tag and slot it in using a 'replace' directive.

In a followup commit, I will remove the replace directive and update
the x/tools dependency to the pseudo-version of the exact commit of
this CL.

For golang/go#56783.

Change-Id: Ia70206cb8c4e6128b90a048aad4e2607db19740b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461655
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-11 22:09:35 +00:00
Bryan Mills f9a10c01c9 Revert "cmd/cover: carve out deprecated command into its own module"
This reverts CL 451595.

Reason for revert: ended up at a different x/sys commit due to merge conflict.

Change-Id: I064170e21dfbaa9bbaf6cf6701994824ba55f2ed
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461616
Reviewed-by: Than McIntosh <thanm@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-11 21:30:54 +00:00
Bryan C. Mills 43158af4a2 cmd/cover: carve out deprecated command into its own module
Since cmd/cover imports x/tools/cover (which is not itself
deprecated), its go.mod file needs to require a version of x/tools
that includes cover but not cmd/cover.
Arbitrarily choose x/tools v0.4.0 as the likely next x/tools release
tag and slot it in using a 'replace' directive.

For golang/go#56783.

Change-Id: I26a5829d0421724ab14437955a8cec4acbfd62b0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/451595
Run-TryBot: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-01-11 19:38:33 +00:00
Bryan C. Mills b978661c6c cmd/godoc: streamline test subprocesses
- Use testenv.Command to obtain Cmd instances that terminate (with
  useful goroutine dumps!) before the test's timeout, and remove
  arbitrary hard-coded timeouts.

- Execute the test binary itself as cmd/godoc instead of invoking (and
  cleaning up after) 'go build'.

- Use context cancellation to reduce the number of ad-hoc goroutines
  and channels needed by the tests and to provide stronger invariants
  on process cleanup.

For golang/go#50014

Change-Id: I19ae4d10da691db233c79734799ae074ffdf6a03
Reviewed-on: https://go-review.googlesource.com/c/tools/+/377836
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-11-21 16:55:09 +00:00
Sasha Melentyev 8f3241104a cmd/stringer: replace ioutil with os
Change-Id: I16c8556a90a775e5e3addb2f5907cba04d9c4bb1
GitHub-Last-Rev: 12dc5e7872
GitHub-Pull-Request: golang/tools#408
Reviewed-on: https://go-review.googlesource.com/c/tools/+/439516
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-11-11 15:19:20 +00:00
Cherry Mui d56532ab0e cmd/compilebench: make it work without installed .a's
Currently compilebench relies on installed .a files for std and
cmd, as it runs the compiler and linker directly. For the upcoming
Go 1.20, compiled .a files will not be installed. Don't rely on
them. Instead, build importcfg file and pass it to the compiler
and the linker.

Verified that this approach still works with previous versions of
Go (1.19 and 1.18).

For golang/go#47257.

Change-Id: Ie0eb9541fb995649e5b68d4481a5acfbdfe8f2a7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/448118
Reviewed-by: Michael Pratt <mpratt@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-10 18:37:12 +00:00
eNV25 541f4c5166 cmd/bundle: quote command-line arguments in output
The previous version of bundle simply joins together with a space " ".
While this works for simple arguments this causes problems when you
need to pass special strings like an empty string or a string
containing a space.

The following example shows how the previous version handles an empty
string argument `-prefix ""`.

    //go:generate bundle -o /dev/stdout -prefix  example.com/mod

This change quotes the arguments with strconv.Quote, if needed, before
joining together with a space:

    //go:generate bundle -o /dev/stdout -prefix "" example.com/mod

Change-Id: Ic706a3bd7916515ba91dbe5e0def956703ab2988
GitHub-Last-Rev: 8dc0c88fc1
GitHub-Pull-Request: golang/tools#411
Reviewed-on: https://go-review.googlesource.com/c/tools/+/444956
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-10-26 18:58:11 +00:00
Keith Randall a9b653b411 cmd/compilebench: use -a instead of -i to ensure dependencies are built
-i has been deprecated since 1.15, and is now gone in the soon-to-be-1.20.

Change-Id: Ib570f2bcfd0b1feb937990b72e4c9e43e1ada8cd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/443456
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-10-18 15:43:22 +00:00
Tim King ab79327e05 cmd/ssadump: disable run mode with runtime package
Changes `ssadump -run` to ensure that the package runtime
is not imported (changed from must be imported). For several
years, the runtime package has used unsafe constructs
x/tools/go/ssa/interp cannot interpret. This must have been
failing a similar amount of time.

This is unfortunate, but is unlikely to be addressed soon.

For golang/go#43163

Change-Id: I9e2aee640ff7b1123e591e6c49cac9967c5e8da8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/441817
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-11 20:40:41 +00:00
cui fliter f90d8ad46c all: fix a few function names on comments
Change-Id: I91eec68ebd9394685a6586c8d0cf01ecf3fd82e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/441775
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-10-10 13:22:38 +00:00
cui fliter 3dda4ba24c all: replace deprecated egrep with grep -E
egrep command is about to be deprecated, use grep -E instead.

Reference: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap04.html

Change-Id: Ib37f5b244ead4c2d46078bea34d4cb6363c48b1b
GitHub-Last-Rev: b1e16d0212
GitHub-Pull-Request: golang/tools#400
Reviewed-on: https://go-review.googlesource.com/c/tools/+/432295
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-23 13:31:09 +00:00
cui fliter 5f27e05096 all: remove redundant type conversion
Change-Id: Iffb04ebd6b4afbe1a13b96b7e7469ec3b3e3380f
GitHub-Last-Rev: 6682724eb7
GitHub-Pull-Request: golang/tools#396
Reviewed-on: https://go-review.googlesource.com/c/tools/+/428980
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-07 17:33:19 +00:00
Abirdcfly 4375b29f44 cmd/auth/cookieauth: delete unreachable os.Exit
Change-Id: I5c60eeb8667423544b2bc8b9cf5f51279b0a941d
GitHub-Last-Rev: cb0eca5ff3
GitHub-Pull-Request: golang/tools#388
Reviewed-on: https://go-review.googlesource.com/c/tools/+/418854
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-07-25 18:11:01 +00:00
Ben Sarah Golightly 10494c735e cmd/digraph: fix typo
Change-Id: I086edda41c57b603afa660afb9396e17ba6c1a36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414074
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-25 13:13:44 +00:00
Tormod Erevik Lea a44cc76dc1 cmd/stringer: use explicit NeedX values instead of deprecated LoadSyntax
Change-Id: Ie25f67fd98d34b0a907bd13357e2643b1b79443b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412914
Reviewed-by: Alex Rakoczy <alex@golang.org>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-22 16:23:22 +00:00
Alan Donovan af82757ce0 cmd/callgraph: add test of -algo=vta
This should have been included in
https://go-review.googlesource.com/c/tools/+/410138

Change-Id: Ic8a4f1b5dbcdb320fb872b24484b830dcb56fd41
Reviewed-on: https://go-review.googlesource.com/c/tools/+/410123
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2022-06-02 22:22:06 +00:00
Alan Donovan b2fbc387b5 cmd/callgraph: add -algo=vta option
This option uses Variable Type Analysis, a refinement of CHA
suitable for partial programs.

Change-Id: I6c8b074e915d29eb9425656f345e8160417ba594
Reviewed-on: https://go-review.googlesource.com/c/tools/+/410138
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
2022-06-02 20:18:38 +00:00
Than McIntosh 1a5eed31fb cmd/compilebench: use -p, handle packages with asm files
Update compiler invocations to pass "-p <importpath>", since that
is the normal way to invoke the compiler these days.  In addition,
add some logic to generate a 'symabis' file for packages that
include assembly source files.

Change-Id: I64c490c55603609cf2cdbfae20ed787a581be4d3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/405734
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-05-11 17:47:50 +00:00
Bryan C. Mills d27d783e99 cmd/godoc: expand skips in TestWeb
After CL 403534, another TestWeb failure was observed in
https://build.golang.org/log/24cca44e99d848317a6bb73b6d15528b500e5643.
This change expands the skips to try to cover more of the cases
where cmd/godoc might hang.

For golang/go#50014.

Change-Id: If3f08da69a68dc00c399b89ffb2c4f049114aeb6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/403849
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-04 21:37:12 +00:00
Bryan C. Mills 04fc2ba822 cmd/godoc: skip TestWeb if waitForServerReady fails
This test fails frequently, with a failure mode that is difficult to
diagnose. (golang/go#50436 may help with that eventually.)

For now, skip the test to reduce noise on the build dashboard.

For golang/go#50014.

Change-Id: I182be5c705846631c983bd5b6c51ab90b71a216a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/403534
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-02 20:36:24 +00:00
Tim King ddadc42f5a guru: Add a TODO list to the guru cmd.
Adds a TODO list for the guru cmd. The main goal is document know
issues that we have not addressed.

Updates golang/go#47326
Updates golang/go#52503

Change-Id: I126b0f06081b606124d89a13f8805fa1ac6e56e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/403354
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
2022-05-02 17:10:57 +00:00
Russ Cox c862641ee9 cmd/digraph: only print non-trivial sccs
In 'digraph sccs', do not print trivial single-node components.
This is more useful because it distinguishes nodes with self-loops (printed)
from nodes without (not printed).

Also remove an unnecessary TODO about map[string]bool vs map[string]struct{}.
The savings is at most 5% and if we really cared about storage we would probably
not use a map at all.

Change-Id: I6049b3c0f99a913c65f08c6c40e77ae99d1ba8c4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/396834
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-04-29 02:53:01 +00:00
Tim King d567bc1c22 go/ssa: monomorphize generic instantiations.
Monomorphize the instantiation of generic functions. Applies type
substitution while building the function instantiation.

Adds a new BuilderMode, ssa.InstantiateGenerics, to enable
monomorphization. InstantiateGenerics is turned on by the flag 'G' in
tools that specify the BuilderMode.

Adds a parameterized field to Program to detect when a MethodValue is
parameterized.

Thunk creation creates new MethodExpr selections. Adds a new methodExpr
type to construct a MethodExpr from outside of types, and selection
interface to generalize a *methodExpr and *types.Selection.

Tests x/tools/go/ssa/interp against the runnable examples in
$GOROOT/test/typeparam/*.go. Some additional models to support files.

Misc. cleanup:
- adding (*canonizer).instantiateMethod to create a canonical
  representative of a method.
- documenting builder.go
- adding (*subster).types that applies type substitution to a list.

Updates golang/go#48525

Change-Id: I885a4223900feaa3664e35caf8618d11ba16a2a7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/356315
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-22 17:17:20 +00:00
Robert Findley 235b13d9b8 cmd/godoc: remove usage of golang.org/x/xerrors
Go 1.12 has not been supported for a while, so it seems safe to replace
usage of xerrors with the native support for wrapped errors in the
standard library introduced in Go 1.13. Remove this usage as a step
toward eliminating the xerrors dependency from x/tools.

If there is any reason to continue to use xerrors, please let me know.

For golang/go#52442

Change-Id: Ic1e5c14f4074b4685a926e884649b9032aaa0f53
Reviewed-on: https://go-review.googlesource.com/c/tools/+/401098
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-20 16:11:05 +00:00
Russ Cox 5fef6fdaed cmd: gofmt
Gofmt to update doc comments to the new formatting.

(There are so many files in x/tools I am breaking up the
gofmt'ing into multiple CLs.)

For golang/go#51082.

Change-Id: I0cc2e6cac2e4ed975770aea78cc2f39c13d6f874
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399357
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-12 17:38:38 +00:00
Bryan C. Mills 48e6d8d2ff cmd/fiximports: skip TestFixImports on plan9-arm
For golang/go#50775.

Change-Id: Ia7d99e9e7b007af3fa35332f0385949867e975eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/398817
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
2022-04-07 18:45:34 +00:00
Dan Kortschak 4077921f14 all: fix spelling
Change-Id: I13cf73d7e043dda1a06c28bb09e413a76a68df1f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/391934
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-04-04 19:50:34 +00:00
Bryan C. Mills 7d125fe075 cmd/callgraph: expand windows/arm64 skip to the whole platform
This test produces apparent file corruption on all of the
windows/arm64 builders. I suspect that this is a low-level bug (in
either the platform itself or the Go standard library on
windows/arm64).

Since windows/arm64 is not yet a first-class port, this test can be
skipped for now. However, if windows/arm64 becomes a first-class port
the underlying file-corruption bug should be investigated and fixed.

Updates golang/go#50706.

Change-Id: I0bc80cefee50895d40acc658286eb7ef8790493a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/397996
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-04 15:58:39 +00:00
cuishuang 78ff15e680 tools: fix some typos
Change-Id: Iaad847631b9d5ee40558fcf9d51f4dfa99600e6b
GitHub-Last-Rev: 6fcb64f8d9
GitHub-Pull-Request: golang/tools#372
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389595
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-03-24 22:24:35 +00:00
Bryan C. Mills e155b03a0e cmd/getgo: exec main from TestMain instead of running 'go build' in tests
This was noticed from
https://build.golang.org/log/da703ece9e1626eaeabf485e1a3a8180a6bde512,
but I suspect not relevant to the getgo test failure observed there.

Updates golang/go#28387

Change-Id: I1a156e780beabb13b4df6fd5313d4785aeb26e97
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390075
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-04 20:37:47 +00:00
Bryan C. Mills 0eabed704f cmd/file2fuzz: exec main from TestMain instead of running 'go build' in tests
This may address a test hang observed in
https://build.golang.org/log/da703ece9e1626eaeabf485e1a3a8180a6bde512.

At the very least, it should make the test much more efficient.

Change-Id: I6a41f9704c8a95276c904f0aee57c4521d642ea7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390074
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-03-04 18:26:08 +00:00
Than McIntosh fb3622a928 signature-generator: add Go func signature fuzzing tools
Add a new subdirectory 'signature-fuzzer' to the x/tools/cmd
directory, with contents:

  internal/fuzz-generator      Guts of the signature fuzzer
  fuzz-driver                  Simple driver for the fuzzer
  fuzz-runner                  Test harness for doing iterative fuzzing

This set of tools is primarily of interest to compiler developers as
opposed to end users. The fuzzer generates random Go code with
"interesting" randomly chosen function signatures (random numbers of
parameters of randomly generated types), then emits code to call these
random functions with known inputs, as well as code that checks to
make sure parameter values were passed correctly and that returns
worked.  The generator tries to include odd scenarios and corner cases
(e.g. reflect calls, recursion, blank params, zero sized types, etc)
so as to explore all the nooks and crannies of the compiler.

This fuzzer was used during the bringup of the new register ABI (as
part of Go 1.17) to identify odd corner cases and flush out bugs. It
may be useful in the future if we have to support new ABI versions or
bring up register ABIs on new architectures.

See the README.md for more details.

Change-Id: Icbc89ddd07c3909a44a005deab43720c7a0dffde
Reviewed-on: https://go-review.googlesource.com/c/tools/+/350329
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-01 16:32:20 +00:00
Michael Matloob 3e31058cd7 internal/imports: update to permit multiple main modules
Now that there there can be multiple main modules due to workspaces in
cmd/go, update internal/imports to no longer assume that there will be
exactly one main module.

Change-Id: I9d044df612fbeaba73b8fc3dbbec0395b54ecba2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386254
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-22 17:36:43 +00:00
Frediano Ziglio 59f1f2c5a8 cmd/goyacc: reduce array sizes using smaller base types
These arrays can be quite large, reducing the size of them
save lot of space reducing cache usage and file size.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Change-Id: I446088627bc135cb47f6bee919e147b24d1ad848
Reviewed-on: https://go-review.googlesource.com/c/tools/+/374434
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-16 20:47:08 +00:00
Bryan C. Mills 97de9ec466 cmd/fiximports: skip TestDryRun on plan9-arm
For golang/go#50775.

Change-Id: I229263c840f406926b1f7c91de2400d4a18f3e16
Reviewed-on: https://go-review.googlesource.com/c/tools/+/380495
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-01-24 16:42:25 +00:00
Bryan C. Mills 2cc1836031 cmd/callgraph: skip TestCallgraph on the windows-arm64-10 builder
We don't know whether this failure is due to a Go bug or a platform
bug, so we'll skip it on the one builder to reduce noise, but not the
GOOS/GOARCH as a whole. If we do not observe failures on other
windows/arm64 builders, we can perhaps chalk it up to a platform bug.
If we do observe failures on other builders, then we'll have more data
to investigate with.

For golang/go#50706

Change-Id: I52511dd4a5cff80953823d9cf901975ff4657457
Reviewed-on: https://go-review.googlesource.com/c/tools/+/379734
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
2022-01-24 16:42:11 +00:00
Robert Findley 27fc7644e1 all: various test fixes related to any
Fix several tests that were failing at CL 368254 due to inconsistent
formatting of standard library types across Go versions. Generally this
is addressed by replacing interface{} with any, though the mechanism
varies.

Where possible, prefer to update the test data to accurately reflect
1.18 formatting.

Change-Id: Ia92cd565d2ba1dd464891093b78c636fcaff44bc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/370655
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-09 15:47:16 +00:00
Bryan C. Mills 3fca6a08d7 cmd/gorename: log 'go build' output on failure
For golang/go#50043

Change-Id: I90d1e85c59d6f9c9ad30edf0180cb876c2564534
Reviewed-on: https://go-review.googlesource.com/c/tools/+/370254
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-08 16:15:56 +00:00
Dmitri Shuralyov cb80a01bd3 cmd/godoc: remove extra // characters from deprecation notice
The comment is already inside a /* */ block, so no need for //.

Updates golang/go#49212.

Change-Id: I6d50cedab363ed312d85e66797cbc4f652e56dab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367014
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-24 23:04:05 +00:00
Zvonimir Pavlinovic 49ce184b43 cmd/guru: remove use of deprecated ssa.CreateTestMainPackage
For golang/go#48547

Change-Id: I71f061e55d52c45346d34d05ade9c82e9856d6e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363655
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-12 22:28:40 +00:00
Zvonimir Pavlinovic 2cdcc60405 cmd: avoid printing redundant newlines
For golang/go#49350

Change-Id: Ic566112ff8a8707998b461d2b99fca852f2972f8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361716
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 18:39:25 +00:00
Jonathan Amsterdam 513e3fb6ba cmd/godoc: deprecate and point to cmd/pkgsite
Fixes golang/go#49212.

Change-Id: I335749bfecc60f582968af601d9fa030f038e2be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/349051
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-01 13:50:47 +00:00
Zvonimir Pavlinovic d6a9af8af0 godoc/analysis: remove deprecated analysis package
Change-Id: I862cae902ea2ff7ed36722d536039cc617200de6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/358954
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-10-29 00:04:41 +00:00
Robert Griesemer 9cd58b0b94 x/tools/cmd/stringer: adjust generics tests
Per the issue below, a lone type parameter is not permitted
on the the RHS of a type declaration, at least for Go 1.18.

Slightly modified the generics tests so that they pass for
now.

For golang/go#45639.

Change-Id: I3c5dc0ff65bfdc268c372e5e3fdfe00a8547f17e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/359274
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
2021-10-28 00:09:41 +00:00