aboutsummaryrefslogtreecommitdiff
path: root/api/next
AgeCommit message (Collapse)Author
2023-02-15math: add Compare and Compare32Akhil Indurti
This change introduces the Compare and Compare32 functions based on the total-ordering predicate in IEEE-754, section 5.10. In particular, * -NaN is ordered before any other value * +NaN is ordered after any other value * -0 is ordered before +0 * All other values are ordered the usual way Compare-8 0.4537n ± 1% Compare32-8 0.3752n ± 1% geomean 0.4126n Fixes #56491. Change-Id: I5c9c77430a2872f380688c1b0a66f2105b77d5ac Reviewed-on: https://go-review.googlesource.com/c/go/+/467515 Reviewed-by: WANG Xuerui <git@xen0n.name> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-02-13slices: new packageIan Lance Taylor
This copies parts of x/exp/slices into the standard library. We omit all functions that depend on constraints.Ordered, and the Func variants of all such functions. In particular this omits the various Sort and Search functions. Fixes #57433 Change-Id: I3c28f4c2e6bd1e3c9ad70e120a0dd68065388f77 Reviewed-on: https://go-review.googlesource.com/c/go/+/467417 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Eli Bendersky <eliben@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-02-10Revert "math: add Compare and Compare32"Than McIntosh
This reverts CL 459435. Reason for revert: Tests failing on MIPS. Change-Id: I9017bf718ba938df6d6766041555034d55d90b8a Reviewed-on: https://go-review.googlesource.com/c/go/+/467255 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Akhil Indurti <aindurti@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-02-09math: add Compare and Compare32Akhil Indurti
This change introduces the Compare and Compare32 functions based on the total-ordering predicate in IEEE-754, section 5.10. In particular, * -NaN is ordered before any other value * +NaN is ordered after any other value * -0 is ordered before +0 * All other values are ordered the usual way name time/op Compare-8 0.24ns ± 1% Compare32-8 0.24ns ± 0% Fixes #56491. Change-Id: I9444fbfefe26741794c4436a26d403b8da97bdaf Reviewed-on: https://go-review.googlesource.com/c/go/+/459435 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-02-06all: upgrade Unicode from 13.0.0 to 15.0.0weebney
Update unicode/tables.go to reflect changes in the Unicode Standard up to Unicode 15.0.0, released 13 Sept 2022. In order to accommodate this update, strconv/isPrint has been updated to reflect changes in printable characters. Also changed is template/exec_test.go for both text and html packages- in the test "TestJSEscaping", rune U+FDFF was used as a placeholder for an unprintable character. This codepoint was assigned and made printable in Unicode 14.0.0, breaking this test. It has been replaced with the assigned and never-printable U+FFFE to fix the test and provide resiliency in the future. This upgrade bypasses Unicode 14.0.0, but is compatible. Updates https://github.com/golang/go/issues/48621 Fixes https://github.com/golang/go/issues/55079 Change-Id: I40efd097eb746db0727ebf7437280916d1242e47 GitHub-Last-Rev: c8885cab7a0c23632e1e5a433b1e8d5634a45a30 GitHub-Pull-Request: golang/go#57265 Reviewed-on: https://go-review.googlesource.com/c/go/+/456837 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Rob Pike <r@golang.org>
2023-02-03maps: new packageIan Lance Taylor
This copies x/exp/maps into the standard library (except for the Clear function which is now available as the clear builtin.) Fixes #57436 Change-Id: I30dd470c2f7ae34c7c82b4c1025a7582d61fabaa Reviewed-on: https://go-review.googlesource.com/c/go/+/464343 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Eli Bendersky <eliben@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-02-03debug/elf: add DT_FLAGS_1 constantsFlorin Papa
Add constants for all ELF dynamic flags (pertaining to DT_FLAGS_1). This will help, for example, determining whether an object is a position-independent executable (PIE). The constants are defined according to Table 15-10 in https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/dynamic-section.html. Fixes #56887 Change-Id: I6cd501af50d9dbcc2aa8a9a002e12c6fb6726761 Reviewed-on: https://go-review.googlesource.com/c/go/+/452496 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-02-02math/big: add Int.Float64 conversionAlan Donovan
This operation converts a big.Int to float64, reporting the accuracy of the result, with a fast path in hardware. Fixes #56984 Change-Id: I86d0fb0e105a06a4009986f2f5fd87a4d446f6f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/453115 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Alan Donovan <adonovan@google.com>
2023-02-02go/token: add (*File).Lines methodAlan Donovan
This method returns the array updated by SetLines, for use in exporter packages. Fixes #57708 Change-Id: I12ed5e7e1bae7517f40cb25e76e51997c25d84f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/464515 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Alan Donovan <adonovan@google.com>
2023-01-30reflect,runtime: add Value.ClearCuong Manh Le
Fixes #55002 Change-Id: I7d0f14cc54f67f2769b51d2efafc4ae3714f0e3d Reviewed-on: https://go-review.googlesource.com/c/go/+/457895 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-27encoding/binary: add var NativeEndiancuiweixie
Updates #57237 Change-Id: I149c8b7eeac91b87b5810250f96d48ca87135807 Reviewed-on: https://go-review.googlesource.com/c/go/+/463218 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: xie cui <523516579@qq.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-01-24bytes, strings: add ContainsFunchopehook
Fixes #54386. Change-Id: I78747da337ed6129e4f7426dd0483a644bed82e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/460216 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: hopehook <hopehook@golangcn.org> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-01-20context: add APIs for setting a cancelation cause when deadline or timer expiresSameer Ajmani
Fixes #56661 Change-Id: I1c23ebc52e6b7ae6ee956614e1a0a45d6ecbd5b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/449318 Run-TryBot: Sameer Ajmani <sameer@golang.org> Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-19runtime: replace panic(nil) with panic(new(runtime.PanicNilError))Russ Cox
Long ago we decided that panic(nil) was too unlikely to bother making a special case for purposes of recover. Unfortunately, it has turned out not to be a special case. There are many examples of code in the Go ecosystem where an author has written panic(nil) because they want to panic and don't care about the panic value. Using panic(nil) in this case has the unfortunate behavior of making recover behave as though the goroutine isn't panicking. As a result, code like: func f() { defer func() { if err := recover(); err != nil { log.Fatalf("panicked! %v", err) } }() call1() call2() } looks like it guarantees that call2 has been run any time f returns, but that turns out not to be strictly true. If call1 does panic(nil), then f returns "successfully", having recovered the panic, but without calling call2. Instead you have to write something like: func f() { done := false defer func() { if err := recover(); !done { log.Fatalf("panicked! %v", err) } }() call1() call2() done = true } which defeats nearly the whole point of recover. No one does this, with the result that almost all uses of recover are subtly broken. One specific broken use along these lines is in net/http, which recovers from panics in handlers and sends back an HTTP error. Users discovered in the early days of Go that panic(nil) was a convenient way to jump out of a handler up to the serving loop without sending back an HTTP error. This was a bug, not a feature. Go 1.8 added panic(http.ErrAbortHandler) as a better way to access the feature. Any lingering code that uses panic(nil) to abort an HTTP handler without a failure message should be changed to use http.ErrAbortHandler. Programs that need the old, unintended behavior from net/http or other packages can set GODEBUG=panicnil=1 to stop the run-time error. Uses of recover that want to detect panic(nil) in new programs can check for recover returning a value of type *runtime.PanicNilError. Because the new GODEBUG is used inside the runtime, we can't import internal/godebug, so there is some new machinery to cross-connect those in this CL, to allow a mutable GODEBUG setting. That won't be necessary if we add any other mutable GODEBUG settings in the future. The CL also corrects the handling of defaulted GODEBUG values in the runtime, for #56986. Fixes #25448. Change-Id: I2b39c7e83e4f7aa308777dabf2edae54773e03f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/461956 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org>
2022-12-07api: promote next to go1.20Michael Pratt
Change-Id: I180f262837b164095f9ac9459d900ec1ac0585a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/455697 Reviewed-by: Jenny Rakoczy <jenny@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-12-02cmd/api: track darwin arm64 portRuss Cox
The darwin arm64 port was added in Go 1.16 and is a first-class port, so it should be tracked by cmd/api. This CL does that, backfilling API files as needed. It also removes a spurious cgo.Incomplete API feature. Change-Id: Idd995677915e81bf1c2e09be65b31e084b75f668 Reviewed-on: https://go-review.googlesource.com/c/go/+/453260 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-12-02cmd/api: track deprecationsRuss Cox
Deprecating an API creates notices that go out to potentially millions of Go developers encouraging them to update their code. The choice to deprecate an API is as important as the choice to add a new API. We should track those and make them explicit. This will also ensure that deprecations go through proposal review. Change-Id: Ide9f60c32e5a88fb133e0dfedd984b8b0f70f510 Reviewed-on: https://go-review.googlesource.com/c/go/+/453259 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-12-01go/types, types2: make the new comparable semantics the defaultRobert Griesemer
Ordinary interface types now satisfy comparable constraints. This is a fully backward-compatible change: it simply permits additional code to be valid that wasn't valid before. This change makes the new comparable semantics the default behavior, depending on the Go -lang version. It also renames the flag types2.Config.AltComparableSemantics to types2.Config.OldComparableSemantics and inverts its meaning (or types.Config.oldComparableSemantics respectively). Add new predicate Satisfies (matching the predicate Implements but for constraint satisfaction), per the proposal description. Adjust some existing tests by setting -oldComparableSemantics and add some new tests that verify version-dependent behavior. The compiler flag -oldcomparable may be used to temporarily switch back to the Go 1.18/1.19 behavior should this change cause problems, or to identify that a problem is unrelated to this change. The flag will be removed for Go 1.21. For #52509. For #56548. For #57011. Change-Id: I8b3b3d9d492fc24b0693567055f0053ccb5aeb42 Reviewed-on: https://go-review.googlesource.com/c/go/+/454575 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2022-11-21crypto/ed25519: implement Ed25519ctx and Ed25519ph with contextFilippo Valsorda
This is missing a test for Ed25519ph with context, since the RFC doesn't provide one. Fixes #31804 Change-Id: I20947374c51c6b22fb2835317d00edf816c9a2d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/404274 Auto-Submit: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-11-19crypto/ecdsa,crypto/x509: add encoding paths for NIST crypto/ecdh keysFilippo Valsorda
Fixes #56088 Updates #52221 Change-Id: Id2f806a116100a160be7daafc3e4c0be2acdd6a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/450816 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-11-18crypto/x509: implement SetFallbackRootsRoland Shoemaker
Adds a method which allows users to set a fallback certificate pool for usage during verification if the system certificate pool is empty. Updates #43958 Change-Id: I279dd2f753743bce19790f2ae29f063c89c9359d Reviewed-on: https://go-review.googlesource.com/c/go/+/449235 Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2022-11-18crypto/tls: add CertificateVerificationError to tls handshakeGabor Tanz
Fixes #48152 Change-Id: I503f088edeb5574fd5eb5905bff7c3c23b2bc8fc GitHub-Last-Rev: 2b0e982f3f6bca33062b0bbd64ed1804801e2c13 GitHub-Pull-Request: golang/go#56686 Reviewed-on: https://go-review.googlesource.com/c/go/+/449336 Run-TryBot: Roland Shoemaker <roland@golang.org> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-11-16archive/tar, archive/zip: return ErrInsecurePath for unsafe pathsDamien Neil
Return a distinguishable error when reading an archive file with a path that is: - absolute - escapes the current directory (../a) - on Windows, a reserved name such as NUL Users may ignore this error and proceed if they do not need name sanitization or intend to perform it themselves. Fixes #25849 Fixes #55356 Change-Id: Ieefa163f00384bc285ab329ea21a6561d39d8096 Reviewed-on: https://go-review.googlesource.com/c/go/+/449937 Reviewed-by: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Damien Neil <dneil@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-11-16path/filepath: add IsLocalDamien Neil
IsLocal reports whether a path lexically refers to a location contained within the directory in which it is evaluated. It identifies paths that are absolute, escape a directory with ".." elements, and (on Windows) paths that reference reserved device names. For #56219. Change-Id: I35edfa3ce77b40b8e66f1fc8e0ff73cfd06f2313 Reviewed-on: https://go-review.googlesource.com/c/go/+/449239 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org>
2022-11-16crypto/ecdh: move ECDH method to PrivateKeyFilippo Valsorda
Fixes #56052 Change-Id: Icacba0ed0f77519bca2140c8af68407af97f9734 Reviewed-on: https://go-review.googlesource.com/c/go/+/450335 Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org>
2022-11-15sync: add new Map method Swap, CompareAndSwap, CompareAndDeleteChangkun Ou
name time/op SwapCollision/*sync_test.DeepCopyMap-8 235ns ± 0% SwapCollision/*sync_test.RWMutexMap-8 145ns ± 0% SwapCollision/*sync.Map-8 153ns ± 0% SwapMostlyHits/*sync_test.DeepCopyMap-8 48.2µs ± 0% SwapMostlyHits/*sync_test.RWMutexMap-8 190ns ± 0% SwapMostlyHits/*sync.Map-8 28.3ns ± 0% SwapMostlyMisses/*sync_test.DeepCopyMap-8 681ns ± 0% SwapMostlyMisses/*sync_test.RWMutexMap-8 336ns ± 0% SwapMostlyMisses/*sync.Map-8 523ns ± 0% CompareAndSwapCollision/*sync_test.DeepCopyMap-8 3.99ns ± 0% CompareAndSwapCollision/*sync_test.RWMutexMap-8 151ns ± 0% CompareAndSwapCollision/*sync.Map-8 21.6ns ± 0% CompareAndSwapNoExistingKey/*sync_test.DeepCopyMap-8 3.95ns ± 0% CompareAndSwapNoExistingKey/*sync_test.RWMutexMap-8 126ns ± 0% CompareAndSwapNoExistingKey/*sync.Map-8 6.11ns ± 0% CompareAndSwapValueNotEqual/*sync_test.DeepCopyMap-8 2.15ns ± 0% CompareAndSwapValueNotEqual/*sync_test.RWMutexMap-8 132ns ± 0% CompareAndSwapValueNotEqual/*sync.Map-8 5.32ns ± 0% CompareAndSwapMostlyHits/*sync_test.RWMutexMap-8 219ns ± 0% CompareAndSwapMostlyHits/*sync.Map-8 27.1ns ± 0% CompareAndSwapMostlyMisses/*sync_test.DeepCopyMap-8 13.0ns ± 0% CompareAndSwapMostlyMisses/*sync_test.RWMutexMap-8 147ns ± 0% CompareAndSwapMostlyMisses/*sync.Map-8 19.6ns ± 0% CompareAndDeleteCollision/*sync_test.DeepCopyMap-8 2.23ns ± 0% CompareAndDeleteCollision/*sync_test.RWMutexMap-8 131ns ± 0% CompareAndDeleteCollision/*sync.Map-8 16.2ns ± 0% CompareAndDeleteMostlyHits/*sync_test.RWMutexMap-8 367ns ± 0% CompareAndDeleteMostlyHits/*sync.Map-8 33.1ns ± 0% CompareAndDeleteMostlyMisses/*sync_test.DeepCopyMap-8 8.75ns ± 0% CompareAndDeleteMostlyMisses/*sync_test.RWMutexMap-8 134ns ± 0% CompareAndDeleteMostlyMisses/*sync.Map-8 10.9ns ± 0% name alloc/op SwapCollision/*sync_test.DeepCopyMap-8 336B ± 0% SwapCollision/*sync_test.RWMutexMap-8 0.00B SwapCollision/*sync.Map-8 16.0B ± 0% SwapMostlyHits/*sync_test.DeepCopyMap-8 82.1kB ± 0% SwapMostlyHits/*sync_test.RWMutexMap-8 12.0B ± 0% SwapMostlyHits/*sync.Map-8 28.0B ± 0% SwapMostlyMisses/*sync_test.DeepCopyMap-8 713B ± 0% SwapMostlyMisses/*sync_test.RWMutexMap-8 23.0B ± 0% SwapMostlyMisses/*sync.Map-8 129B ± 0% CompareAndSwapCollision/*sync_test.DeepCopyMap-8 0.00B CompareAndSwapCollision/*sync_test.RWMutexMap-8 0.00B CompareAndSwapCollision/*sync.Map-8 3.00B ± 0% CompareAndSwapNoExistingKey/*sync_test.DeepCopyMap-8 8.00B ± 0% CompareAndSwapNoExistingKey/*sync_test.RWMutexMap-8 8.00B ± 0% CompareAndSwapNoExistingKey/*sync.Map-8 8.00B ± 0% CompareAndSwapValueNotEqual/*sync_test.DeepCopyMap-8 0.00B CompareAndSwapValueNotEqual/*sync_test.RWMutexMap-8 0.00B CompareAndSwapValueNotEqual/*sync.Map-8 0.00B CompareAndSwapMostlyHits/*sync_test.RWMutexMap-8 18.0B ± 0% CompareAndSwapMostlyHits/*sync.Map-8 33.0B ± 0% CompareAndSwapMostlyMisses/*sync_test.DeepCopyMap-8 24.0B ± 0% CompareAndSwapMostlyMisses/*sync_test.RWMutexMap-8 23.0B ± 0% CompareAndSwapMostlyMisses/*sync.Map-8 23.0B ± 0% CompareAndDeleteCollision/*sync_test.DeepCopyMap-8 0.00B CompareAndDeleteCollision/*sync_test.RWMutexMap-8 0.00B CompareAndDeleteCollision/*sync.Map-8 0.00B CompareAndDeleteMostlyHits/*sync_test.RWMutexMap-8 23.0B ± 0% CompareAndDeleteMostlyHits/*sync.Map-8 39.0B ± 0% CompareAndDeleteMostlyMisses/*sync_test.DeepCopyMap-8 16.0B ± 0% CompareAndDeleteMostlyMisses/*sync_test.RWMutexMap-8 15.0B ± 0% CompareAndDeleteMostlyMisses/*sync.Map-8 15.0B ± 0% name allocs/op SwapCollision/*sync_test.DeepCopyMap-8 2.00 ± 0% SwapCollision/*sync_test.RWMutexMap-8 0.00 SwapCollision/*sync.Map-8 1.00 ± 0% SwapMostlyHits/*sync_test.DeepCopyMap-8 4.00 ± 0% SwapMostlyHits/*sync_test.RWMutexMap-8 1.00 ± 0% SwapMostlyHits/*sync.Map-8 2.00 ± 0% SwapMostlyMisses/*sync_test.DeepCopyMap-8 6.00 ± 0% SwapMostlyMisses/*sync_test.RWMutexMap-8 2.00 ± 0% SwapMostlyMisses/*sync.Map-8 6.00 ± 0% CompareAndSwapCollision/*sync_test.DeepCopyMap-8 0.00 CompareAndSwapCollision/*sync_test.RWMutexMap-8 0.00 CompareAndSwapCollision/*sync.Map-8 0.00 CompareAndSwapNoExistingKey/*sync_test.DeepCopyMap-8 1.00 ± 0% CompareAndSwapNoExistingKey/*sync_test.RWMutexMap-8 0.00 CompareAndSwapNoExistingKey/*sync.Map-8 1.00 ± 0% CompareAndSwapValueNotEqual/*sync_test.DeepCopyMap-8 0.00 CompareAndSwapValueNotEqual/*sync_test.RWMutexMap-8 0.00 CompareAndSwapValueNotEqual/*sync.Map-8 0.00 CompareAndSwapMostlyHits/*sync_test.RWMutexMap-8 2.00 ± 0% CompareAndSwapMostlyHits/*sync.Map-8 3.00 ± 0% CompareAndSwapMostlyMisses/*sync_test.DeepCopyMap-8 2.00 ± 0% CompareAndSwapMostlyMisses/*sync_test.RWMutexMap-8 2.00 ± 0% CompareAndSwapMostlyMisses/*sync.Map-8 2.00 ± 0% CompareAndDeleteCollision/*sync_test.DeepCopyMap-8 0.00 CompareAndDeleteCollision/*sync_test.RWMutexMap-8 0.00 CompareAndDeleteCollision/*sync.Map-8 0.00 CompareAndDeleteMostlyHits/*sync_test.RWMutexMap-8 2.00 ± 0% CompareAndDeleteMostlyHits/*sync.Map-8 3.00 ± 0% CompareAndDeleteMostlyMisses/*sync_test.DeepCopyMap-8 2.00 ± 0% CompareAndDeleteMostlyMisses/*sync_test.RWMutexMap-8 1.00 ± 0% CompareAndDeleteMostlyMisses/*sync.Map-8 1.00 ± 0% Fixes #51972 Change-Id: I469e71033592997832c3e8ebdad1b8950a70c99c Reviewed-on: https://go-review.googlesource.com/c/go/+/399094 Run-TryBot: Changkun Ou <mail@changkun.de> Reviewed-by: Joedian Reid <joedian@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-11-10net/http: add ResponseController and per-handler timeoutsDamien Neil
The ResponseController type provides a discoverable interface to optional methods implemented by ResponseWriters. c := http.NewResponseController(w) c.Flush() vs. if f, ok := w.(http.Flusher); ok { f.Flush() } Add the ability to control per-request read and write deadlines via the ResponseController SetReadDeadline and SetWriteDeadline methods. For #54136 Change-Id: I3f97de60d4c9ff150cda559ef86c6620eee665d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/436890 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Damien Neil <dneil@google.com>
2022-11-09crypto: allow hash.Hash for OAEP and MGF1 to be specified independentlyAleks Rudzitis
crypto/rsa assumes RSA OAEP uses the same hash to be used for both the label and the mask generation function. However, implementations in other languages, such as Java and Python, allow these parameters to be specified independently. This change allows the MGF hash to be specified independently for decrypt operations in order to allow decrypting ciphertexts generated in other environments. Fixes: #19974 Change-Id: If453d628f0da354ceb3b52863f30087471670f7b Reviewed-on: https://go-review.googlesource.com/c/go/+/418874 Auto-Submit: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org>
2022-11-09api/next/54299: add missing newlineBryan C. Mills
Updates #54299. Change-Id: I20a9191fa3c78810987ace69527d34091c4a42fb Reviewed-on: https://go-review.googlesource.com/c/go/+/449215 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-09net/http: add Transport.OnProxyConnectResponsecuiweixie
Fixes #54299 Change-Id: I3a29527bde7ac71f3824e771982db4257234e9ef Reviewed-on: https://go-review.googlesource.com/c/go/+/447216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: xie cui <523516579@qq.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2022-11-08context: add APIs for writing and reading cancelation causeSameer Ajmani
Extend the context package to allow users to specify why a context was canceled in the form of an error, the "cause". Users write the cause by calling WithCancelCause to construct a derived context, then calling cancel(cause) to cancel the context with the provided cause. Users retrieve the cause by calling context.Cause(ctx), which returns the cause of the first cancelation for ctx or any of its parents. The cause is implemented as a field of cancelCtx, since only cancelCtx can be canceled. Calling cancel copies the cause to all derived (child) cancelCtxs. Calling Cause(ctx) finds the nearest parent cancelCtx by looking up the context value keyed by cancelCtxKey. API changes: +pkg context, func Cause(Context) error +pkg context, func WithCancelCause(Context) (Context, CancelCauseFunc) +pkg context, type CancelCauseFunc func(error) Fixes #26356 Fixes #51365 Change-Id: I15b62bd454c014db3f4f1498b35204451509e641 Reviewed-on: https://go-review.googlesource.com/c/go/+/375977 Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Sameer Ajmani <sameer@golang.org> Auto-Submit: Sameer Ajmani <sameer@golang.org>
2022-11-04api: add newline to 55301.txtcuiweixie
Change-Id: I9bcaba0ca9c30b204bf126dbfec4cd48d9ebe2ea Reviewed-on: https://go-review.googlesource.com/c/go/+/447896 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Auto-Submit: Than McIntosh <thanm@google.com> Run-TryBot: xie cui <523516579@qq.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-04net: add ControlContext to Dialercuiweixie
Fixes #55301 Change-Id: Ie8abcd383eee9af75038bde908ac638f43d33b7e Reviewed-on: https://go-review.googlesource.com/c/go/+/444955 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: xie cui <523516579@qq.com>
2022-11-02cmd/api: make check pickier about api/*.txtRuss Cox
We don't have a formatter for these files, so check here that they are in the right form to allow 'cat next/*.txt >go1.X.txt' at the end of each cycle. Fix the api files that the check finds. Change-Id: I0c5e4ab11751c7d0afce32503131d487313f41c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/431335 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-02regexp: add ErrLarge errorcuiweixie
For #56041 Change-Id: I6c98458b5c0d3b3636a53ee04fc97221f3fd8bbc Reviewed-on: https://go-review.googlesource.com/c/go/+/444817 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: xie cui <523516579@qq.com>
2022-10-25os/exec: add the Cancel and WaitDelay fieldsBryan C. Mills
Fixes #50436. Change-Id: I9dff8caa317a04b7b2b605f810b8f12ef8ca485d Reviewed-on: https://go-review.googlesource.com/c/go/+/401835 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-24crypto/ed25519: implement Ed25519ph in Sign and VerifyWithOptionsFilippo Valsorda
Updates #31804 Change-Id: I5a48dfc57401576902674aff20b557e4a8ce8ab8 Reviewed-on: https://go-review.googlesource.com/c/go/+/373076 Reviewed-by: Filippo Valsorda <valsorda@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-10-21net/netip: add IPv6LinkLocalAllRouters and IPv6LoopbackMatt Layher
Fixes #51766 Fixes #51777 Change-Id: I0510175c20c06442d78b2581cfe218e66be1c35b Reviewed-on: https://go-review.googlesource.com/c/go/+/412475 Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matt Layher <mdlayher@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Auto-Submit: Damien Neil <dneil@google.com>
2022-10-15reflect: add Value.GrowJoe Tsai
The Grow method is like the proposed slices.Grow function in that it ensures that the slice has enough capacity to append n elements without allocating. The implementation of Grow is a thin wrapper over runtime.growslice. This also changes Append and AppendSlice to use growslice under the hood. Fixes #48000 Change-Id: I992a58584a2ff1448c1c2bc0877fe76073609111 Reviewed-on: https://go-review.googlesource.com/c/go/+/389635 Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-05runtime/coverage: revise/shorten function namesThan McIntosh
Use shorter more Go-like names for the new APIs being added in the runtime/coverage package for writing coverage data under user control from server programs. Old names were a bit too clunky/verbose. Updates #51430. Change-Id: Ifdd5b882a88613c7c4342b40ed93b58547483c77 Reviewed-on: https://go-review.googlesource.com/c/go/+/438503 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29debug/elf: fix typo in R_PPC64_TPREL34 and R_PPC64_DTPREL34Paul E. Murphy
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-29errors, fmt: add support for wrapping multiple errorsDamien Neil
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-29runtime/coverage: apis to emit counter data under user controlThan McIntosh
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-28go/ast: record start and end of file in File.File{Start,End}Alan Donovan
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-19time: implement Compare methodRoger Peppe
Fixes #50770. Change-Id: If0104883bb409ec85827fa5b570f68099ad4fd1d Reviewed-on: https://go-review.googlesource.com/c/go/+/382734 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: hopehook <hopehook@golangcn.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-16syscall: remove FreeBSD 11 and below 64bit inode compatibility shimsYuval Pavel Zholkover
Update #53280 Change-Id: Iaa7c0cf5dbefaa8e14c2de499f99755911c17672 Reviewed-on: https://go-review.googlesource.com/c/go/+/411596 Reviewed-by: Meng Zhuo <mzh@golangcn.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com> Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-09syscall: add CgroupFD support for ForkExec on LinuxKir Kolyshkin
Implement CLONE_INTO_CGROUP feature, allowing to put a child in a specified cgroup in a clean and simple way. Note that the feature only works for cgroup v2, and requires Linux kernel 5.7 or newer. Using the feature requires a new syscall, clone3. Currently this is the only reason to use clone3, but the code is structured in a way so that other cases may be easily added in the future. Add a test case. While at it, try to simplify the syscall calling code in forkAndExecInChild1, which became complicated over time because: 1. It was using either rawVforkSyscall or RawSyscall6 depending on whether CLONE_NEWUSER was set. 2. On Linux/s390, the first two arguments to clone(2) system call are swapped (which deserved a mention in Linux ABI hall of shame). It was worked around in rawVforkSyscall on s390, but had to be implemented via a switch/case when using RawSyscall6, making the code less clear. Let's - modify rawVforkSyscall to have two arguments (which is also required for clone3); - remove the arguments workaround from s390 asm, instead implementing arguments swap in the caller (which still looks ugly but at least it's done once and is clearly documented now); - use rawVforkSyscall for all cases (since it is essentially similar to RawSyscall6, except for having less parameters, not returning r2, and saving/restoring the return address before/after syscall on 386 and amd64). Updates #51246. Change-Id: Ifcd418ebead9257177338ffbcccd0bdecb94474e Reviewed-on: https://go-review.googlesource.com/c/go/+/417695 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-08debug/elf: define additional PPC64 ELFv2 relocationsPaul E. Murphy
The PPC64 ELFv2 supplement version 1.5 defines a handful of new relocation types, similarly some were not added. Fixes #54345 Change-Id: Id39b29d404298fca4a10ccf1e96b5964dc452c9e Reviewed-on: https://go-review.googlesource.com/c/go/+/425555 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-05go/ast: add Range token.Pos to RangeStmtcuiweixie
For #50429 Change-Id: Idb027244f901d9f482c894b5b979a054d0f07de5 Reviewed-on: https://go-review.googlesource.com/c/go/+/426091 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
2022-08-28cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheapCuong Manh Le
Updates #46731 Change-Id: Ia83f27c177cc2f57e240cb5c6708d4552423f5be Reviewed-on: https://go-review.googlesource.com/c/go/+/421879 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>