1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:24:45 -07:00
Commit Graph

52421 Commits

Author SHA1 Message Date
Cuong Manh Le
129a2fcf6c cmd/compile: fix panic with nested dead hidden closures
CL 342350 fixed deadcode panic with dead hidden closures. However, a
closure may contains nested dead hidden closures, so we need to mark
them dead as well.

Fixes #51839

Change-Id: Ib54581adfc1bdea60e74d733cd30fd8e783da983
Reviewed-on: https://go-review.googlesource.com/c/go/+/394079
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-21 17:27:41 +00:00
Than McIntosh
627d6d6d55 debug/dwarf: better error detection in parseUnits
Tweak the (*Data).parseUnits method to check a bit more carefully for
buffer read errors, so as to avoid infinite looping on malformed
inputs.

Fixes #51758.
Updates #47653.

Change-Id: I6d67fcb53392acf651ceec636789ab9e49ad5a5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393874
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-21 17:14:08 +00:00
Cherry Mui
3f8a694155 cmd/compile: remove regabi magic names
When developing register ABI, for early testing the compiler
recognized a few magic names to trigger enabling register ABI.
After the development it is disabled (changed to a name that
cannot be spelled in the source code). Later in the development of
register ABI for ARM64 and PPC64, I don't think the magic names
were used. I think they can now be removed.

Keep the magic pragma for now in case it helps development.

Change-Id: Icbc34e2786a80fd8fffe4a464c569dc03a54cd09
Reviewed-on: https://go-review.googlesource.com/c/go/+/393877
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-03-21 14:46:56 +00:00
Brad Fitzpatrick
7eaad60737 net/http: flesh out Request.SetBasicAuth docs a bit
Clarify that username can't contain a colon.
See https://go.dev/play/p/aM25UHC6n98

Change-Id: I342575107104cbcd28b1d3442c474adf93b7f03c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394115
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-20 21:02:35 +00:00
Jero Bado
6673d5d701 README.md: update links to go.dev
Fixes #50916.

Change-Id: I51f3269b7a0793a3002eef83de1d871111fc3cdc
GitHub-Last-Rev: fc8c183ac7
GitHub-Pull-Request: golang/go#50919
Reviewed-on: https://go-review.googlesource.com/c/go/+/381962
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
2022-03-20 16:05:03 +00:00
zhouguangyuan
47efdcbf4c internal/reflectlite: fix name of type parameter
CL 372774 is for reflect, this CL is for internal/reflectlite.

Updates #50208

Change-Id: Ib7e8b1bc031feab218d1addd78388fcfe9b675b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393918
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
2022-03-20 15:54:23 +00:00
Meng Zhuo
4d2da99498 cmd/compile/internal/riscv64: add initial spill support
This CL adds some initial support for spilling and reloading
registers in the new ABI for RISCV64.

Change-Id: I5e2b4d93c33c528809d569e5a442bb302074be78
Reviewed-on: https://go-review.googlesource.com/c/go/+/360215
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-20 03:01:15 +00:00
cuiweixie
fa8efc1347 cmd/compile: pre init shapeMap
Change-Id: I4fea927b9d34e7bf382ddf148a787c1558176f2f
GitHub-Last-Rev: ff1fa78a36
GitHub-Pull-Request: golang/go#50568
Reviewed-on: https://go-review.googlesource.com/c/go/+/377994
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
2022-03-19 23:49:55 +00:00
Meng Zhuo
caf5cd9da8 cmd/compile/internal: add ABI register info for riscv64
This CL adds register information for riscv64

Updates #40724

Change-Id: If2275d9135596ff856d096881e4fe8bd1eeaacb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/359337
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-19 12:47:31 +00:00
Cuong Manh Le
7ca6902c17 cmd/compile: remove n.Diag() deadcode paths
CL 392918 changed n.Diag() to always return false, we can now get rid
of all its deadcode paths.

Updates #51691

Change-Id: I64c07970493e7bdcf89df9508ce88132ef4aa4d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/393915
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 23:20:51 +00:00
Cuong Manh Le
da9649e6d9 cmd/compile: remove t.Broke() deadcode paths
CL 392918 changed t.Broke() to always return false, we can now get rid
of all its deadcode paths.

