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

60619 Commits

Author SHA1 Message Date
withsky
fc51e5023e math/big: fix comment typo in natdiv.go
Comment in line 395:
[x₀ < S, so S - x₀ < 0; drop it]
Should be:
[x₀ < S, so S - x₀ > 0; drop it]

The proof is based on S - x₀ > 0, thus it's a typo of comment.

Fixes #68466

Change-Id: I68bb7cb909ba2bfe02a8873f74b57edc6679b72a
GitHub-Last-Rev: 40a2fc80cf
GitHub-Pull-Request: golang/go#68487
Reviewed-on: https://go-review.googlesource.com/c/go/+/598855
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2024-07-17 15:08:04 +00:00
Zxilly
90c6558b6a internal/bytealg: extend memchr result correctly on wasm
The mem address should be regarded as uint32.

Fixes #65571

Change-Id: Icee38d11f2d93eeca7d50b2e133159e321daeb90
GitHub-Last-Rev: c2568b1043
GitHub-Pull-Request: golang/go#68400
Reviewed-on: https://go-review.googlesource.com/c/go/+/597955
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-17 07:00:20 +00:00
Than McIntosh
355711821e cmd/internal/cov: close counter data files eagerly
When reading the counter data files from a given pod, close the
underlying *os.File immediately after each one is read, as opposed to
using a deferred close in the loop (which will close them all at the
end of the function). Doing things this way avoids running into "too
many open files" when processing large clumps of counter data files.

Fixes #68468.

Change-Id: Ic1fe1d36c44d3f5d7318578cd18d0e65465d71d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/598735
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-16 20:20:05 +00:00
Kir Kolyshkin
f2bcab5fb3 regexp: more cross-references in docstrings
Change-Id: I93f617bb6d82b00d44ce9a54c2ddcc8a61209783
Reviewed-on: https://go-review.googlesource.com/c/go/+/597776
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2024-07-16 20:07:41 +00:00
Kir Kolyshkin
9915b87059 bytes: more cross-references in docstrings
Change-Id: Iea0243edcf8bf73ce325695178a3ea5cfe420d31
Reviewed-on: https://go-review.googlesource.com/c/go/+/597775
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>
2024-07-16 18:17:37 +00:00
Kir Kolyshkin
97ccc224f1 math/big: use lists in docstrings
This looks way better than the code formatting.

Similar to CL 597656.

Change-Id: I2c8809c1d6f8a8387941567213880662ff649a73
Reviewed-on: https://go-review.googlesource.com/c/go/+/597659
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>
2024-07-16 18:17:35 +00:00
Kir Kolyshkin
66e940b6f8 math/big: more cross-references in docstrings
Change-Id: I3541859bbf3ac4f9317b82a66d21be3d5c4c5a84
Reviewed-on: https://go-review.googlesource.com/c/go/+/597658
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-16 18:17:32 +00:00
Kir Kolyshkin
0dae393a26 encoding/binary: use list format in docstrings
This looks way better than the code formatting.

Similar to CL 597656.

Change-Id: If404c952ece384aea096f2394bd475a601627a79
Reviewed-on: https://go-review.googlesource.com/c/go/+/597657
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-16 18:17:30 +00:00
Kir Kolyshkin
451a284d80 strings,bytes,regexp: use lists in Split* docstrings
This looks better than the default of using a code block.
While at it, fix punctuation.

Change-Id: I86abca4da1e9999b7e9043e615ad0988d35a5a46
Reviewed-on: https://go-review.googlesource.com/c/go/+/597656
Reviewed-by: Cherry Mui <cherryyz@google.com>
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>
2024-07-16 18:17:26 +00:00
Clide Stefani
b4a92f56ff crypto/tls: add exclude tls flags to bogo_shim_test
The existing implementation of bogo_shim_test does not support tests
that use the -no-tls1, -no-tls11, or -no-tls12 flags.
This change adds support for these flags.

