1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:54:42 -07:00
Commit Graph

61390 Commits

Author SHA1 Message Date
xieyuschen
cd4820cd19 os: add precondition doc for Create and OpenFile
Fixes #69836

Change-Id: Ide243c2aa9c6f9d45976f728f97e32c4fbadb720
Reviewed-on: https://go-review.googlesource.com/c/go/+/619316
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-18 22:34:44 +00:00
David Chase
a9ad0ff6ba cmd/compile: omit saved .closureptr in optimized code
This worsens debugging, but improves performance.

Change-Id: I7f3c0d174823b3de412478f9537adc61ae4c076e
Reviewed-on: https://go-review.googlesource.com/c/go/+/620219
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-18 17:19:13 +00:00
qmuntal
6853d89477 syscall: keep write access when O_TRUNC is used on Windows
CL 618836 introduces a regression where O_APPEND and O_TRUNC could
not be used together on Windows.

This CL fixes the issue by keeping the write access when O_TRUNC is used
, which is required when overwriting data (as per the file
access rights docs: https://learn.microsoft.com/en-us/windows/win32/fileio/file-access-rights-constants).

Fixes #69902.

Change-Id: I77ec60ca6929124dd4490bdad6c3280c4db3efcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/620575
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-10-18 04:09:36 +00:00
Xiaolin Zhao
e45c125a3c cmd/compile: add patterns for bitfield opcodes on loong64
goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A6000 @ 2500.00MHz
                |  bench.old   |              bench.new               |
                |    sec/op    |    sec/op     vs base                |
LeadingZeros      1.0095n ± 0%   0.8011n ± 0%  -20.64% (p=0.000 n=10)
LeadingZeros8      1.201n ± 0%    1.167n ± 0%   -2.83% (p=0.000 n=10)
LeadingZeros16     1.201n ± 0%    1.167n ± 0%   -2.83% (p=0.000 n=10)
LeadingZeros32     1.201n ± 0%    1.134n ± 0%   -5.58% (p=0.000 n=10)
LeadingZeros64    0.8007n ± 0%   1.0115n ± 0%  +26.32% (p=0.000 n=10)
TrailingZeros     0.8054n ± 0%   0.8106n ± 1%   +0.65% (p=0.000 n=10)
TrailingZeros8     1.067n ± 0%    1.002n ± 1%   -6.09% (p=0.000 n=10)
TrailingZeros16   1.0540n ± 0%   0.8389n ± 0%  -20.40% (p=0.000 n=10)
TrailingZeros32   0.8014n ± 0%   0.8117n ± 0%   +1.29% (p=0.000 n=10)
TrailingZeros64   0.8015n ± 0%   0.8124n ± 1%   +1.36% (p=0.000 n=10)
OnesCount          3.418n ± 0%    3.417n ± 0%        ~ (p=0.911 n=10)
OnesCount8        0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
OnesCount16        1.440n ± 0%    1.299n ± 0%   -9.79% (p=0.000 n=10)
OnesCount32        2.969n ± 0%    2.940n ± 0%   -0.94% (p=0.000 n=10)
OnesCount64        3.563n ± 0%    3.558n ± 0%   -0.14% (p=0.000 n=10)
RotateLeft        0.6677n ± 0%   0.6670n ± 0%        ~ (p=0.055 n=10)
RotateLeft8        1.318n ± 1%    1.321n ± 0%        ~ (p=0.117 n=10)
RotateLeft16      0.8457n ± 1%   0.8442n ± 0%        ~ (p=0.325 n=10)
RotateLeft32      0.8004n ± 0%   0.8004n ± 0%        ~ (p=0.837 n=10)
RotateLeft64      0.6678n ± 0%   0.6670n ± 0%   -0.13% (p=0.000 n=10)
Reverse           0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
Reverse8          0.6989n ± 0%   0.6969n ± 1%        ~ (p=0.138 n=10)
Reverse16         0.6998n ± 1%   0.7004n ± 1%        ~ (p=0.985 n=10)
Reverse32         0.4158n ± 1%   0.4159n ± 1%        ~ (p=0.870 n=10)
Reverse64         0.4165n ± 1%   0.4194n ± 2%        ~ (p=0.093 n=10)
ReverseBytes      0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
ReverseBytes16    0.4183n ± 2%   0.4148n ± 1%        ~ (p=0.055 n=10)
ReverseBytes32    0.4143n ± 2%   0.4153n ± 1%        ~ (p=0.869 n=10)
ReverseBytes64    0.4168n ± 1%   0.4177n ± 1%        ~ (p=0.184 n=10)
Add                1.201n ± 0%    1.201n ± 0%        ~ (p=0.087 n=10)
Add32              1.603n ± 0%    1.601n ± 0%   -0.12% (p=0.000 n=10)
Add64              1.201n ± 0%    1.201n ± 0%        ~ (p=0.211 n=10)
Add64multiple      1.839n ± 0%    1.835n ± 0%   -0.24% (p=0.001 n=10)
Sub                1.202n ± 0%    1.201n ± 0%   -0.04% (p=0.033 n=10)
Sub32              2.401n ± 0%    1.601n ± 0%  -33.32% (p=0.000 n=10)
Sub64              1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=10)
Sub64multiple      2.105n ± 0%    2.096n ± 0%   -0.40% (p=0.000 n=10)
Mul               0.8008n ± 0%   0.8004n ± 0%   -0.05% (p=0.000 n=10)
Mul32             0.8041n ± 0%   0.8014n ± 0%   -0.34% (p=0.000 n=10)
Mul64             0.8008n ± 0%   0.8004n ± 0%   -0.05% (p=0.000 n=10)
Div                8.977n ± 0%    8.945n ± 0%   -0.36% (p=0.000 n=10)
Div32              4.084n ± 0%    4.086n ± 0%        ~ (p=0.445 n=10)
Div64              9.316n ± 0%    9.301n ± 0%   -0.17% (p=0.000 n=10)
geomean            1.141n         1.117n        -2.09%