Updates #51691

Change-Id: I0a2a13def07364e780e4785621690452948e219a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393914
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 23:20:41 +00:00
Bryan C. Mills
cc2e7f36ba cmd/go: diagnose unset GOROOT when built with -trimpath
For #51483

Change-Id: I4546c20cf968b595020a1eba888fe1d9a1c6cfc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391811
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Bryan Mills <bcmills@google.com>
2022-03-18 22:42:43 +00:00
Bryan C. Mills
e1fbf13896 cmd/go: include the "-trimpath" flag in the stamped build settings
The -trimpath flag has a strong effect on the resulting binary:
in particular, it determines whether runtime.GOROOT can report
a meaningful path in the absence of an explicit GOROOT environment variable.

For #51461

Change-Id: Id0d55572c0a0a4e2e4724363ed80dfa05b202186
Reviewed-on: https://go-review.googlesource.com/c/go/+/391810
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 22:41:45 +00:00
Bryan C. Mills
0433f5770b cmd/go: stamp build settings for binaries in cmd
Also update cmd/dist to avoid setting gcflags and ldflags explicitly
when the set of flags to be set is empty (a verbose way of specifying
the default behavior).

Stamping was disabled for the Go standard library in CL 356014 due to
the cmd/dist flags causing cmd/go to (correctly) report the resulting
binaries as stale.

With cmd/dist fixed, we can also remove the special case in cmd/go,
which will allow tests of binaries in 'cmd' to read the build info
embedded in the test binary. That build info may be useful to
determine (say) whether runtime.GOROOT ought to work without GOROOT
set in the environment.

For #51483
Updates #37475

Change-Id: I64d04f5990190094eb6c0522db829d3bdfa50ef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/391809
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>
2022-03-18 22:14:22 +00:00
Bryan C. Mills
d68615f64b cmd/go/internal/test: ensure that build.ToolDir is accurate in tests
This fixes a build failure due to inability to locate the "vet" tool
when the test binary is built with -trimpath.

Updates #51461

Change-Id: I81838cc8842e4ff7900cab81af60501ebba86ff1
Reviewed-on: https://go-review.googlesource.com/c/go/+/391808
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>
2022-03-18 22:14:14 +00:00
Bryan C. Mills
6378c0e753 go/build: avoid setting Default.GOROOT when runtime.GOROOT() is empty
Previously, we called path.Clean on the value of runtime.GOROOT() even
if it was empty, which would set it explicitly to ".".
That would cause (*Context).importGo to assume that errors resolving
paths in GOROOT are fatal and return early:
https://cs.opensource.google/go/go/+/master:src/go/build/build.go;l=1121-1127;drc=38174b3a3514629b84dcd76878b2f536b189dd7b

If we instead leave it empty (and are in module mode), then importGo
will fall back to letting the 'go' command resolve the path, which may
succeed if the 'go' command can infer the correct GOROOT (from its own
stamped-in default GOROOT or executable path).

Fixes #51483

Change-Id: I44dce7cec6c3d1c86670e629ddfbca8be461130c
Reviewed-on: https://go-review.googlesource.com/c/go/+/391805
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>
2022-03-18 22:13:57 +00:00
Bryan C. Mills
58631ba54f internal/testenv: add GOROOT and use it to fix tests broken with -trimpath
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>
2022-03-18 21:55:52 +00:00
Bryan C. Mills
9ac75d3951 cmd/link: avoid stamping runtime.defaultGOROOT when paths are being trimmed
Previously, runtime.GOROOT() would return the string "go" in a binary
build with -trimpath. This change stamps the empty string instead,
using a sentinel value passed from cmd/go that looks like the GOROOT
environment variable (either "$GOROOT" or "%GOROOT%", depending on the
platform).

Fixes #51461

Change-Id: I1f10ef2435016a7b6213bd8c547df911f7feeae7
Reviewed-on: https://go-review.googlesource.com/c/go/+/390024
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>
2022-03-18 21:55:03 +00:00
Bryan C. Mills
9a932c5712 internal/buildcfg: initialize GOROOT to runtime.GOROOT
In the beginning the Go compiler was in C, and C had a function
'getgoroot' that returned GOROOT from either the environment or a
generated constant. 'getgoroot' was mechanically converted to Go
(as obj.Getgoroot) in CL 3046.

