1
0
mirror of https://github.com/golang/go synced 2024-11-14 20:40:32 -07:00
Commit Graph

55268 Commits

Author SHA1 Message Date
cuiweixie
1371efcd69 net/http: remove deadstore statement
Change-Id: Icfa3fd519df48f8d7d7aa3795535fd7e6aaa159f
Reviewed-on: https://go-review.googlesource.com/c/go/+/435936
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 20:43:52 +00:00
cuiweixie
4973c16f3c net: delete unused code
Change-Id: Id4c3a140d9619796aee1ba3214f7d5fce040b4e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/435935
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 20:43:19 +00:00
cuiweixie
879f595f7e net/http: use time.Compare
Change-Id: I4730673130bdfbda9987dcb5869f421082f92150
Reviewed-on: https://go-review.googlesource.com/c/go/+/435615
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 20:42:38 +00:00
Paul E. Murphy
27d4cdd1a6 debug/elf: fix typo in R_PPC64_TPREL34 and R_PPC64_DTPREL34
The suffix should be 34 not 28. I misread the name because the
reloc listed before these two in the ABI is named "R_PC64_PCREL28".

Updates #54345

Change-Id: Ie8238f55e441c787d70ead58e0a177c650f8b89e
Reviewed-on: https://go-review.googlesource.com/c/go/+/435415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-29 19:54:44 +00:00
Robert Griesemer
545adcfe89 go/types, types2: use "generic" rather than "parameterized" in error messages
Fix a couple of places where we still use "parameterized".

Change-Id: I2c70356d4e363ee709c5ef19ec8786956d5e9001
Reviewed-on: https://go-review.googlesource.com/c/go/+/436815
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-29 19:35:55 +00:00
Bryan C. Mills
dd42a84fb3 cmd: add skips as needed to get tests to pass on js/wasm
For #54219.

Change-Id: I9767f46a5b44beeee62a3d53c4de4f6acb6b6e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/436816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-29 19:23:50 +00:00
Bryan C. Mills
ce3a5c0d10 os/exec: avoid leaking a process in TestDoubleStartLeavesPipesOpen
Updates #52580.
For #50436.

Change-Id: I0929055ffca1ca429f6ebec7d877f4268bd1fda2
Reviewed-on: https://go-review.googlesource.com/c/go/+/436656
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-29 18:49:15 +00:00
Damien Neil
4a0a2b33df errors, fmt: add support for wrapping multiple errors
An error which implements an "Unwrap() []error" method wraps all the
non-nil errors in the returned []error.

We replace the concept of the "error chain" inspected by errors.Is
and errors.As with the "error tree". Is and As perform a pre-order,
depth-first traversal of an error's tree. As returns the first
matching result, if any.

The new errors.Join function returns an error wrapping a list of errors.

The fmt.Errorf function now supports multiple instances of the %w verb.

For #53435.

Change-Id: Ib7402e70b68e28af8f201d2b66bd8e87ccfb5283
Reviewed-on: https://go-review.googlesource.com/c/go/+/432898
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2022-09-29 18:40:40 +00:00
Tobias Klauser
36f046d934 cmd/go/internal/lockedfile/internal/filelock: remove unused type token
Change-Id: If815d17851e4e4eac026417b820f15d11939d9cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/436595
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 18:20:11 +00:00
Russ Cox
2ff5fbfbd4 cmd/compile: limit goroutine count to parallelism
When the compiler crashes, it is not uncommon to see many hundreds
of goroutines all blocked waiting their turn to be one of the nWorkers
goroutines that is allowed to run. All these goroutine stacks are not a
terribly efficient use of memory, and they also make the crash dumps
hard to read.

Introduce a manager goroutine to hand out work to at most nWorker
goroutines, maintaining pending work in a local slice, rather than
having all those blocked goroutines hanging around waiting to run.

Change-Id: I46cb4e1afd6392805f359e14554ebc17d538bcba
Reviewed-on: https://go-review.googlesource.com/c/go/+/431956
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 16:23:56 +00:00
Than McIntosh
9861e8b2fd cmd/{cover,go}: avoid use of os.PathListSeparator in cmd/cover flag
Rework the mechanism for passing a list of output files from cmd/go to
cmd/cover when running new-style package-scope coverage
instrumentation (-pkgcfg mode). The old scheme passed a single string
with all output files joined together with os.PathListSeparator, but
this scheme is not viable on plan9, where strings containing the
separator character are not permitted when running exec.Command().
Instead, switch cmd/cover to use an arguments file (a file containing
a list of names) to specify names of instrumented output files. This
fixes the cmd/cover test failures on the plan9 builders.