Change-Id: I4dc1eaab6728f771bc722ed331fe5c6429bd1037
Reviewed-on: https://go-review.googlesource.com/c/go/+/618475
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-18 01:09:11 +00:00
Xiaolin Zhao
ef3e1dae2f cmd/compile: optimize loong64 with register indexed load/store
goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      |  bench.old  |              bench.new              |
                      |   sec/op    |   sec/op     vs base                |
BinaryTree17             7.766 ± 1%    7.640 ± 2%   -1.62% (p=0.000 n=20)
Fannkuch11               2.649 ± 0%    2.358 ± 0%  -10.96% (p=0.000 n=20)
FmtFprintfEmpty         35.89n ± 0%   35.87n ± 0%   -0.06% (p=0.000 n=20)
FmtFprintfString        59.44n ± 0%   57.25n ± 2%   -3.68% (p=0.000 n=20)
FmtFprintfInt           62.07n ± 0%   60.04n ± 0%   -3.27% (p=0.000 n=20)
FmtFprintfIntInt        97.90n ± 0%   97.26n ± 0%   -0.65% (p=0.000 n=20)
FmtFprintfPrefixedInt   116.7n ± 0%   119.2n ± 0%   +2.14% (p=0.000 n=20)
FmtFprintfFloat         204.5n ± 0%   201.9n ± 0%   -1.30% (p=0.000 n=20)
FmtManyArgs             455.9n ± 0%   466.8n ± 0%   +2.39% (p=0.000 n=20)
GobDecode               7.458m ± 1%   7.138m ± 1%   -4.28% (p=0.000 n=20)
GobEncode               8.573m ± 1%   8.473m ± 1%        ~ (p=0.091 n=20)
Gzip                    280.2m ± 0%   284.9m ± 0%   +1.67% (p=0.000 n=20)
Gunzip                  32.68m ± 0%   32.67m ± 0%        ~ (p=0.211 n=20)
HTTPClientServer        54.22µ ± 0%   53.24µ ± 0%   -1.80% (p=0.000 n=20)
JSONEncode              9.427m ± 1%   9.152m ± 0%   -2.92% (p=0.000 n=20)
JSONDecode              47.08m ± 1%   46.85m ± 1%   -0.49% (p=0.007 n=20)
Mandelbrot200           4.601m ± 0%   4.605m ± 0%   +0.08% (p=0.000 n=20)
GoParse                 4.776m ± 0%   4.655m ± 1%   -2.52% (p=0.000 n=20)
RegexpMatchEasy0_32     59.77n ± 0%   57.59n ± 0%   -3.66% (p=0.000 n=20)
RegexpMatchEasy0_1K     458.1n ± 0%   458.8n ± 0%   +0.15% (p=0.000 n=20)
RegexpMatchEasy1_32     59.36n ± 0%   59.24n ± 0%   -0.20% (p=0.000 n=20)
RegexpMatchEasy1_1K     557.7n ± 0%   560.2n ± 0%   +0.46% (p=0.000 n=20)
RegexpMatchMedium_32    803.1n ± 0%   772.8n ± 0%   -3.77% (p=0.000 n=20)
RegexpMatchMedium_1K    27.29µ ± 0%   25.88µ ± 0%   -5.18% (p=0.000 n=20)
RegexpMatchHard_32      1.385µ ± 0%   1.304µ ± 0%   -5.85% (p=0.000 n=20)
RegexpMatchHard_1K      40.92µ ± 0%   39.58µ ± 0%   -3.27% (p=0.000 n=20)
Revcomp                 474.3m ± 0%   410.0m ± 0%  -13.56% (p=0.000 n=20)
Template                78.16m ± 0%   76.32m ± 1%   -2.36% (p=0.000 n=20)
TimeParse               271.8n ± 0%   272.1n ± 0%   +0.11% (p=0.000 n=20)
TimeFormat              292.3n ± 0%   294.8n ± 0%   +0.86% (p=0.000 n=20)
geomean                 51.98µ        50.82µ        -2.22%