obj.Getgoroot begat obj.GOROOT. obj.GOROOT begat objabi.GOROOT,
which begat buildcfg.GOROOT.

As far as I can tell, today's buildcfg.GOROOT is functionally
identical to runtime.GOROOT(). Let's reduce some complexity by
defining it in those terms.

While we're thinking about buildcfg.GOROOT, also check whether it is
non-empty: if the toolchain is built with -trimpath, the value of
GOROOT might not be valid or meaningful if the user invokes
cmd/compile or cmd/link directly, or via a build tool other than
cmd/go that doesn't care as much about GOROOT. (As of CL 390024,
runtime.GOROOT will return the empty string instead of a bogus one
when built with -trimpath.)

For #51461.

Change-Id: I9fec020d5fa65d4aff0dd39b805f5ca93f86c36e
Reviewed-on: https://go-review.googlesource.com/c/go/+/393155
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>
2022-03-18 21:52:11 +00:00
Bryan C. Mills
67f6b8c987 cmd/go: avoid stamping VCS metadata in test binaries
Invoking a VCS tool requires that the VCS tool be installed, and also
adds latency to build commands. Unfortunately, we had been mistakenly
loading VCS metadata for tests of "main" packages.

Users almost never care about versioning for test binaries, because
'go test' runs the test in the source tree and test binaries are only
rarely used outside of 'go test'. So the user already knows exactly
which version the test is built against, because the source code is
right there — it's not worth the overhead to stamp.

Fixes #51723.

Change-Id: I96f191c5a765f5183e5e10b6dfb75a0381c99814
Reviewed-on: https://go-review.googlesource.com/c/go/+/393894
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 21:26:31 +00:00
Bryan C. Mills
9465878114 time: fix zoneinfo.zip locating logic when built with -trimpath
When the test binary is built with the -trimpath flag,
runtime.GOROOT() is invalid, and must not be used to locate
GOROOT/lib/time/zoneinfo.zip. (We can use other sources instead.)

However, the test for the package expects zoneinfo.zip to definitely
exist. 'go test' runs the test binary in the directory containing its
source code — in this case GOROOT/src/time — so we can use that
information to find the zoneinfo.zip file when runtime.GOROOT isn't
available.

For #51483

Change-Id: I9de35252a988d146b5d746794323214d400e64e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391814
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 20:57:35 +00:00
Ian Lance Taylor
a682a5c711 sort: generate generic variants with E rather than Elem
For #51698

Change-Id: Ifc5bef2cc41b163644ac80ace7c1470c8a130467
Reviewed-on: https://go-review.googlesource.com/c/go/+/393700
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
2022-03-18 19:32:40 +00:00
Keith Randall
fcf6afb82d cmd/compile: pointers to notinheap types need their own shape
They should not share a shape with regular pointers. We could coalesce
multiple pointer-to-not-in-heap types, but doesn't seem worth it - just
make them fully stenciled.

Fixes #51733

Change-Id: Ie8158177226fbc46a798e71c51897a82f15153df
Reviewed-on: https://go-review.googlesource.com/c/go/+/393895
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-03-18 19:22:30 +00:00
Heschi Kreinick
7e5804cb70 cmd: update vendored pprof
go get github.com/google/pprof@latest
  go mod vendor

Plus a tiny change to the pprof command to match an upstream interface
change.

Updates #36905.

Change-Id: I4c7bbe8c317a6eeb217fce971b208f96ab0727fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/393370
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-18 18:48:36 +00:00
Cherry Mui
9f252a0462 all: delete ARM64 non-register ABI fallback path
Change-Id: I3996fb31789a1f8559348e059cf371774e548a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/393875
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-03-18 18:26:13 +00:00
Russ Cox
0a49f706e1 cmd/go: run 'go help documentation' through gofmt in TestDocsUpToDate
mkalldocs.sh runs gofmt on the output, but the test does not.
If go help documentation and gofmt disagree, the test will fail.
Fix that.