Updates #51430.

Change-Id: I919f5e0a79500e28648fb9177225a9b938e4fdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/436675
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-29 14:51:21 +00:00
Robert Griesemer
e22af33b48 go/types, types2: more concise error messages for cycle errors
If a cycle has length 1, don't enumerate the single cycle entry;
instead just mention "refers to itself". For instance, for an
invalid recursive type T we now report:

	invalid recursive type: T refers to itself

instead of:

	invalid recursive type T
		T refers to
		T

Adjust tests to check for the different error messages.

Change-Id: I5bd46f62fac0cf167f0d0c9a55f952981d294ff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/436295
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-29 14:21:33 +00:00
Than McIntosh
ecd112c0d1 runtime/coverage: apis to emit counter data under user control
Add hooks/apis to support writing of coverage counter data and
meta-data under user control (from within an executing "-cover"
binary), so as to provide a way to obtain coverage data from programs
that do not terminate. This patch also adds a hook for clearing the
coverage counter data for a running program, something that can be
helpful when the intent is to capture coverage info from a specific
window of program execution.

Updates #51430.

Change-Id: I34ee6cee52e5597fa3698b8b04f1b34a2a2a418f
Reviewed-on: https://go-review.googlesource.com/c/go/+/401236
Reviewed-by: David Chase <drchase@google.com>
2022-09-29 14:14:24 +00:00
Than McIntosh
f2ee341468 cmd{cover,covdata,go}: better coverage for tests that build tools
Some of the unit tests in Go's "cmd" tree wind up building a separate
copy of the tool being tested, then exercise the freshly built tool as
a way of doing regression tests. The intent is to make sure that "go
test" is testing the current state of the source code, as opposed to
whatever happened to be current when "go install <tool>" was last run.

Doing things this way is unfriendly for coverage testing. If I run "go
test -cover cmd/mumble", and the cmd/mumble test harness builds a
fresh copy of mumble.exe, any runs of that new executable won't
generate coverage data.

This patch updates the test harnesses to use the unit test executable
as a stand-in for the tool itself, so that if "go test -cover" is in
effect, we get the effect of building the tool executable for coverage
as well. Doing this brings up the overall test coverage number for
cmd/cover quite dramatically:

before change:

  $ go test -cover .
  ok  	cmd/cover	1.100s	coverage: 1.5% of statements

after change:

  $ go test -cover .
  ok  	cmd/cover	1.299s	coverage: 84.2% of statements

Getting this to work requires a small change in the Go command as
well, to set GOCOVERDIR prior to executing a test binary.

Updates #51430.

Change-Id: Ifcf0ea85773b80fcda794aae3702403ec8e0b733
Reviewed-on: https://go-review.googlesource.com/c/go/+/404299
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 14:13:50 +00:00
Than McIntosh
9d6dc32edd runtime/coverage: improve unit tests
Add a testpoint to cover support routines used to help
implement "go test -cover".