Change-Id: Ia78f1ddee8f1d9ec7192a4b8d2a4ec6058679956
Reviewed-on: https://go-review.googlesource.com/c/go/+/615918
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-10-17 07:32:25 +00:00
apocelipes
2b664d586c time: correct time.AppendText's error message
"time.AppendText" returns error messages that start with the prefix
"time.MarshalText: " which seems confusion.

Now correct the message prefix to "time.AppendText: " and add a test
to prevent regression.

Change-Id: I5742c9c3ed802eb79c65d459910deae4f3652ffd
GitHub-Last-Rev: ce965595c1
GitHub-Pull-Request: golang/go#69914
Reviewed-on: https://go-review.googlesource.com/c/go/+/620597
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-17 03:01:53 +00:00
Alan Donovan
f15195a063 go/internal/gcimporter: drop indexed import
The compiler hasn't emitted indexed export data files since go1.19,
so this code, which is only statically reachable from
go/importer.For("gc") aka importer.Default(), is not dynamically
reachable since those files will not be in indexed format.

Updates #68898

Change-Id: I12ea4e1b88da4fffdc9a07f318b9445a61e0d02b
Reviewed-on: https://go-review.googlesource.com/c/go/+/620135
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-17 02:51:00 +00:00
Sean Liao
c41b8cf1a3 strconv: display format options as list
Fixes #69890

Change-Id: I1da4eb76c008679a687f4faa4294fe32b5fc7f42
Reviewed-on: https://go-review.googlesource.com/c/go/+/620236
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-16 17:39:51 +00:00
Ryan Granger
24cb743d1f crypto/tls: include close notify in client tls test recordings
This commit fixes the issue where tls testdata recordings made with the
newer version of the prerecorded tls conversation test harness, doesn't
end up capturing the final close notify message. The fix simply ensures
that the tls.Client closes before the recording of the conversation is
closed. The closing of the client connection directly is no longer
needed when updating the recording since it will be closed when the
tls.Client is closed.

Fixes golang/go#69846

Change-Id: I93898de32abd89659a32ed240df6daea5aeaa7fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/620395
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-16 13:37:50 +00:00
Damien Neil
70f4717e96 os: use relative paths in a test dir in TestOpenError
Refactor TestOpenError to use relative paths in test cases,
in preparation for extending it to test os.Root.

Use a test temporary directory instead of system directory
with presumed-known contents.

Move the testcase type and case definitions inline with the test.

For #67002

Change-Id: Idc53dd9fcecf763d3e4eb3b4643032e3003d7ef4
Reviewed-on: https://go-review.googlesource.com/c/go/+/620157
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-15 17:23:27 +00:00
Robert Pająk
cbdb3545ad timer: fix Stop link in Timer.Reset doc comment
Change-Id: I0fccb18b2d5d3f7c86f026c988f90734546f7be0
GitHub-Last-Rev: a72cfe970e
GitHub-Pull-Request: golang/go#69856
Reviewed-on: https://go-review.googlesource.com/c/go/+/619056
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2024-10-14 21:03:43 +00:00
qmuntal
5c1a68aedd internal/syscall/windows: fix handle leak in Mkdirat
Mkdirat does not close the handle returned by CreateFile, but it should.

Mkdirat has been introduced in this developer cycle, so it is not
necessary to backport this fix to any release branch.

Change-Id: Icddac5ccdc6a142a5be5392a39aba2ae7cc9c69a
Reviewed-on: https://go-review.googlesource.com/c/go/+/620195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
2024-10-14 20:58:52 +00:00
Austin Clements
89f29a772a runtime: clarify work.bytesMarked documentation
Change-Id: If5132400aac0ef00e467958beeaab5e64d053d10
Reviewed-on: https://go-review.googlesource.com/c/go/+/619099
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-14 20:36:52 +00:00
Michael Pratt
c39bc22c14 all: wire up swisstable maps
Use the new SwissTable-based map in internal/runtime/maps as the basis
for the runtime map when GOEXPERIMENT=swissmap.

Integration is complete enough to pass all.bash. Notable missing
features:

* Race integration / concurrent write detection
* Stack-allocated maps
* Specialized "fast" map variants
* Indirect key / elem

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap
Change-Id: Ie97b656b6d8e05c0403311ae08fef9f51756a639
Reviewed-on: https://go-review.googlesource.com/c/go/+/594596
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-14 19:58:47 +00:00
Ian Lance Taylor
48849e0866 runtime: don't frob isSending for tickers
The Ticker Stop and Reset methods don't report a value,
so we don't need to track whether they are interrupting a send.

This includes a test that used to fail about 2% of the time on
my laptop when run under x/tools/cmd/stress.

Change-Id: Ic6d14b344594149dd3c24b37bbe4e42e83f9a9ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/620136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-14 19:04:43 +00:00
zhangjian
1f51b82758 cmd/cgo/internal/testsanitizers: correct comment in tsan test
Change-Id: Id22ad7c92c54bc61f1f1d5544f17208f2f8648aa
GitHub-Last-Rev: 61eee331dc
GitHub-Pull-Request: golang/go#69866
Reviewed-on: https://go-review.googlesource.com/c/go/+/619836
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-14 16:59:38 +00:00
apocelipes
db8c208cbd cmd/cgo,cmd/go: preallocate slices if they have known fixed capacities
This allows for more efficient use of memory.

Change-Id: I16f399a25c23b804e55289ca055fa83ea9862f16
GitHub-Last-Rev: 19bb96a7cf
GitHub-Pull-Request: golang/go#69841
Reviewed-on: https://go-review.googlesource.com/c/go/+/618960
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>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-10-14 15:47:06 +00:00
Xiaolin Zhao
b521ebb55a math: implement arch{Floor, Ceil, Trunc} in hardware on loong64
benchmark:

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A6000 @ 2500.00MHz
        │  bench.old   │              bench.new              │
        │    sec/op    │   sec/op     vs base                │
Ceil      10.810n ± 0%   2.578n ± 0%  -76.15% (p=0.000 n=20)
Floor     10.810n ± 0%   2.531n ± 0%  -76.59% (p=0.000 n=20)
Trunc      9.606n ± 0%   2.530n ± 0%  -73.67% (p=0.000 n=20)
geomean    10.39n        2.546n       -75.50%

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A5000 @ 2500.00MHz
        │  bench.old   │              bench.new              │
        │    sec/op    │   sec/op     vs base                │
Ceil      13.220n ± 0%   7.703n ± 8%  -41.73% (p=0.000 n=20)
Floor     12.410n ± 0%   7.248n ± 2%  -41.59% (p=0.000 n=20)
Trunc     11.210n ± 0%   7.757n ± 4%  -30.80% (p=0.000 n=20)
geomean    12.25n        7.566n       -38.25%

Change-Id: I3af51e9852e9cf5f965fed895d68945a2e8675f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/612615
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-12 03:24:22 +00:00
Tobias Klauser
7e0159c50b net: use slices.Contains{,Func} in lookup tests
Change-Id: I66199995ca34c92aeb8234b43cb2166f2976c903
Reviewed-on: https://go-review.googlesource.com/c/go/+/619735
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-10-11 22:36:26 +00:00
Damien Neil
86a1a994ff internal/syscall/windows: add Openat, Mkdirat
Windows versions of openat and mkdirat,
implemented using NtCreateFile.

For #67002

Change-Id: If43b1c1069733e5c45f7d45a69699fec30187308
Reviewed-on: https://go-review.googlesource.com/c/go/+/619435
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-11 21:56:46 +00:00
xzhang39
1c6288f7e1 cmd/go: add file names for cyclic import error
The PR is to add more details for the error, so that it would be easier to troubleshoot the cyclic imports error.

The change for the error looks like the following:

package cyclic-import-example
        imports cyclic-import-example/packageA from /Users/personal/cyclic-import-example/main.go:4:5
        imports cyclic-import-example/packageB from /Users/personal/cyclic-import-example/packageA/a.go:5:2
        imports cyclic-import-example/packageA from /Users/personal/cyclic-import-example/packageB/bb.go:5:2: import cycle not allowed

Fixes #66078

Change-Id: I162cd348004bf4e4774b195f8355151c1bf0a652
GitHub-Last-Rev: c5a16256d1
GitHub-Pull-Request: golang/go#68337
Reviewed-on: https://go-review.googlesource.com/c/go/+/597035
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-11 19:00:21 +00:00
qmuntal
fa7343aca3 runtime: reduce syscall.SyscallX stack usage
syscall.SyscallX consumes a lot of stack space, which is a problem
because they are nosplit functions. They used to use less stack space,
but CL 563315, that landed in Go 1.23, increased the stack usage by a
lot.

This CL reduces the stack usage back to the previous level.

Fixes #69813.

Change-Id: Iddedd28b693c66a258da687389768055c493fc2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/618497
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-11 17:16:18 +00:00
zhangjian
1041c2cf01 cmd/go: make sure the linker for shared doesn't include tempdir path
This is similar to CL 478196 and CL 477296,
but this is for -buildmode=shared.