Updates #51434

Change-Id: I43eaea9f5ec6da6811b150630a7dde24d108017e
Reviewed-on: https://go-review.googlesource.com/c/go/+/595775
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-07-16 18:17:19 +00:00
Sean Liao
3bfbfa821f encoding/json: document compact json output in Encoder.Encode
Using the same wording as Compact.

Fixes #67943

Change-Id: I578874f3e917bba1634dd988895e622a5ac78c74
Reviewed-on: https://go-review.googlesource.com/c/go/+/597976
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: Cherry Mui <cherryyz@google.com>
2024-07-16 18:06:21 +00:00
Sean Liao
d5479e197d net: document ParseIP always returns IPv6 addresses
Fixes #65131

Change-Id: I050c6459a8e0a6c99425759d3131cf775b05aac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/598076
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-16 18:03:01 +00:00
Sean Liao
5c7f541386 archive/zip: document handling of duplicate names in Writer.Create
Fixes #66810

Change-Id: I6a7848dce245ae14941d61d2f78abaf0dc5c1247
Reviewed-on: https://go-review.googlesource.com/c/go/+/597978
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-16 18:02:59 +00:00
cui fliter
6b97448132 sort: add example for Find
Change-Id: Id7b12356dd2114dfbab260cff00114b6055ee011
Reviewed-on: https://go-review.googlesource.com/c/go/+/561175
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
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>
2024-07-16 17:55:15 +00:00
Cuong Manh Le
8b48290895 cmd/compile: fix recursive generic interface instantiation
When shapifying recursive instantiated types, the compiler ends up
leaving the type as-is if it already has been a shape type. However, if
both of type arguments are interfaces, and one of them is a recursive
one, it ends up being shaped as-is, while the other is shaped to its
underlying, causing mismatch in function signature.

Fixing this by shapifying an interface type as-is, if it is fully
instantiated and already been a shape type.

Fixes #65362
Fixes #66663

Change-Id: I839d266e0443b41238b1b7362aca09adc0177362
Reviewed-on: https://go-review.googlesource.com/c/go/+/559656
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-07-16 16:43:30 +00:00
Miki Tebeka
959b3fd426 flag: add FlagSet example
Add an example for using FlagSet.

Fixes #36307

Change-Id: I0bf5805bd836a4f2e9632aafe22dc3eeb1164dcd
GitHub-Last-Rev: 79e53040cb
GitHub-Pull-Request: golang/go#64443
Reviewed-on: https://go-review.googlesource.com/c/go/+/545736
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Christopher Taylor <ccmtaylor@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2024-07-15 21:12:53 +00:00
Cherry Mui
6948b4df8c Revert "runtime: avoid multiple records with identical stacks from MutexProfile"
This reverts CL 595966.

Reason for revert: This CL contains a bug. See the comment in https://go-review.googlesource.com/c/go/+/595966/8#message-57f4c1f9570b5fe912e06f4ae3b52817962533c0

Change-Id: I48030907ded173ae20a8965bf1b41a713dd06059
Reviewed-on: https://go-review.googlesource.com/c/go/+/598219
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-07-15 20:09:02 +00:00
Cuong Manh Le
8f1ec59bdb strings: re-introduce noescape wrapper
CL 573955 added internal/abi:NoEscape function, and use it in strings
builder copyCheck code.

However, internal/abi is a runtime package, which can not be built with
-d=checkptr flag yet. This causes incorrect inlining decision, since
NoEscape must not be inlined when -d=checkptr is used.

Fixing this by re-introducing noescape wrapper.

Fixes #68415

Change-Id: I776cab4c9e9e4b3e58162dcce6ec025cb366bdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/598295
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-15 17:08:26 +00:00
Sean Liao
5d36bc18d5 net/http: document io.Seeker requirement for fs.FS arguments
Using the same wording as http.FS, even though it's not strictly
required if a content type can be determined by file extension.