Change-Id: I837374a2d36cb5d71278ecefe2a7b6544622c576
Reviewed-on: https://go-review.googlesource.com/c/go/+/384256
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 16:57:07 +00:00
Russ Cox
7747c33a41 internal/diff: add, replacing cmd/internal/diff
This is an in-process (non-exec'ing) replacement for cmd/internal/diff.
It uses an O(n log n) algorithm instead of the O(n²) algorithm
in standard diff binaries. It does not produce the absolute
shortest diffs, but the results are often more meaningful
than the standard diff, because it doesn't try to align
random blank lines or other noise.

Adding so that tests inside std (especially go/printer)
can print diffs.

Replacing cmd/internal/diff because we don't need two.

Change-Id: I9155dd925e4a813f5bfa84a8ad3dec8ffdbf8550
Reviewed-on: https://go-review.googlesource.com/c/go/+/384255
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
2022-03-18 16:56:29 +00:00
Cherry Mui
8ff42d1bb1 internal/abi, internal/buildcfg: always enable register ABI on ARM64
In last cycle we developed register ABI for ARM64, enabled by
default as a GOEXPERIMENT. This cycle we turn it on all the time.
Later CLs will clean up fallback code.

To support in-development platforms (e.g. RISC-V), separate the
boolean variables for in-development platforms and always-on
platforms.

Change-Id: I97c27f6aeccc85ccc57eed2abd783b176da3ad80
Reviewed-on: https://go-review.googlesource.com/c/go/+/393364
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 16:39:28 +00:00
Bryan C. Mills
2c92b2349a internal/buildcfg: extract logic specific to cmd/go
cmd/go/internal/cfg duplicates many of the fields of
internal/buildcfg, but initializes them from a Go environment file in
addition to the usual process environment.

internal/buildcfg doesn't (and shouldn't) know or care about that
environment file, but prior to this CL it exposed hooks for
cmd/go/internal/cfg to write data back to internal/buildcfg to
incorporate information from the file. It also produced quirky
GOEXPERIMENT strings when a non-trivial default was overridden,
seemingly so that 'go env' would produce those same quirky strings in
edge-cases where they are needed.

This change reverses that information flow: internal/buildcfg now
exports a structured type with methods — instead of top-level
functions communicating through global state — so that cmd/go can
utilize its marshaling and unmarshaling functionality without also
needing to write results back into buildcfg package state.

The quirks specific to 'go env' have been eliminated by distinguishing
between the raw GOEXPERIMENT value set by the user (which is what we
should report from 'go env') and the cleaned, canonical equivalent
(which is what we should use in the build cache key).

For #51461.

Change-Id: I4ef5b7c58b1fb3468497649a6d2fb6c19aa06c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/393574
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 15:35:06 +00:00
Cherry Mui
d8bee94be2 reflect, runtime: drop RegabiArgs conditions
With the previous CL, internal/abi.IntArgRegs and FloatArgRegs
is controlled by RegabiArgs (or always enabled), so there is no
need to check for that goexperiment.

There are a few places we guard register-ABI specific code and
tests with the RegabiArgs flag. Switch to checking for the number
of argument registers instead.

Change-Id: I79fff9fd1e919684ffaf73aba9e7e85d5a9e1629
Reviewed-on: https://go-review.googlesource.com/c/go/+/393363
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 15:17:37 +00:00
Cherry Mui
3684abbf6c all: delete regabireflect goexperiment
regabireflect goexperiment was helpful in the register ABI
development, to control code paths for reflect calls, before the
compiler can generate register ABI everywhere. It is not necessary
for now. Drop it.

Change-Id: I2731197d2f496e29616c426a01045c9b685946a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/393362
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-03-18 14:45:56 +00:00
Tobias Klauser
12eca21f1c syscall: use bytealg.IndexByte in clen
Change-Id: Ib3f92ea8371a13471acf9304dc9db66c0aae9bf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/393756
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 12:07:27 +00:00
Changkun Ou
4432059485 A+C: update Changkun Ou's email
Add my current public email in both A+C, but keep old one too.
Add my @changkun.de email to CONTRIBUTORS.