When using "go install -buildmode=shared std",
because the gold linker is used by default on Linux arm64,
it will cause temporary paths to be included in libstd.so.

Based on the changes of CL 478196,
I speculate that this may also have issues on other platforms.
So, this change is for all platform.

Fixes #69464

Change-Id: I4493c82be030186e61aef597ea0e6f43bcf95a32
GitHub-Last-Rev: ee40cf81ac
GitHub-Pull-Request: golang/go#69394
Reviewed-on: https://go-review.googlesource.com/c/go/+/612396
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-10-11 15:31:40 +00:00
qmuntal
d20a4c2403 syscall: support more flags when opening directories on Windows
syscall.Open was artificially limiting the flags that were eligible
to open directories on Windows. This change extend the cases where we
pass FILE_FLAG_BACKUP_SEMANTICS to all flag combinations allowed by
Unix.

Change-Id: Ia7c083bcba070f92ea61c6d67487bdefd0d99546
Reviewed-on: https://go-review.googlesource.com/c/go/+/619295
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>
2024-10-10 20:07:10 +00:00
qmuntal
9cc737d482 syscall: fix Open param names
syscall.Open param names are confusing, mainly because what should be
named flag is named mode and what should be named mode is named perm.

The name perm is used as synonym for mode in other places, so keep
it as is. Rename mode to flag to match the real meaning of the
parameter. Also, rename path to name for consistency with other
usage of the same parameter.

Change-Id: Ideed09839d80c0383584c2268afbb6cc09ffda8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/619276
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-10 20:06:50 +00:00
cuishuang
a9abbac4c8 net/url: add example for JoinPath
Change-Id: Ibbd2bda7ff2ea3c782ad41f6f00ad62849a4f066
Reviewed-on: https://go-review.googlesource.com/c/go/+/618756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-10-10 20:03:57 +00:00
qmuntal
39fbc4c29a syscall,os: move flags validation from os.OpenFile to syscall.Open
syscall.Open is the functions that maps Unix/Go flags into Windows
concepts. Part of the flag validation logic was still implemented
in os.OpenFile, move it to syscall.Open for consistency.

A nice side effect is that we don't have to translate the file name
twice in case of an access denied error.

Change-Id: I32c647a9a2a066277c78f53bacb45fb3036f6353
Reviewed-on: https://go-review.googlesource.com/c/go/+/619275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-10 18:44:36 +00:00
Robert Griesemer
0a1c6e3076 doc: reference language version in pre-generic spec for easier recognition
This matches the style we use for the current spec.

Change-Id: I82ad8e9994da1c74801f3c18f32f21fdd7ac355a
Reviewed-on: https://go-review.googlesource.com/c/go/+/619476
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-10-10 18:25:45 +00:00
Ian Lance Taylor
7634f0755c os: handle umask comparing execute mode in verifyCopyFS
Fixes #69788

Change-Id: I43cc4c0dc3c8aa2474cba26c84714d00828de08e
Reviewed-on: https://go-review.googlesource.com/c/go/+/619176
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-10-09 22:07:37 +00:00
cuishuang
93166e29d3 net/mail: add example for ParseDate
Change-Id: Id22d199ea4b0a9795dc3d9e5f7a74be13ff0cf58
Reviewed-on: https://go-review.googlesource.com/c/go/+/618755
Auto-Submit: 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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-09 20:12:00 +00:00
Keith Randall
5428570af7 cmd/compile: use call block instead of entry block for tail call expansion
The expand-calls pass assumed that tail calls were always done in the
entry block. That used to be true, but with tail calls in wrappers
(enabled by CL 578235) and libfuzzer instrumentation, that is no
longer the case. Libfuzzer instrumentation adds an IF statement to the
start of the wrapper function.

Fixes #69825

Change-Id: I9ab7133691d8235f9df128be39bff154b0b8853b
Reviewed-on: https://go-review.googlesource.com/c/go/+/619075
Reviewed-by: 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: Keith Randall <khr@google.com>
2024-10-09 18:20:35 +00:00
Mauri de Souza Meneguzzo
935bf1395c cmd/go: place GOROOT/bin at the beginning of PATH in 'go run'
This causes programs that use 'go' as a subprocess to use the same go
command as the parent 'go run' command.

Fixes #68005

Change-Id: I937cef474bf038a925bb74fc73e5f377b03e27b7
GitHub-Last-Rev: 9986537cad
GitHub-Pull-Request: golang/go#68040
Reviewed-on: https://go-review.googlesource.com/c/go/+/593255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-10-09 18:10:59 +00:00
qmuntal
18131ec8dc syscall: simplify O_TRUNC handling on Windows
The current implementation of O_TRUNC in syscall.Open on Windows is
prone to TOCTOU issues, as it opens the file twice if the first open
detects that the file doesn't exist. The file could
be created in between the two open calls, leading to the creation
of a new file with the undesired readonly attribute.