Fixes #66877
Updates #44553

Change-Id: I7b70c10909bdd289a57d1998a565262b8aaf2dd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/597977
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: 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>
2024-07-15 16:32:33 +00:00
Rob Findley
071b8d51c1 cmd: vendor golang.org/x/telemetry@268b4a8ec2d7
Commands run, from cmd:
  go get golang.org/x/telemetry@268b4a8ec2d7
  go mod tidy
  go mod vendor

Commands run, from std (to keep versions consistent):
  go get golang.org/x/sys@v0.22.0
  go mod tidy
  go mod vendor

Fixes #67617

Change-Id: I65e759c9b03443619a2a7acbeba53694ff5bbf6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/597896
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-12 22:42:17 +00:00
Tim King
4e77872d16 go/types: fix assertion failure when range over int is not permitted
Fixes an assertion failure in Checker.rangeStmt that range over int
only has a key type and no value type. When allowVersion failed,
rangeKeyVal returns Typ[Invalid] for the value instead of nil. When
Config.Error != nil, rangeStmt proceeded. The check for rhs[1]==nil
was not enough to catch this case. It must also check rhs[1]==

Updates #68334

Change-Id: Iffa1b2f7b6a94570ec50b8c6603e727a45ba3357
Reviewed-on: https://go-review.googlesource.com/c/go/+/597356
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-12 18:39:52 +00:00
Joel Sing
8bc32ab6b1 os: clean up after TestIssue60181
This test currently leaves two temp files lying around - ensure these
are created in the current working directory (a temp dir) so that they
get cleaned up when the test is complete.

Change-Id: I9a29e24a2cd601de3ab39c421830ee2bcda76516
Reviewed-on: https://go-review.googlesource.com/c/go/+/597317
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-12 16:31:06 +00:00
Ian Lance Taylor
b31e9a63a4 unsafe: say "functions like syscall.Syscall", not only Syscall
Fixes #68301

Change-Id: I9d7f623370705ab2ad4c49489b5a89162467f22a
Reviewed-on: https://go-review.googlesource.com/c/go/+/596936
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-11 23:38:31 +00:00
cuishuang
a71bb570d0 all: make struct comments match struct names
Change-Id: I011f66854a9af5f3baa20abebd4b315c15db571f
Reviewed-on: https://go-review.googlesource.com/c/go/+/596715
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: shuang cui <imcusg@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-11 17:23:45 +00:00
Kir Kolyshkin
611f18c4e9 strings: more cross-references in docstrings
This amends CL 534775.

Change-Id: I25a217da51853ec29106998e19e9386d756902fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/597655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-11 15:01:18 +00:00
Jonathan Hall
08a6e080ca database/sql/driver: fix name in comment
DefaultValueConverter => DefaultParameterConverter

Change-Id: I0e726cfdbf21a5e00928899d1fd9144f89dcb805
Reviewed-on: https://go-review.googlesource.com/c/go/+/555235
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Shay Nehmad <dude500@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-11 15:01:00 +00:00
Diogo Pinela
dfaaa91f05 os: clarify that IsNotExist, IsExist, IsPermission and IsTimeout work with nil errors
Referring to these functions' parameter as "*the* error" could be taken
to imply that a non-nil error from elsewhere is expected; referring to
it as "its argument" avoids that ambiguity.

Fixes #31065

Change-Id: I117892dd53fff6f92d11a416e4abedee5d2f9337
Reviewed-on: https://go-review.googlesource.com/c/go/+/170077
Reviewed-by: Rob Pike <r@golang.org>
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: Jonathan Amsterdam <jba@google.com>
2024-07-11 00:10:03 +00:00
Clide Stefani
5881d857c5 crypto/tls: add support for -expect-no-hrr to bogo_shim_test
The existing implementation of bogo_shim_test does not support tests
that use the expect-no-hrr flag. This change adds support for this flag.

Updates #51434