Change-Id: Ic5a585582a5f5142fbdd0a132235c19f05d9e680
Reviewed-on: https://go-review.googlesource.com/c/go/+/367116
Run-TryBot: Changkun Ou <mail@changkun.de>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ben Shi <powerman1st@163.com>
2022-03-18 09:40:34 +00:00
Nuno Cruces
f02108636c runtime: allow TestCtrlHandler to run in ConPTY
Fixes #51602. Previous test would not run in a pseudo-console (ConPTY).

New test avoids taskkill entirely by having the child request its own
console window be closed.

Verified that this runs locally (within a real console), over SSH
(within a pseudo-console), and that it breaks if #41884 were reverted.

Change-Id: If868b92ec36647e5d0e4107e29a2a6e048d35ced
GitHub-Last-Rev: b1421e4bed
GitHub-Pull-Request: golang/go#51681
Reviewed-on: https://go-review.googlesource.com/c/go/+/392874
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
2022-03-18 07:37:53 +00:00
Tobias Klauser
3d19e8da79 syscall: unskip TestDirentRepeat on freebsd
TestDirentRepeat fails on FreeBSD 11, but seems to pass on newer
versions. Go 1.18 is the last release to support FreeBSD 11 per
https://golang.org/doc/go1.18#freebsd and there are no FreeBSD 11
builders anymore. Thus unskip TestDirentRepeat to verify the issue is
indeed fixed on FreeBSD 12 and later.

For #31416

Change-Id: I189ef06719ff830ffe2e402c74a75874c9e5b97b
Reviewed-on: https://go-review.googlesource.com/c/go/+/393618
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-18 06:03:39 +00:00
Tobias Klauser
adfee1e1e7 runtime/cgo: remove memset in _cgo_sys_thread_start on freebsd/arm
pthread_attr_init on freebsd properly initializes the pthread_attr,
there is no need to zero it before the call. The comment and code were
probably copied from the linux/arm implementation.

This aligns the implementation on freebsd/arm with the implementation on
other freebsd architectures.

Fixes #44248

Change-Id: If82ebb115b877b6c6f4862018a9419ba8d870f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/393617
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
2022-03-18 06:03:19 +00:00
Tobias Klauser
489102de18 syscall: optimize UTF16{,Ptr}FromString
Use bytealg.IndexByteString in UTF16FromString instead of an open-coded
loop.

Change-Id: I366448382f2d0adeca6b254131e0087a1f489258
Reviewed-on: https://go-review.googlesource.com/c/go/+/393614
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-18 05:55:52 +00:00
cuiweixie
3ea22cf3c4 crypto/x509: return err ans1.Marshal gives an error
Fixes #50663

Change-Id: I18754922bf139049443c0395eaa1606049df1331
GitHub-Last-Rev: 57ff5ddfe3
GitHub-Pull-Request: golang/go#50667
Reviewed-on: https://go-review.googlesource.com/c/go/+/379094
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-18 04:28:47 +00:00
Matt Layher
485d67bd38 A+C: add PlanetScale, Inc.
Change-Id: Ide2567dc66e55880b938b5814879f012c88159b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/393697
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>
2022-03-18 01:28:47 +00:00
Ian Lance Taylor
2d32594396 runtime: call testenv.MustHaveCGO in a couple of tests
Fixes #51695

Change-Id: Icfe9d26ecc28a7db9040d50d4661cf9e8245471e
Reviewed-on: https://go-review.googlesource.com/c/go/+/392916
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-03-18 00:49:08 +00:00
fangguizhen
3d7392a08f net/rpc: reduce the execution of reflect and decode
Change-Id: Ief4b5e1c2d1002392901124c0694afe58c271573
GitHub-Last-Rev: e3b8a60377
GitHub-Pull-Request: golang/go#46421
Reviewed-on: https://go-review.googlesource.com/c/go/+/323014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2022-03-18 00:39:23 +00:00
Heschi Kreinick
79861be205 all: update vendored x dependencies for Go 1.19 development cycle
Generated with x/build/cmd/updatestd.

Updates #36905.

Change-Id: I5d12dfc3b49c1476ce4b8d4cbeb35bd3d3443d26
Reviewed-on: https://go-review.googlesource.com/c/go/+/393369
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 20:32:25 +00:00
Bryan C. Mills
3046ae927d cmd/doc: use the 'go' command from buildCtx.GOROOT, not whatever is in $PATH
For #51483.