Change-Id: Ic28bf884a4e0d2c0a6d8fd04fc29c0c949227f21
Reviewed-on: https://go-review.googlesource.com/c/go/+/432315
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 14:13:26 +00:00
cuiweixie
690851ee3e crypto: use fmt.Appendf
Change-Id: I022a221e2d73cd8c70e8e04b7046c388748646a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/435696
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 09:14:45 +00:00
cuiweixie
8d3631fcef cmd/nm: use print-style not printf-style
Change-Id: Ic977026a99a825954117902051e59928de9ccbdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/435947
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 09:05:07 +00:00
cuiweixie
a57639a2b2 cmd/cgo: use strings.TrimSuffix
Change-Id: I97b5592c678c350fd77069d7c40a98864733707a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435946
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 09:05:05 +00:00
cuiweixie
ea2a2c0c22 cmd/cgo: delete unused code
Change-Id: I6007cc6363e22ffa5f9a8f0441a642fd85127397
Reviewed-on: https://go-review.googlesource.com/c/go/+/435945
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-09-29 09:05:04 +00:00
cuiweixie
50cc2238fb cmd/cgo: use strings.Contains instead of strings.Index
Change-Id: Iaa623dae50ccae36ad44af25899c6453b6108046
Reviewed-on: https://go-review.googlesource.com/c/go/+/435944
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-09-29 09:05:02 +00:00
cuiweixie
09daf313b2 cmd/asm: use strings.TrimSuffix
Change-Id: If08ce3f8534f5fb7ce97ec124bfeff937e65f63b
Reviewed-on: https://go-review.googlesource.com/c/go/+/435943
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 09:05:01 +00:00
cuiweixie
090ec611df cmd/asm: delete unused func newAddr
Change-Id: I62f38aa07e9c6e2f0947d23adc7a1b453277c790
Reviewed-on: https://go-review.googlesource.com/c/go/+/435942
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:59 +00:00
cuiweixie
58093e8e2b cmd/asm: optimize if statement to return directly
Change-Id: Ieb8fb7c623ecd8b9ddd15cdb6eb2c6326a9bbd3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/435941
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:58 +00:00
cuiweixie
c4a3fae27e cmd/asm: use opd.String() instead of fmt.Sprintf
Change-Id: Idbade74025bddb26ec3c10527de5af5dc2b8c1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/435940
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:56 +00:00
Bryan C. Mills
223a563f58 os/exec: refactor goroutine error reporting
Use a separate channel to report the final error of the copying
goroutines, receiving a value only when all of the copying goroutines
have completed. In a followup change (CL 401835), that will allow
waiters to select on goroutine completion alongside other events (such
as Context cancellation).

Also mildly refactor the watchCtx helper method so that its structure
better matches what will be needed to implement WaitDelay.

For #50436.

Change-Id: I54b3997fb6931d204814d8382f0a388a67b520f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/435995
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-29 02:34:30 +00:00
Bryan C. Mills
4d6ca68a85 os/exec: do not close pipes on a double-Start error
This fixes a bug introduced in CL 401834 in which calling Start twice
with pipes attached to a command would spuriously close those pipes
when returning the error from the second Start call.

For #50436.

Change-Id: I3563cc99c0a0987752190fef95da3e9927a76fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/436095
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-29 02:28:26 +00:00
Roland Shoemaker
13d48bb6a1 encoding/gob: add top level security doc
Add a slightly expanded version of the Decoder type comment to the top
level package doc, which explains that this package is not designed
to be hardened against adversarial inputs.

Change-Id: I8b83433838c8235eb06ded99041fdf726c811ee5
Reviewed-on: https://go-review.googlesource.com/c/go/+/436096
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-29 00:30:21 +00:00
Robert Griesemer
ffdfa9ff41 go/types, types2: consistently use "cause" instead of "reason" for error details (cleanup)
There were many more uses of the variable name "cause" than "reason"
to hold error message details. Consistently use "cause" throughout.

Accordingly, s/MissingMethodReason/MissingMethodCause/.

Change-Id: I171d784faabc66a4c58ba8944784204687595203
Reviewed-on: https://go-review.googlesource.com/c/go/+/435418
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-28 23:46:58 +00:00
Robert Griesemer
5612215d32 go/types, types2: remove (C/c)ompilerErrorMessages flag - not needed anymore
Fixes #55326.

Change-Id: Ic300976ddf504224faadc5bae21736fe94dac6bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/435416
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 23:46:46 +00:00
Robert Griesemer
8c29881dd1 cmd/compile: use "shifted operand %s (type %s) must be integer" for some shift errors
This matches what go/types and types2 report and it also matches
the compiler errors reported for some related shift problems.

For #55326.

Change-Id: Iee40e8d988d5a7f9ff2c49f019884d02485c9fdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/436177
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 22:28:41 +00:00
Robert Griesemer
7997e5f254 cmd/compile: use "cannot use %s as %s value in %s: %s" error message
This is close to what the compiler used to say, except now we say
"as T value" rather than "as type T" which is closer to the truth
(we cannot use a value as a type, after all). Also, place the primary
error and the explanation (cause) on a single line.

Make respective (single line) adjustment to the matching "cannot
convert" error.

Adjust various tests.

For #55326.

Change-Id: Ib646cf906b11f4129b7ed0c38cf16471f9266b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/436176
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 22:28:39 +00:00
Robert Griesemer
435652b468 go/types, types2: use "assignment mismatch: x variables but y values" error message
This matches current compiler behavior.

For #55326.

Change-Id: I7197cf4ce21e614291a1a2e1048dd78d0a232b64
Reviewed-on: https://go-review.googlesource.com/c/go/+/436175
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 20:43:36 +00:00
Alan Donovan
f1d281fe4d go/ast: record start and end of file in File.File{Start,End}
This change causes the parser to record the positions of the first
and last character in the file in new ast.File fields FileStart
and FileEnd.