Change-Id: Iadb38fc2262783cab144a7b52904d0443e7fc2c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/594835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2024-07-10 19:39:51 +00:00
Jorropo
b3040679ad math: remove riscv64 assembly implementations of rounding
Fixes #68322

This reverts commit ad377e906a.

Change-Id: Ifa4811e2c679d789cc830dbff5e50301410e24d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/596516
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-10 03:19:58 +00:00
Sean Liao
70e453b436 context: handle nil values for valueCtx.String()
Fixes #68356

Change-Id: I57dc089a99f545e29a6759a8db5e28fabb6d1a61
Reviewed-on: https://go-review.googlesource.com/c/go/+/597415
Commit-Queue: 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>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-10 02:44:20 +00:00
Nick Ripley
183a40db6d runtime: avoid multiple records with identical stacks from MutexProfile
When using frame pointer unwinding, we defer frame skipping and inline
expansion for call stacks until profile reporting time. We can end up
with records which have different stacks if no frames are skipped, but
identical stacks once skipping is taken into account. Returning multiple
records with the same stack (but different values) has broken programs
which rely on the records already being fully aggregated by call stack
when returned from runtime.MutexProfile. This CL addresses the problem
by handling skipping at recording time. We do full inline expansion to
correctly skip the desired number of frames when recording the call
stack, and then handle the rest of inline expansion when reporting the
profile.

The regression test in this CL is adapted from the reproducer in
https://github.com/grafana/pyroscope-go/issues/103, authored by Tolya
Korniltsev.

Fixes #67548

Co-Authored-By: Tolya Korniltsev <korniltsev.anatoly@gmail.com>
Change-Id: I6a42ce612377f235b2c8c0cec9ba8e9331224b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/595966
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
2024-07-09 21:41:42 +00:00
Clide Stefani
e89e880eac crypto/tls: add support for -reject-alpn and -decline-alpn flags to bogo_shim_test
The existing implementation of bogo_shim_test does not support tests
which use the reject-alpn or the decline-alpn flag.
This change adds support for these flags in bogo_shim_test.

Updates #51434
Updates #46310

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I3ff23ff4edd8f4c6c37ee6c9f2ee4689066c4e00
Reviewed-on: https://go-review.googlesource.com/c/go/+/592198
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-09 16:14:04 +00:00
Manuel Sabin
73186ba002 crypto/internal/cryptotest: add common tests for the hash.Hash interface
This CL creates the cryptotest package to host a suite of tests
for interfaces that are implemented in the crypto package.  This CL
includes a set of tests for the hash.Hash interface, and calls these tests from the tests of hash.Hash implementations in crypto/.

Tests for other interfaces will be included in subsequent CLs.

Updates #25309