Change-Id: I6150fdf97763d858e9ab012e807515da3387c25f
Reviewed-on: https://go-review.googlesource.com/c/go/+/393366
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 20:09:38 +00:00
Bryan C. Mills
2b0ac284cf cmd/doc: use 'go env' to identify GOROOT if it isn't otherwise known
Updates #51483.

Change-Id: I13d8e58b30639d8a5ed3c9e8b72c8bbaa6a6f1cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/391813
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 20:09:18 +00:00
Bryan C. Mills
c6244b5909 runtime/debug: do not require a GOROOT/src prefix in TestStack
When paths are trimmed, the reported file locations begin with the
package import path (not GOROOT/src).

Updates #51461.

Change-Id: Ia6814f970aee11f3d933e75c75136d679d19e220
Reviewed-on: https://go-review.googlesource.com/c/go/+/391815
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 19:24:19 +00:00
Brad Fitzpatrick
0fca8a8f25 crypto/x509: fix Certificate.Verify crash
(Primarily from Josh)

Fixes #51759

Co-authored-by: Josh Bleecher Snyder <josharian@gmail.com>
Change-Id: I0a6f2623b57750abd13d5e194b5c6ffa3be6bf72
Reviewed-on: https://go-review.googlesource.com/c/go/+/393655
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 17:42:32 +00:00
fanzha02
c379c3d58d cmd/compile: set conversions to unsafe.Pointer as an escaping operation when -asan is enabled
When ASan is enabled, treat conversions to unsafe.Pointer as
an escaping operation. In this way, all pointer operations on
the stack objects will become operations on the escaped heap
objects. As we've already supported ASan detection of error
memory accesses to heap objects. With this trick, we can use
-asan option to report errors on bad stack operations.

Add test cases.

Updates #44853.

Change-Id: I6281e77f6ba581d7008d610f0b24316078b6e746
Reviewed-on: https://go-review.googlesource.com/c/go/+/393315
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Run-TryBot: Fannie Zhang <Fannie.Zhang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-03-17 08:43:51 +00:00
Fannie Zhang
599d5395eb Revert "cmd/compile: set conversions to unsafe.Pointer as an escaping operation when -asan is enabled"
This reverts commit 5fd0ed7aaf.

Reason for revert: <The internal information in commit message is not removed.>

Change-Id: Id6845a9c8114ac71c56a1007a4d133a560a37fbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/393314
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-03-17 08:43:15 +00:00
Robert Griesemer
9956a5423e text/scanner: guard against installed IsIdentRune that accepts EOF
IsIdentRune may be installed by a client of the scanner. If the
installed function accepts EOF as a valid identifier rune, Scan
calls may not terminate.

Check for EOF when a user-defined IsIdentRune is used.

Fixes #50909.

Change-Id: Ib104b03ee59e2d58faa71f227c3b51ba424f7f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/393254
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-17 03:41:50 +00:00
Russ Cox
8427429c59 os: raise open file rlimit at startup
Some systems set an artificially low soft limit on open file count,
for compatibility with code that uses select and its hard-coded
maximum file descriptor (limited by the size of fd_set).

Go does not use select, so it should not be subject to these limits.
On some systems the limit is 256, which is very easy to run into, even
in simple programs like gofmt when they parallelize walking a file tree.

After a long discussion on go.dev/issue/46279, we decided the best
approach was for Go to raise the limit unconditionally for itself, and
then leave old software to set the limit back as needed. Code that
really wants Go to leave the limit alone can set the hard limit, which
Go of course has no choice but to respect.

Take 2, after CL 392415 was rolled back for macOS and OpenBSD failures.
The macOS failures should be handled by the new call to sysctl("kern.maxfilesperproc"),
and the OpenBSD failures are handled by skipping the test (and filing #51713).

Fixes #46279.

Change-Id: I45c81b94590b447b483018a05ae980b8f02dc5de
Reviewed-on: https://go-review.googlesource.com/c/go/+/393354
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-17 03:04:30 +00:00