The behavior of the existing Pos() and End() methods,
which record the span of declarations, must remain unchanged
for compatibility.

Fixes golang/go#53202

Change-Id: I250b19e69f41e3590292c3fe6dea1943ec98f629
Reviewed-on: https://go-review.googlesource.com/c/go/+/427955
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-28 20:37:59 +00:00
Tobias Klauser
dbf174d4b9 cmd/dist: test cmd module on js/wasm
Most tests will be skipped anyway because 'go build' is not available,
but this ensures cmd will be build tested by TryBots for js/wasm.

For #25911
For #35220
For #54219

Change-Id: I09c75905c36311810eb1ae75eeee2fa6102c1c0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/435237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 18:39:27 +00:00
cui fliter
ae3abf16e4 cmd/compile/internal/base: replace io/ioutil with os package
Change-Id: Ide7618b65fcff7947809051d51b993d330e35717
GitHub-Last-Rev: 298853a820
GitHub-Pull-Request: golang/go#55914
Reviewed-on: https://go-review.googlesource.com/c/go/+/435537
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-28 18:13:41 +00:00
Nobuki Fujii
d6ca24477a testing: fail if T.Setenv is called via T.Run in a parallel test
The existing implementation can call to T.Setenv in T.Run even after
calling to T.Parallel, so I changed it to cause a panic in that case.

Fixes #55128

Change-Id: Ib89d998ff56f00f96a5ca218af071bd35fdae53a
Reviewed-on: https://go-review.googlesource.com/c/go/+/431101
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-28 17:18:17 +00:00
cuiweixie
7f7f27f992 cmd/go: using strings.CutSuffix replace strings.HasSuffix and strings.TrimSuffix
Change-Id: I79854419091d6c5c5c2922a1f45a3c5589673f11
Reviewed-on: https://go-review.googlesource.com/c/go/+/435138
Run-TryBot: xie cui <523516579@qq.com>
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-09-28 16:47:59 +00:00
Joel Sing
bc73996fac cmd/link/internal/loadelf: add additional relocations for riscv64
These relocations are produced by clang/llvm.

Change-Id: I4820e7ed805d1b7341023b263c167a285ca32cf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/431755
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 16:43:13 +00:00
Zeke Lu
d7e663d909 os/signal: disable GNU readline to deflake TestTerminalSignal
Fixes #55903.

Change-Id: I992865277fb6526929d6c7db2b3b8d22ca0760f2
GitHub-Last-Rev: fc6f28e17c
GitHub-Pull-Request: golang/go#55904
Reviewed-on: https://go-review.googlesource.com/c/go/+/435735
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-28 16:30:21 +00:00
Archana R
4350c4a131 cmd/internal/obj/ppc64: remove unnecessary opcodes
This CL removes some opcode placeholders that do not correspond
to any existing instructions and hence create confusion. Some
instructions that are no longer valid like LDMX are also removed.
Any references to this instruction in ISA 3.0 are considered
as documentation errata.

Change-Id: Ib71a657099723bbe1db88873233ee573b5c42fe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/429860
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
2022-09-28 15:27:05 +00:00
cui fliter
190973eb60 all: fix some typos
Change-Id: I8b28aebbb9494b2c877139a4584a5a42253e3bea
GitHub-Last-Rev: e3703fd3a5
GitHub-Pull-Request: golang/go#55902
Reviewed-on: https://go-review.googlesource.com/c/go/+/435617
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-28 15:13:20 +00:00
Lynn Boger
6e1b769377 cmd/compile: remove some lines from PPC64.rules
In CL 429035 Keith suggested removing some
rules that were covered by generic rules. This
follows up on that comment.

Change-Id: I57b6c9ae0cd85f33a0eb2fef8356575d3d7820fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/430417
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-28 14:15:04 +00:00
Than McIntosh
53773a5d08 cmd/go: support new hybrid coverage instrumentation
If GOEXPERIMENT=coverageredesign is in effect, introduce a new
top-level '-cover' option to "go build" to turn on new-style hybrid
code coverage instrumentation. Similarly, use the new instrumentation
for "go test -cover".

The main effects of "-cover" under the hood are to instrument files at
the package level using cmd/cover and to pass additional options to
the compiler when building instrumented packages.