Change-Id: Ic47086fd7f585e812c8b0d2186c50792c773781e
Reviewed-on: https://go-review.googlesource.com/c/go/+/592855
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2024-07-09 15:52:04 +00:00
Julian Dax
87ec2c959c testing: remove call to os.Exit in documentation for TestMain
In the example for the TestMain function, os.Exit was called explicitly,
which is no longer necessary since Go 1.15 (see change #219639).

Updates #34129

Change-Id: Ia8021de0d5699742adbb7ab6d28b11c841e596dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/596977
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-08 22:10:16 +00:00
Ian Lance Taylor
6d89b38ed8 unsafe: clarify when String bytes can be modified
They can be modified when the string returned by String no longer exists.

Fixes #68300

Change-Id: I526a068151f7aad1ab6827504b51a84e7399cafe
Reviewed-on: https://go-review.googlesource.com/c/go/+/596955
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-08 00:05:18 +00:00
qiulaidongfeng
5565462a86 cmd/dist: remove iter,slices,maps test on GOEXPERIMENT=rangefunc
In go1.23, don't need use GOEXPERIMENT=rangefunc enable range-over-func.

Change-Id: I88b799c4b38c8fbeed8d9f912a0c3c6c45c80e9d
GitHub-Last-Rev: 64fd4524f1
GitHub-Pull-Request: golang/go#68325
Reviewed-on: https://go-review.googlesource.com/c/go/+/596517
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-07 19:43:31 +00:00
Cuong Manh Le
b43d6c57de io: add test for Pipe constructor allocations
Updates #67633

Change-Id: If3da9317ba36cb8a7868db94b45c402e1793e018
Reviewed-on: https://go-review.googlesource.com/c/go/+/588219
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-07 19:43:22 +00:00
Dmitri Shuralyov
d0146bd85b os/exec: only use cachedLookExtensions if Cmd.Path is unmodified
Caching the invocation of lookExtensions on an absolute path in Command
and reusing the cached result in Start is only viable if Cmd.Path isn't
set to a different value after Command returns.

For #66586.
Fixes #68314.

Change-Id: I57007850aca2011b11344180c00faded737617b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/596875
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-07 16:40:57 +00:00
Cuong Manh Le
ad77cefeb2 cmd/compile: correct RewriteMultiValueCall fatal message
The function name was changed in CL 331470.

Change-Id: I6f41866a9c5ccce594dd84185ebfc1c5af280184
Reviewed-on: https://go-review.googlesource.com/c/go/+/596395
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-05 10:45:35 +00:00
Cuong Manh Le
be152920b9 cmd/compile: fix ICE when compiling global a, b = f()
CL 327651 rewrites a, b = f() to use temporaries when types are not
identical. That would leave OAS2 node appears in body of init function
for global variables initialization. The staticinit pass is not updated
to handle OAS2 node, causing ICE when compiling global variables.

To fix this, handle OAS2 nodes like other OAS2*, since they mostly
necessitate dynamic execution anyway.

Fixes #68264

Change-Id: I1eff8cc3e47035738a2c70d3169e35ec36ee9242
Reviewed-on: https://go-review.googlesource.com/c/go/+/596055
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-05 10:45:32 +00:00
Cherry Mui
82c14346d8 cmd/link: don't disable memory profiling when pprof.WriteHeapProfile is used
We have an optimization that if the memory profile is not consumed
anywhere, we set the memory profiling rate to 0 to disable the
"background" low-rate profiling. We detect whether the memory
profile is used by checking whether the runtime.MemProfile function
is reachable at link time. Previously, all APIs that access the
memory profile go through runtime.MemProfile. But the code was
refactored in CL 572396, and now the legacy entry point
WriteHeapProfile uses pprof_memProfileInternal without going
through runtime.MemProfile. In fact, even with the recommended
runtime/pprof.Profile API (pprof.Lookup or pprof.Profiles),
runtime.MemProfile is only (happen to be) reachable through
countHeap.

Change the linker to check runtime.memProfileInternal instead,
which is on all code paths that retrieve the memory profile. Add
a test case for WriteHeapProfile, so we cover all entry points.

Fixes #68136.

Change-Id: I075c8d45c95c81825a1822f032e23107aea4303c
Reviewed-on: https://go-review.googlesource.com/c/go/+/596538
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-03 22:43:11 +00:00
Ian Lance Taylor
7d19d508a9 cmd/cgo: read CGO_LDFLAGS environment variable
For #66456 we changed from the CGO_LDFLAGS environment variable to
the -ldflags option. This broke Bazel, which uses CGO_LDFLAGS.
So restore reading CGO_LDFLAGS for now.

For #66456

Change-Id: Iebdd8bde1c7c18da09c6370e284c7ac7fa08fc54
Reviewed-on: https://go-review.googlesource.com/c/go/+/596615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-03 19:02:39 +00:00
Cuong Manh Le
5f50b1e3bf cmd/compile: fix mis-compilation when switching over channels
CL 418101 changes Unified IR writer to force mixed tag/case to have
common type, emitting the implicit conversion if any of the case values
are not assignable to the tag value's type.

However, the Go spec definition of equality is non-transitive for
channels stored in interfaces, causing incorrect behavior with channel
values comparison.

To fix it, don't emit the implicit conversions if tag type is channel.

Fixes #67190

Change-Id: I9a29d9ce3c7978f0689e9502ba6f15660c763d16
Reviewed-on: https://go-review.googlesource.com/c/go/+/594575
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-03 18:07:19 +00:00
Cuong Manh Le
71f9dbb1e4 cmd/compile: emit error message on mismatch import path
Fixes #54542

Change-Id: I16cfb84fc54892923106d0a6f0b3ba810886d077
Reviewed-on: https://go-review.googlesource.com/c/go/+/596396
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-03 13:03:08 +00:00
Ian Lance Taylor
148755a27b cmd/link: document -checklinkname option
For #67401

Change-Id: I04bff1c942a4033325450c0b7dddc7980f3373cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/596216
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-03 00:14:52 +00:00
Darin Krauss
f12ac5be70 time: fix time zone parsing when format includes time zone seconds
The current implementation fails to parse a time string with a "Z"
time zone using a time format that includes time zone seconds. This
fix correctly parses the "Z" time zone for any Z-base time format
that includes seconds (i.e. "Z070000" or "Z07:00:00").

Fixes #68263

Change-Id: Idf8fa06b5f96383f050c4ffbd2bc5804fd408650
Reviewed-on: https://go-review.googlesource.com/c/go/+/595897
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: Than McIntosh <thanm@google.com>
2024-07-02 20:01:50 +00:00
Kir Kolyshkin
09aeb6e33a os: add TODO about removing test exception
TestChtimesOmit excludes the failure on DragonFly BSD when both
atime and mtime are omitted.

The relevant Dragonfly BSD bug is now fixed in git (see [1]).

Add a TODO comment to remove the exclusion from the test once
the fix is generally available. This comment also addresses the
question why the exception exists.

Amends CL 591535.

[1]: https://github.com/DragonFlyBSD/DragonFlyBSD/commit/c7c71870ed0

Change-Id: I3b53582301d44feb76b53788aa337c380ba82592
Reviewed-on: https://go-review.googlesource.com/c/go/+/595958
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: Than McIntosh <thanm@google.com>
2024-07-02 12:36:03 +00:00
Michael Matloob
94982a0782 cmd/go/internal/workcmd: remove a potentially confusing statement
A statement in the go work use docs that was meant to clarify that go
work use would clean up use statements where the directories did not
exist ended up causing confusion.

Remove that statement for now. We might want to add something back in
the future.

For #68245

Change-Id: I7f6646b5dd05c18aa15e0e54f2816753f318404e
Reviewed-on: https://go-review.googlesource.com/c/go/+/595536
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2024-07-01 19:41:15 +00:00
Than McIntosh
f71c00b616 cmd/link: align .reloc block starts by 32 bits for PE target
Tweak the code that emits the PE ".reloc" section on Windows to ensure
that each relocation block is 32-bit aligned, which is required by the
PE standard.

Fixes #68260.

Change-Id: I39b75a7491b00fa97871aebb90d3be0ec09f9c40
Reviewed-on: https://go-review.googlesource.com/c/go/+/595896
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-01 19:15:10 +00:00
Mohamed Yousif
d3c93f2f00 cmd/go: update go clean help message
Update the help message for the go clean command to include
the correct usage and flags for better clarity.

This change follows instructions by Ian on this thread <https://groups.google.com/g/golang-nuts/c/VENQ0fqLCSc/m/qO8EuawVBwAJ?pli=1>.

Change-Id: Ia509a38ee9ec7c31d384c3563535c5e3ccd9a9ce
GitHub-Last-Rev: 3048b2e4bd
GitHub-Pull-Request: golang/go#68135
Reviewed-on: https://go-review.googlesource.com/c/go/+/593639
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-01 14:58:10 +00:00