This CL implements O_TRUNC by just calling CreateFile once without
taking O_TRUNCATE into account, and then using Ftruncate if O_TRUNC is
set to truncate the file.

Updates #38225.

Change-Id: Ic3ad1bab75c9a1c16f99c8c5bed867c5dbc3a23b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-09 17:23:27 +00:00
qmuntal
0fd2d4d6c2 syscall: implement Ftruncate using a single syscall on Windows
Ftruncate can be implemented on Windows using a single syscall. This
makes the implementation more efficient and less prone to races when
used in combination with other Seek calls.

Change-Id: I5d9f780fba2710403fce89d3325e519f33ad9ae8
Reviewed-on: https://go-review.googlesource.com/c/go/+/618835
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-09 17:22:48 +00:00
Michael Pratt
3352db152b internal/runtime/maps: support big endian architectures
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10
Change-Id: I0a928c4b1e90056c50d2abca8982bdb540c33a34
Reviewed-on: https://go-review.googlesource.com/c/go/+/619035
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-09 16:36:29 +00:00
Mauri de Souza Meneguzzo
3aa71c12ea cmd/compile, internal/runtime/atomic: add Xchg8 for arm64
For #69735

Change-Id: I61a2e561684c538eea705e60c8ebda6be3ef31a7
GitHub-Last-Rev: 3c7f4ec845
GitHub-Pull-Request: golang/go#69751
Reviewed-on: https://go-review.googlesource.com/c/go/+/617595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-08 22:06:50 +00:00
Michael Pratt
0733682e5f internal/runtime/maps: initial swiss table map implementation
Add a new package that will contain a new "Swiss Table"
(https://abseil.io/about/design/swisstables) map implementation, which
is intended to eventually replace the existing runtime map
implementation.

This implementation is based on the fabulous
github.com/cockroachdb/swiss package contributed by Peter Mattis.

This CL adds an hash map implementation. It supports all the core
operations, but does not have incremental growth.

For #54766.

Change-Id: I52cf371448c3817d471ddb1f5a78f3513565db41
Reviewed-on: https://go-review.googlesource.com/c/go/+/582415
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-08 16:43:52 +00:00
Tobias Klauser
13e9a55afd cmd/go/internal/modload: use slices.Contains
Change-Id: I9d39984b6b15d415189592b592de471f50b43d0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618495
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
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>
2024-10-08 15:42:57 +00:00
Tobias Klauser
dd281fd616 encoding/asn1: use slices.Equal in ObjectIdentifier.Equal
Change-Id: I5efe3b9dcee85dfa34b6072c6f85108b6fc7cf99
Reviewed-on: https://go-review.googlesource.com/c/go/+/618515
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-10-08 15:08:01 +00:00
Xiaolin Zhao
5923a97f43 cmd/internal/obj: optimize the function stacksplit on loong64
In the process of stack split checking, loong64 uses the following
logic: if SP > stackguard then goto done, else morestack

The possible problem here is that the probability of morestack
execution is much lower than done, while static branch prediction
is more inclined to obtain morestack, which will cause a certain
probability of branch prediction error.

Change the logic here to:
if SP <= stackguard then goto morestack, else done

benchmarks on 3A6000:

goos: linux
goarch: loong64
pkg: fmt
cpu: Loongson-3A6000 @ 2500.00MHz
                              │  bench.old  │              bench.new              │
                              │   sec/op    │   sec/op     vs base                │
SprintfPadding                  418.3n ± 1%   387.0n ± 0%   -7.49% (p=0.000 n=20)
SprintfEmpty                    35.95n ± 0%   35.86n ± 0%   -0.25% (p=0.000 n=20)
SprintfString                   75.02n ± 1%   72.24n ± 0%   -3.71% (p=0.000 n=20)
SprintfTruncateString           165.7n ± 3%   139.9n ± 1%  -15.58% (p=0.000 n=20)
SprintfTruncateBytes            171.0n ± 0%   147.3n ± 0%  -13.83% (p=0.000 n=20)
SprintfSlowParsingPath          90.56n ± 0%   80.85n ± 0%  -10.72% (p=0.000 n=20)
SprintfQuoteString              560.2n ± 0%   509.7n ± 0%   -9.01% (p=0.000 n=20)
SprintfInt                      58.62n ± 0%   56.45n ± 0%   -3.70% (p=0.000 n=20)
SprintfIntInt                   141.7n ± 0%   122.2n ± 0%  -13.73% (p=0.000 n=20)
SprintfPrefixedInt              210.6n ± 0%   208.8n ± 0%   -0.88% (p=0.000 n=20)
SprintfFloat                    282.3n ± 0%   251.8n ± 1%  -10.80% (p=0.000 n=20)
SprintfComplex                  854.1n ± 0%   813.8n ± 0%   -4.71% (p=0.000 n=20)
SprintfBoolean                  76.32n ± 0%   71.14n ± 1%   -6.79% (p=0.000 n=20)
SprintfHexString                218.5n ± 0%   193.4n ± 0%  -11.51% (p=0.000 n=20)
SprintfHexBytes                 321.3n ± 0%   275.0n ± 0%  -14.42% (p=0.000 n=20)
SprintfBytes                    573.5n ± 0%   553.2n ± 1%   -3.54% (p=0.000 n=20)
SprintfStringer                 501.1n ± 1%   446.6n ± 0%  -10.86% (p=0.000 n=20)
SprintfStructure                1.793µ ± 0%   1.683µ ± 0%   -6.16% (p=0.000 n=20)
ManyArgs                        500.0n ± 0%   470.4n ± 0%   -5.92% (p=0.000 n=20)
FprintInt                       67.51n ± 0%   65.71n ± 0%   -2.66% (p=0.000 n=20)
FprintfBytes                    130.9n ± 0%   129.5n ± 1%   -1.11% (p=0.000 n=20)
FprintIntNoAlloc                67.55n ± 0%   65.80n ± 0%   -2.58% (p=0.000 n=20)
ScanInts                        386.3µ ± 0%   346.5µ ± 0%  -10.29% (p=0.000 n=20)
ScanRecursiveInt                25.97m ± 0%   25.93m ± 0%   -0.15% (p=0.038 n=20)
ScanRecursiveIntReaderWrapper   26.07m ± 0%   25.93m ± 0%   -0.53% (p=0.001 n=20)
geomean                         702.6n        653.7n        -6.96%

goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      │  bench.old   │              bench.new              │
                      │    sec/op    │   sec/op     vs base                │
BinaryTree17              7.688 ± 1%    7.724 ± 0%   +0.47% (p=0.040 n=20)
Fannkuch11                2.670 ± 0%    2.645 ± 0%   -0.94% (p=0.000 n=20)
FmtFprintfEmpty          35.93n ± 0%   37.50n ± 0%   +4.37% (p=0.000 n=20)
FmtFprintfString         56.32n ± 0%   59.74n ± 0%   +6.08% (p=0.000 n=20)
FmtFprintfInt            64.47n ± 0%   61.26n ± 0%   -4.98% (p=0.000 n=20)
FmtFprintfIntInt        100.30n ± 0%   99.67n ± 0%   -0.63% (p=0.000 n=20)
FmtFprintfPrefixedInt    116.7n ± 0%   119.3n ± 0%   +2.23% (p=0.000 n=20)
FmtFprintfFloat          234.1n ± 0%   203.4n ± 0%  -13.11% (p=0.000 n=20)
FmtManyArgs              503.0n ± 0%   467.9n ± 0%   -6.96% (p=0.000 n=20)
GobDecode                8.125m ± 0%   7.299m ± 0%  -10.17% (p=0.000 n=20)
GobEncode                8.930m ± 1%   8.581m ± 1%   -3.91% (p=0.000 n=20)
Gzip                     280.0m ± 0%   279.8m ± 0%   -0.10% (p=0.000 n=20)
Gunzip                   33.30m ± 0%   32.48m ± 0%   -2.49% (p=0.000 n=20)
HTTPClientServer         55.43µ ± 0%   54.10µ ± 1%   -2.41% (p=0.000 n=20)
JSONEncode              10.086m ± 0%   9.055m ± 0%  -10.22% (p=0.000 n=20)
JSONDecode               49.37m ± 1%   46.22m ± 1%   -6.40% (p=0.000 n=20)
Mandelbrot200            4.606m ± 0%   4.606m ± 0%        ~ (p=0.280 n=20)
GoParse                  5.010m ± 0%   4.855m ± 0%   -3.09% (p=0.000 n=20)
RegexpMatchEasy0_32      59.09n ± 0%   59.32n ± 0%   +0.39% (p=0.000 n=20)
RegexpMatchEasy0_1K      455.2n ± 0%   453.8n ± 0%   -0.31% (p=0.000 n=20)
RegexpMatchEasy1_32      59.24n ± 0%   60.11n ± 0%   +1.47% (p=0.000 n=20)
RegexpMatchEasy1_1K      555.2n ± 0%   553.9n ± 0%   -0.23% (p=0.000 n=20)
RegexpMatchMedium_32     845.7n ± 0%   775.6n ± 0%   -8.28% (p=0.000 n=20)
RegexpMatchMedium_1K     26.68µ ± 0%   26.48µ ± 0%   -0.78% (p=0.000 n=20)
RegexpMatchHard_32       1.317µ ± 0%   1.326µ ± 0%   +0.68% (p=0.000 n=20)
RegexpMatchHard_1K       41.35µ ± 0%   40.95µ ± 0%   -0.97% (p=0.000 n=20)
Revcomp                  463.0m ± 0%   473.0m ± 0%   +2.15% (p=0.000 n=20)
Template                 83.80m ± 0%   76.26m ± 1%   -9.00% (p=0.000 n=20)
TimeParse                283.3n ± 0%   260.8n ± 0%   -7.96% (p=0.000 n=20)
TimeFormat               307.2n ± 0%   290.5n ± 0%   -5.45% (p=0.000 n=20)
geomean                  53.16µ        51.67µ        -2.79%

Change-Id: Iaec2f50db18e9a2b405605f8b92af3683114ea34
Reviewed-on: https://go-review.googlesource.com/c/go/+/616035
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-08 13:59:45 +00:00
Michael Anthony Knyszek
356ba0f065 net: detect EAI_ADDRFAMILY for cgo host lookup on FreeBSD
For #61095.

Change-Id: Iff9f19f6f2eada739967774b50d949f9c5893ee0
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-freebsd-amd64
Reviewed-on: https://go-review.googlesource.com/c/go/+/618015
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-10-07 20:52:38 +00:00
Damien Neil
df97215a34 syscall, internal/syscall/unix: add Openat support for wasip1
The syscall package is mostly frozen, but wasip1 file syscall
support was added to syscall and the Open and Openat
implementations overlap. Implement Openat in syscall for
overall simplicity.

We already have syscall.Openat for some platforms, so this
doesn't add any new functions to syscall.

For #67002

Change-Id: Ia34b12ef11fc7a3b7832e07b3546a760c23efe5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/617378
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-07 19:25:11 +00:00
Damien Neil
96db8cc49e internal/syscall/unix: add Mkdirat and Readlinkat
For #67002

Change-Id: I460e02db33799c145c296bcf0668fa555199036e
Reviewed-on: https://go-review.googlesource.com/c/go/+/617376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-07 19:24:54 +00:00
Paul E. Murphy
15618840f6 cmd/compile: add internal/runtime/atomic.Xchg8 intrinsic for PPC64
This is minor extension of the existing support for 32 and
64 bit types.

For #69735

Change-Id: I6828ec223951d2b692e077dc507b000ac23c32a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/617496
Reviewed-by: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-07 19:20:23 +00:00
Elias Naur
604eaa175b iter: fix spurious TestPullDoubleYield[2] successes
The two tests confused a nil pointer panic with the panic from a double
call to yield.

Change-Id: I0040e60cf4b702a92825d308db1201a85f164009
Reviewed-on: https://go-review.googlesource.com/c/go/+/617917
Reviewed-by: Ian Lance Taylor <iant@google.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>
2024-10-07 19:12:35 +00:00
Cuong Manh Le
7e2487cf65 cmd/compile: avoid dynamic type when possible
If the expression type is a single compile-time known type, use that
type instead of the dynamic one, so the later passes of the compiler
could skip un-necessary runtime calls.

Thanks Youlin Feng for writing the original test case.

Change-Id: I3f65ab90f041474a9731338a82136c1d394c1773
Reviewed-on: https://go-review.googlesource.com/c/go/+/616975
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: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-07 19:12:01 +00:00
Damien Neil
6a3f39a9b8 internal/syscall/windows: add NtCreateFile
Mostly copied from x/sys/windows.

This adds a various related types and functions,
but the purpose is to give access to NtCreateFile,
which can be used as an equivalent to openat.

For #67002

Change-Id: I04e6f630445a55c2000c9c323ce8dcdc7fc0d0e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/617377
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-07 18:34:43 +00:00
apocelipes
f328f3ff06 go/types, types2: use slices to simplify the code
Simplify the code and remove some unnecessary helper functions.

Change-Id: I1419ca3a0c7048891bbdc274f53fd72960410651
GitHub-Last-Rev: 06b1f03bb3
GitHub-Pull-Request: golang/go#68732
Reviewed-on: https://go-review.googlesource.com/c/go/+/602719
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-10-07 17:59:44 +00:00
Sean Liao
1a955f5c8e io/fs: document need to call File.Close
Fixes #69723

Change-Id: Id081f68cd30abfa77a971a2370f4a0ebf330eb8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/618095
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-07 17:51:27 +00:00
Filippo Valsorda
05d8a33b37 crypto/rand: skip TestAllocations if optimizations are off
Without optimizations escape analysis can't do as much.

Updates #66779

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-noopt
Change-Id: I9ccd1b995c62427ceebd9ce5c98170dbf4a93e8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618275
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-07 16:38:43 +00:00