The previous workflow for "go tool -cover mypkg" would expand to a
series of "go tool cover" commands (one per file) followed by a single
package compilation command to build the rewritten sources.

With the new workflow, the Go command will pass all of the Go files in
a package to the cover tool as a chunk (along with a config file
containing other parameters), then the cover tool will write
instrumented versions of the sources along with another "output"
config with info on coverage variable names for the the compiler. The
Go command will then kick off the compiler on the modified source
files, also passing in the config file generated by cmd/cover.

Updates #51430.

Change-Id: Id65621ff6a8c70a30168c1412c2d6f805ff3b9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/355452
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:50:58 +00:00
Than McIntosh
b32689f6c3 cmd/go: refactor package references in Builder.build
Refactor references to "a.Package" in Builder.build to be consistent,
e.g. all via the "p" helper variable. No change in functionality, this
is just intended to make the code more readable/consistent (since
prior to this point we had a random mix of "p" and "a.Package").

Change-Id: Ifea5ff9b314c39a0cf6e688511907d08cc56c603
Reviewed-on: https://go-review.googlesource.com/c/go/+/424819
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:49:14 +00:00
Than McIntosh
06e8022ed4 cmd/go: add hook to check for GOEXPERIMENT in script tests
Add a new hook to allow script tests to check whether a specific
GOEXPERIMENT is enabled.

Updates #51430.

Change-Id: Icdf39f845ff2c8b10c634d49e9c27bc90e7984f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/402174
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 11:49:00 +00:00
Than McIntosh
5f18e46328 cmd/cover: add hybrid instrumentation mode
Add a new mode of coverage instrumentation that works as a hybrid
between purely tool-based and purely compiler-based. The cmd/cover
tool still does source-to-source rewriting, but it also generates
information to be used by the compiler to do things like marking
meta-data vars as read-only.

In hybrid mode, the cmd/cover tool is invoked not on a single source
file but on all the files in a package, and is passed a config file
containing the import path of the package in question, along with
other parameters needed for the run. It writes a series of modified
files and an output config file to be passed to the compiler when
compiling the modified files.

Not completely useful by itself, still needs a corresponding set of
changes in the Go command and in the compiler.

Updates #51430.

Change-Id: I0fcbd93a9a8fc25064187b159152486a2549ea54
Reviewed-on: https://go-review.googlesource.com/c/go/+/395896
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:48:40 +00:00
Than McIntosh
87db4ffada runtime/coverage: runtime routines to emit coverage data
This patch fleshes out the runtime support for emitting coverage data
at the end of a run of an instrumented binary. Data is emitted in the
form of a pair of files, a meta-out-file and counter-data-outfile,
each written to the dir GOCOVERDIR. The meta-out-file is emitted only
if required; no need to emit again if an existing meta-data file with
the same hash and length is present.

Updates #51430.

Change-Id: I59d20a4b8c05910c933ee29527972f8e401b1685
Reviewed-on: https://go-review.googlesource.com/c/go/+/355451
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:48:10 +00:00
Than McIntosh
7a74829858 cmd/covdata: add tools to read/manipulate coverage data files
Add a set of helper packages for reading collections of related
meta-data and counter-data files ("pods") produced by runs of
coverage-instrumented binaries, and a new tool program (cmd/covdata)
for dumping and/or manipulating coverage data files.

Currently "go tool covdata" subcommands include 'merge', 'intersect',
'percent', 'pkglist', 'subtract', 'debugdump', and 'textfmt'
(conversion to the legacy "go tool cover" format).

Updates #51430.

Change-Id: I44167c578f574b4636ab8726e726388531fd3258
Reviewed-on: https://go-review.googlesource.com/c/go/+/357609
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-09-28 11:47:16 +00:00
Robert Griesemer
dbe56ff6c7 go/types, types2: use "invalid operation: x rel y (cause)" for comparison error messages
Matches compiler behavior and is consistent with what we do with other
binary operations.

While at it, also use parentheses rather than a colon for a couple of
errors caused by not having a core type.

For #55326.

Change-Id: I0a5cec1a31ffda98d363e5528791965a1ccb5842
Reviewed-on: https://go-review.googlesource.com/c/go/+/435618
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 10:36:02 +00:00
Ian Lance Taylor
2c4c2a5106 time: add comment explaining >>33 in Now
Change-Id: I022b617cd345b412bee0b50a862676a1dca94e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/418376
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-28 09:05:54 +00:00