On Linux, both mprotect() and mmap() acquire the mmap_lock (in writer mode),
posing scalability challenges.
The mmap_lock (formerly called mmap_sem) is a reader/writer lock that controls
access to a process's address space; before making changes there (mapping in a
new range, for example), the kernel must acquire that lock.
Page-fault handling must also acquire mmap_lock (in reader mode) to ensure that
the address space doesn't change in surprising ways while a fault is being resolved.
A process can have a large address space and many threads running (and incurring
page faults) concurrently, turning mmap_lock into a significant bottleneck.
While both mmap() and mprotect() are protected by the mmap_lock, the shorter
duration of mprotect system call, due to their simpler nature, results in a reduced
locking time for the mmap_lock.
Change-Id: I7f929544904e31eab34d0d8a9e368abe4de64637
GitHub-Last-Rev: 6f27a216b4
GitHub-Pull-Request: golang/go#65038
Reviewed-on: https://go-review.googlesource.com/c/go/+/554935
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Fixes#66239
Change-Id: I8210682c0cf4285b950e9fabe687b7ad2369835c
Reviewed-on: https://go-review.googlesource.com/c/go/+/570397
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: Ie8fa25d5e326efd7d3c9b72203783110d9e22ce8
Reviewed-on: https://go-review.googlesource.com/c/go/+/572215
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The existing implementation of the mail package conforms to RFC 5322
for parsing mail messages, but it lacks support for domain literals. This
patch addresses this limitation by adding support for domain literals in
the address parser.
The Addr-Spec Specification, defined in RFC 5322 Section 3.4.1,
outlines the format for email addresses:
https://datatracker.ietf.org/doc/html/rfc5322\#section-3.4.1Fixes#60206
Change-Id: Ic901418325bd1da69e70800d70b87d658b953738
GitHub-Last-Rev: bdda66f3fe
GitHub-Pull-Request: golang/go#66075
Reviewed-on: https://go-review.googlesource.com/c/go/+/567777
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Updates doc by running these commands:
- mksyntaxgo from the google/re2 repo, which changes comment according
to https://golang.org/s/generatedcode
- gofmt -w regexp/syntax/doc.go
Change-Id: I66a9dd9fa841cbce899ab3aa32d7face798d2920
Reviewed-on: https://go-review.googlesource.com/c/go/+/572275
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This change invokes defer rows.Close() in TestQuery to properly close the rows.
Change-Id: I1ab0d172ad2130e9caab7dbda93d671550c33c6b
GitHub-Last-Rev: 76883a3bce
GitHub-Pull-Request: golang/go#66371
Reviewed-on: https://go-review.googlesource.com/c/go/+/572197
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
"sais2.go" is regenerated by the command "go generate ./...".
Change-Id: I4307e9fa1f20ea59e3a0d4841dbb22e9cffefa5a
GitHub-Last-Rev: d285183e65
GitHub-Pull-Request: golang/go#66376
Reviewed-on: https://go-review.googlesource.com/c/go/+/572198
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
This replaces a map used as a set with a slice.
We were using a surprising amount of CPU in this code, making mapiters
to pull out a random element of the map. Instead, just rand.IntN to pick
a random element of the slice.
It also adds a benchmark:
│ before │ after │
│ sec/op │ sec/op vs base │
ConnRequestSet-8 1818.0n ± 0% 452.4n ± 0% -75.12% (p=0.000 n=10)
(whether random is a good policy is a bigger question, but this
optimizes the current policy without changing behavior)
Updates #66361
Change-Id: I3d456a819cc720c2d18e1befffd2657e5f50f1e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/572119
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
When text/template is evaluating a pipeline command and encounters an
`interface{}`, it "digs down one level to the thing inside". Currently it
does this with `value = reflect.ValueOf(value.Interface())`, which is
unnecessary since it could just use `value = value.Elem()`. This commit
changes it to use the latter.
Why it was written that way is mysterious because the proposed change
appears to be strictly better, but given the blame date (13 years ago)
it may have been written while reflect was still in development before
`Elem()` was added.
Change-Id: I6c4f6283e78de07732c4120ce11f26f113fa46e4
GitHub-Last-Rev: bdfc6973ab
GitHub-Pull-Request: golang/go#66373
Reviewed-on: https://go-review.googlesource.com/c/go/+/572355
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Rob Pike <r@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
CL 571396 introduced quotes around user-provided names in error
messages. Update a test case to match the changed error message.
Change-Id: I3de0ea32f363ac83dcecae164ceab74e28dea086
Reviewed-on: https://go-review.googlesource.com/c/go/+/572555
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
According to static analysis of Go source code known by the module proxy,
spaces, dashes, zeros, and tabs are the most commonly repeated string literals.
Out of ~69k total calls to Repeat:
* ~25k calls are repeats of " "
* ~7k calls are repeats of "-"
* ~4k calls are repeats of "0"
* ~2k calls are repeats of "="
* ~2k calls are repeats of "\t"
After this optimization, ~60% of Repeat calls will go through the fast path.
These are often used in padding of fixed-width terminal UI or
in the presentation of humanly readable text
(e.g., indentation made of spaces or tabs).
Optimize for this case by handling short repeated sequences of common literals.
Performance:
name old time/op new time/op delta
RepeatSpaces-24 19.3ns ± 1% 5.0ns ± 1% -74.27% (p=0.000 n=8+9)
name old alloc/op new alloc/op delta
RepeatSpaces-24 2.00B ± 0% 0.00B -100.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
RepeatSpaces-24 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
Change-Id: Id1cafd0cc509e835c8241a626489eb206e0adc3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/536615
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
writeLoop goroutine closes persistConn closech in case of request body
write error which in turn finishes readLoop without removing request canceler.
Fixes#61708
Change-Id: Ib7c832a91b49bc7888a35a4fd2bd692236c04f86
GitHub-Last-Rev: b74b9055e8
GitHub-Pull-Request: golang/go#62305
Reviewed-on: https://go-review.googlesource.com/c/go/+/523296
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Use `' quotes (as in `foo') to differentiate from Go quotes.
Quoting prevents confusion when user-supplied names alter
the meaning of the error message.
For instance, report
duplicate method `wanted'
rather than
duplicate method wanted
Exceptions:
- don't quote _:
`_' is ugly and not necessary
- don't quote after a ":":
undefined name: foo
- don't quote if the name is used correctly in a statement:
goto L jumps over variable declaration
Quoting is done with a helper function and can be centrally adjusted
and fine-tuned as needed.
Adjusted some test cases to explicitly include the quoted names.
Fixes#65790.
Change-Id: Icce667215f303ab8685d3e5cb00d540a2fd372ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/571396
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This CL reimplements fixLongPath using syscall.GetFullPathName instead
of a custom implementation that was not handling UNC paths and ..
segments correctly. It also fixes a bug here multiple trailing \
were removed instead of replaced by a single one.
The new implementation is slower than the previous one, as it does a
syscall and needs to convert UTF-8 to UTF-16 (and back), but it is
correct and should be fast enough for most use cases.
goos: windows
goarch: amd64
pkg: os
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
LongPath-12 1.007µ ± 53% 4.093µ ± 109% +306.41% (p=0.000 n=10)
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
LongPath-12 576.0 ± 0% 1376.0 ± 0% +138.89% (p=0.000 n=10)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
LongPath-12 2.000 ± 0% 3.000 ± 0% +50.00% (p=0.000 n=10)
Fixes#41734.
Change-Id: Iced5cf47f56f6ab0ca74a6e2374c31a75100902d
Reviewed-on: https://go-review.googlesource.com/c/go/+/570995
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Compute ptrBytes while computing the size of a type.
Requires an extra field on the type, but means that we don't
have potentially exponential behavior in the PtrDataSize computation.
For #65540.
Change-Id: Ia23c72bbd996730baddd32d9ed46cfc00c3472ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/571543
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Some of the Windows syscall helpers don't need to be nosplit. Removing
this directive will allow to add instrumentation to these functions
without having to worry about the stack size.
Change-Id: I3885621f23733af48563803c704563474010b8d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/572415
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Change-Id: I0d6336e6a21aef14e7229594a335899083fa98b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/570396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
For #65540
Actually more correct in some very weird, and probably impossible to
trigger currently, cases. For instance, a struct with a NOEQ
and a NOALG field (the old code would not report the noalg bit).
Change-Id: I36c473b59aa5775d8a520ac746b114d16a22699d
Reviewed-on: https://go-review.googlesource.com/c/go/+/571542
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Add a ANOALG kind which is "ANOEQ, plus has a part that is marked Noalg".
That way, AlgType can return just a kind.
The field we used to return was used only to get this bit of information.
Change-Id: Iaa409742825cc1f19ab414b1f5b74c1f112ed5f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/572075
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Now with internal/asan and internal/msan available we can cleanup
syscall's duplicated definitions.
For #64611
Change-Id: If714d04ed2d32a4ed27305b3e3dc64ba8cdd1b61
GitHub-Last-Rev: e52fff1513
GitHub-Pull-Request: golang/go#65935
Reviewed-on: https://go-review.googlesource.com/c/go/+/566755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
The PIE buildmode works correctly on openbsd/arm64, hence enable it.
Updates #59866
Change-Id: I2f3c2839893659391539fafa12891d64f867e189
Reviewed-on: https://go-review.googlesource.com/c/go/+/570375
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
This will fail because epoll_ctl() fails on directory FDs, so we
end up issuing unnecessary syscalls. My test program that calls
filepath.WalkDir on a large directory tree runs 1.23 ± 0.04 times
faster than with the original implementation.
Change-Id: Ie33d798c48057a7b2d0bacac80fcdde5b5a8bb1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/570877
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Change-Id: I6b30ac3e9d15c29197426fb16dc4031056f6bb10
GitHub-Last-Rev: e2dda286f2
GitHub-Pull-Request: golang/go#66331
Reviewed-on: https://go-review.googlesource.com/c/go/+/571915
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
For #65363.
Change-Id: I82ae1098b00c8772ef8d3aa92197e7d8c66d1b37
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/571800
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This pulls in the changes to remove 1.18 support in counter and
countertest, to add counter.CountCommandLineFlags, and to add
countertest.SupportedPlatform
Commands run:
go get golang.org/x/telemetry@abedc37
go mod tidy
go mod vendor
Change-Id: I5c17c5b3ca38df14883ba43316d59437a737b28b
Reviewed-on: https://go-review.googlesource.com/c/go/+/571801
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
This usage shows up in quite a few places, and helps reduce
register pressure in several complex cryto functions by
removing a MOVD $0,... instruction.
Change-Id: I9444ea8f9d19bfd68fb71ea8dc34e109681b3802
Reviewed-on: https://go-review.googlesource.com/c/go/+/571055
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Makes the build work with CGO_CPPFLAGS=-D_GNU_SOURCE,
as reportedly used by TinyGo.
Fixes#66325
Change-Id: I794f1cd89814638fdb6c3066d13bbd7da88c9d93
Reviewed-on: https://go-review.googlesource.com/c/go/+/571875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This reverts CL 544019 and CL 569815, because they break a variety
of tests inside Google that do not expect the Cache-Control header
to be set to no-cache.
A followup CL will add this functionality back after a proposal.
For #50905.
Change-Id: Ie377bfb72ce2c77d11bf31f9617ab6db342a408a
Reviewed-on: https://go-review.googlesource.com/c/go/+/571975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Minor cleanups to CL 561635's test for better debuggability
when it crashes. In a separate CL so that it's clear this CL is
not changing the code under test.
Change-Id: I12b72ae538f8454b5c382127eafd766c22c69b67
Reviewed-on: https://go-review.googlesource.com/c/go/+/571799
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This makes CL 561635's test pass without any changes to the
traceback textual format.
The test in this CL is copied identically from CL 561635.
Change-Id: I5130abdfefd9940f98f20c283cca6cd159e37617
Reviewed-on: https://go-review.googlesource.com/c/go/+/571798
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This is a partial roll-forward of CL 473495, which was subsequently
reverted. The second half of CL 473495 will appear in a future CL.
In this patch we introduce a new Go linker "-bindnow" command line
flag, and update the Go command to permit the use of the -Wl,-z,now
option, to allow users to produce binaries that have immediate
binding.
Updates #45681.
Change-Id: Idd61b0d6597bcd37b16c343714c55a4ef6dfb534
Reviewed-on: https://go-review.googlesource.com/c/go/+/571416
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
An optional interface FileInfoNames has been added.
If the parameter fi of FileInfoHeader implements the interface
the Gname/Uname of the return value Header
are provided by the method of the interface.
Also added testing.
Fixes#50102
Change-Id: I47976e238eb20ed43113b060e4f83a14ae49493e
GitHub-Last-Rev: a213613c79
GitHub-Pull-Request: golang/go#65273
Reviewed-on: https://go-review.googlesource.com/c/go/+/558355
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
"atomicPointerDedup" is a redundancy of "atomic.Pointer".
Since Go 1.22 now requires the final point release of Go 1.20 or
later for bootstrap, Go 1.19's atomic.Pointer can be used
without problems.
atomicPointerDedup is unnecessary and we can remove it now.
Change-Id: I0a65ad0b6649cecb73d58dc39c5fd736390d5fa5
GitHub-Last-Rev: 6c6e9421fb
GitHub-Pull-Request: golang/go#65987
Reviewed-on: https://go-review.googlesource.com/c/go/+/567656
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
In Checker.validType, when we encounter a type parameter, we evaluate
the validity of the respective type argument in the "type nest" of the
enclosing type (at the nesting depth at which the type argument was
passed) (*). Specifically, we call validType recursively, with the slice
representing the type nest shortened by 1. This recursive call continues
to use the nest slice and in the process may overwrite the (previously)
last entry. Upon return of that recursive call, validType proceeds with
the old length, possibly using an incorrect last nest entry.
In the concrete example for this issue we have the type S
type S[T any] struct {
a T
b time.Time
}
instantiated with time.Time. When validType encounters the type parameter
T inside the struct (S is in the type nest) it evaluates the type argument
(time.Time) in the empty type nest (outside of S). In the process of
evaluating the time.Time struct, the time.Time type is appended to the
(shortened) nest slice and overwrites the previous last nest entry (S).
Once processing of T is done, validType continues with struct field b,
using the original-length nest slice, which now has time.Time rather
than S as a last element. The type of b has type time.Time, which now
appears to be nested in time.Time (rather than S), which (incorrectly)
means that there's a type cycle. validType proceeds with reporting the
error. But time.Time is an imported type, imported types are correct
(otherwise they could not be imported in the first place), and the
assertion checking that package of time.Time is local fails.
The fix is trivial: restore the last entry of the nest slice when it
may have been overwriten.
(*) In hindsight we may be able to sigificantly simplify validType by
evaluating type arguments when they are passed instead of when
the respective type parameters are encountered. For another CL.
Fixes#66323.
Change-Id: I3bf23acb8ed14d349db342ca5c886323a6c7af58
Reviewed-on: https://go-review.googlesource.com/c/go/+/571836
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
- Only search DNS servers for network interfaces with at least one gateway
- Clarify comment on deprecated site local anycast fec0/10 DNS IPv6 addresses
- Minor maintenance: skip not "up" interfaces earlier in outer loop
Change-Id: I98ca7b81d3d51e6aa6bfa4a10dcd651305a843df
GitHub-Last-Rev: 3b358c7e3f
GitHub-Pull-Request: golang/go#64441
Reviewed-on: https://go-review.googlesource.com/c/go/+/545775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
With this change my test program that reads a tree of ELF files runs
1.71 ± 0.12 times faster without parallelism or 1.39 ± 0.06 times
faster using 8 goroutines.
Change-Id: I443d1a02736f16f5532ef28e1447c97aa87c7126
Reviewed-on: https://go-review.googlesource.com/c/go/+/571436
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Go 1.13 is not supported anymore, but this CL removes an unnecessary
check and in turn fixes an old bug.
Fixes#66285.
Change-Id: I15ee1712b31f8ac8c915f18410d99cbf44334d35
Reviewed-on: https://go-review.googlesource.com/c/go/+/571058
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This is a cherry-pick of CL 571075 combined with adjustments for 1.23:
Imported interfaces don't have position information for embedded types.
When computing the type set of such interfaces, doing a version check
may fail because it will rely on the Go version of the current package.
We must not do a version check for features of types from imported
packages - those types have already been typechecked and are "correct".
The version check code does look at packages to avoid such incorrect
version checks, but we don't have the package information available
in an interface type (divorced from its object).
Instead, rely on the fact that imported interfaces don't have position
information for embedded types: if the position is unknown, don't do a
version check.
In Checker.allowVersion, still allow for unknown positions and resort
to the module version in that case (source code may be generated by
tools and not contain position information). Also, remove the *Package
argument as it was always check.pkg except in one case, and that case
may in fact be incorrect; treat that case separately for now.
Fixes#66064.
Change-Id: I773d57e5410c3d4a911ab3e018b3233c2972b3c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/571075
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/571137
Still investigating, but adding the minimized reproducer as a regress
test case for now.
Updates #66261.
Change-Id: I20715b731f8c5b95616513d4a13e3ae083709031
Reviewed-on: https://go-review.googlesource.com/c/go/+/571815
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The purpose of this package is to have a build tagged variant so that
when we're building the bootstrap go command it does not depend on the
net package. (net is a dependency of golang.org/x/telemetry/counter on
Windows).
The TESTGO_TELEMETRY_DIR environment variable used by the go tests to
change the telemetry directory is renamed to TEST_TELEMETRY_DIR to
make it more general to other commands that might want to set it for
the purpose of tests. The test telemetry directory is now set using
telemetry.Start instead of countertest.Open. This also means that the
logic that decides whether to upload counter files is now going to run
from the cmd/go tests (but that's okay because it's aleady been
running when cmd/go has been invoked outside of its tests.
Change-Id: Ic4272e5083facde010482d8b8fc3c95c03564bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/571096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: Ic7b390935df107c5b7f53f9347a52031eac8a897
GitHub-Last-Rev: a7194571e1
GitHub-Pull-Request: golang/go#66310
Reviewed-on: https://go-review.googlesource.com/c/go/+/571635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>