Commit graph

48415 commits

Author SHA1 Message Date
Filippo Valsorda
e3176bbc3e crypto/tls: fix typo in Config.NextProtos docs
Change-Id: I916df584859595067e5e86c35607869397dbbd8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/325651
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-07 15:16:23 +00:00
DQNEO
e1fa26026d spec: improve wording consistency by eliminating "specifier"
The word "specifier" is used once only here and technically not defined.

Change-Id: Ifc9f0582f4eb3c3011ba60d8008234de511d4be6
Reviewed-on: https://go-review.googlesource.com/c/go/+/323730
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
2021-06-05 19:52:26 +00:00
DQNEO
f490134126 spec: improve wording by choosing an official term "keyword"
Replace "reserved word" by "keyword" as the latter is the official term.

Change-Id: I9f269759b872026034a9f47e4a761cff2d348ca0
Reviewed-on: https://go-review.googlesource.com/c/go/+/323729
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
2021-06-05 19:51:45 +00:00
Sergey Zagursky
e3cb381704 go/internal/gcimporter: don't waste CPU copying bytes in io.ReadAll
`io.ReadAll` dynamically reallocates byte slice because it doesn't know
its size in advance. We don't need to read an entire file into memory
and therefore may use `bufio.Reader` to read its contents.

Fixes #46564

Change-Id: Id504b1512662b6dea4775d523455896fa4162ab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/325429
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-05 09:28:43 +00:00
Ian Lance Taylor
9d669ed47a misc/cgo/errors: use expected column numbers
The test was using the wrong column numbers, and was erroneously
passing because there happened to be line numbers that matched those
column numbers. Change the test harness to require the expected line
number for the ERROR HERE regexp case, so that this doesn't happen again.

Also rename a couple of variables in the test to avoid useless
redeclaration errors.

Fixes #46534

Change-Id: I2fcbf5e379c346de5346035c73d174a3980c0927
Reviewed-on: https://go-review.googlesource.com/c/go/+/324970
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-06-05 04:40:03 +00:00
sryoya
95939e8de7 cmd/compile/internal/abi: fix typo in comment
Change-Id: I196045314b2b0e908d7b31ac0cea5b25404f3ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/325249
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>
2021-06-04 20:51:27 +00:00
Damien Neil
831f9376d8 net/http: fix ResponseWriter.ReadFrom with short reads
CL 249238 changes ResponseWriter.ReadFrom to probe the source with
a single read of sniffLen bytes before writing the response header.
If the source returns less than sniffLen bytes without reaching
EOF, this can cause Content-Type and Content-Length detection to
fail.

Fix ResponseWrite.ReadFrom to copy a full sniffLen bytes from
the source as a probe.

Drop the explicit call to w.WriteHeader; writing the probe will
trigger a WriteHeader call.

Consistently use io.CopyBuffer; ReadFrom has already acquired a
copy buffer, so it may as well use it.

Fixes #44953.

Change-Id: Ic49305fb827a2bd7da4764b68d64b797b5157dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/301449
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-06-04 17:33:24 +00:00
Jason A. Donenfeld
3a9d906edc os: avoid finalizer race in windows process object
If proc.Release is called concurrently, a handle will be double-freed.

Change-Id: I0c0c32e312e07bc8615e0bf9e9b691214444d8d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/322510
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-04 17:21:49 +00:00
Jason A. Donenfeld
105c5b50e0 os: terminate windows processes via handle directly
We already have a handle to the process, so use that for termination,
rather than doing a new lookup based on the PID.

Change-Id: I2958c1817f12f3dd783412baacbf629049f6956a
Reviewed-on: https://go-review.googlesource.com/c/go/+/322509
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-04 17:21:40 +00:00
Bryan C. Mills
79cd407f88 syscall: regenerate zsyscall_windows.go
The declaration order in CL 319310 does not match what the generator
produces from scratch. That currently causes
cmd/internal/moddeps.TestAllDependencies to fail, since it is
explicitly checking for that kind of skew.

Updates #45914

Change-Id: If2a9cabc3d54e21deba7cb438fa364df205f38ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/325112
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-04 15:53:06 +00:00
Aaron Sheah
c6b6211229 doc/go1.17: document testing changes for Go 1.17
For #44513. Fixes #46024

Change-Id: Icf3877d1fcd67448fbc79a0ce3db3f319ad4a0e9
GitHub-Last-Rev: 8c015935c2
GitHub-Pull-Request: golang/go#46324
Reviewed-on: https://go-review.googlesource.com/c/go/+/322109
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Jeremy Faller <jeremy@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-04 14:31:24 +00:00
Jason A. Donenfeld
0214440075 syscall: do not pass console handles to PROC_THREAD_ATTRIBUTE_HANDLE_LIST on Windows 7
On Windows 7 (and below), console handles are not real kernel handles
but are rather userspace objects, with information passed via special
bits in the handle itself. That means they can't be passed in
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, even though they can be inherited.
So, we filter the list passed to PROC_THREAD_ATTRIBUTE_HANDLE_LIST to
not have any console handles on Windows 7. At the same time, it turns
out that the presence of a NULL handle in the list is enough to render
PROC_THREAD_ATTRIBUTE_HANDLE_LIST completely useless, so filter these
out too. Console handles also can't be duplicated into parent processes,
as inhertance always happens from the present process, so duplicate
always into the present process even when a parent process is specified.

Fixes #45914.

Change-Id: I70b4ff4874dbf0507d9ec9278f63b9b4dd4f1999
Reviewed-on: https://go-review.googlesource.com/c/go/+/319310
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-06-04 09:39:32 +00:00
Matthew Dempsky
962d5c997a cmd/compile,go/types: restrict use of unsafe.{Add,Slice} to go1.17 or newer
This CL updates cmd/compile (including types2) and go/types to report
errors about using unsafe.Add and unsafe.Slice when language
compatibility is set to Go 1.16 or older.

Fixes #46525.

Change-Id: I1bfe025a672d9f4b929f443064ad1effd38d0363
Reviewed-on: https://go-review.googlesource.com/c/go/+/324369
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-06-04 01:31:23 +00:00
Matthew Dempsky
b29b123e07 cmd/compile: remove spurious ir.Dump
This ir.Dump call is a debugging artifact introduced in
golang.org/cl/274103, which should never be printed for valid,
non-generic code, but evidently can now sometimes appear due to how
the parser handles invalid syntax.

The parser should probably not recognize "x[2]" as a type expression
in non-generics mode, but also probably we shouldn't try noding after
reporting syntax errors. Either way, this diagnostic has outlived its
usefulness, and noder's days are numbered anyway, so we might as well
just remove it to save end users any confusion.

Updates #46558.

Change-Id: Ib68502ef834d610b883c2f2bb11d9b385bc66e37
Reviewed-on: https://go-review.googlesource.com/c/go/+/324991
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-04 01:26:43 +00:00
Than McIntosh
6d98301114 cmd/link: use correct alignment in PE DWARF sections
Set the correct section flags to insure that .debug_* sections are
using 1-byte alignment instead of the default. This seems to be
important for later versions of LLVM-mingw on windows (shows up on the
windows/arm64 builder).

Updates #46406.

Change-Id: I023d5208374f867552ba68b45011f7990159868f
Reviewed-on: https://go-review.googlesource.com/c/go/+/324763
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-03 19:38:56 +00:00
Michael Pratt
e0d029f758 runtime: avoid gp.lockedm race in exitsyscall0
Following https://golang.org/cl/291329, exitsyscall0 accesses gp.lockedm
after releasing gp to the global runq. This creates a race window where
another M may schedule the (unlocked) G, which subsequently calls
LockOSThread, setting gp.lockedm and thus causing exitsyscall0 to think
it should call stoplockedm.

Avoid this race by checking if gp is locked before releasing it to the
global runq.

Fixes #46524

Change-Id: I3acdaf09e7a2178725adbe61e985130e9ebd0680
Reviewed-on: https://go-review.googlesource.com/c/go/+/324350
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-06-03 16:34:34 +00:00
Roland Shoemaker
dd7ba3ba2c net: don't rely on system hosts in TestCVE202133195
Also don't unnecessarily deref the error return.

Fixes #46504

Change-Id: I22d14ac76776f8988fa0774bdcb5fcd801ce0185
Reviewed-on: https://go-review.googlesource.com/c/go/+/324190
Trust: David Chase <drchase@google.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-06-02 21:39:28 +00:00
Ian Lance Taylor
4f572d7076 io/fs: minor corrections to Sub docs
Fixes #44376

Change-Id: I9cd21adb9d4d434c3d8b8eb8af3042b70c763ea1
Reviewed-on: https://go-review.googlesource.com/c/go/+/296389
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-06-02 18:52:58 +00:00
Jeremy Faller
e11d14225c doc/go1.17: remove runtime section
Updates #44513

Change-Id: I359d56fc3eeece3005f092cca2cb485664affc23
Reviewed-on: https://go-review.googlesource.com/c/go/+/324209
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-06-02 17:34:43 +00:00
Ian Lance Taylor
6e189afd3e doc/go1.17: mention SYS_WAIT6/WEXITED on NetBSD
For #13987
For #16028
For #44513

Change-Id: I7a73446fcc80a01fa6de24eec1e5b993e543be37
Reviewed-on: https://go-review.googlesource.com/c/go/+/323489
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-06-02 16:25:20 +00:00
Ian Lance Taylor
ff9f5fb859 cmd/link: recognize clang linker error in testCGOLTO
Also recognize a case in which GCC does not run (from
https://build.golang.org/log/7f6d8b35c905b9829f05906beccca44f208aa569).

Fixes #46517

Change-Id: I4fe4164a5df92b2dec08fd767f65a4d5479f3f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/324169
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-06-02 15:45:31 +00:00
Uddeshya Singh
1c6a2ea2ea doc/go1.17: document time changes for Go1.17
Documents the newly implemented changes of
- Time.IsDST() method
- Addition of Time.UnixMilli, Time.UnixMicro and to-Time helpers UnixMicro, UnixMilli methods
- Addition of comma "," support as separator for fraction seconds

For #44513
Fixes #46026

Change-Id: Ib8d3449d3b061f013112d33362b50e68ad6ddffa
Reviewed-on: https://go-review.googlesource.com/c/go/+/317913
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-02 14:51:05 +00:00
KimMachineGun
d743e67e06 doc/go1.17: document flag changes for Go 1.17
For #44513
Fixes #46010

Change-Id: I1fe638e5db0b4f3b64dbfbd948154a7c7a80afc9
GitHub-Last-Rev: d5bd53b1df
GitHub-Pull-Request: golang/go#46150
Reviewed-on: https://go-review.googlesource.com/c/go/+/319273
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Robert Findley <rfindley@google.com>
2021-06-02 14:28:15 +00:00
Tobias Klauser
dc8f87b749 runtime/internal/sys: generate //go:build lines in gengoos.go
For #41184

Change-Id: If7a1c3980f47bc28d0a13fe497eaba6178c65c91
Reviewed-on: https://go-review.googlesource.com/c/go/+/323750
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-06-02 08:17:59 +00:00
Ian Lance Taylor
84c0e5d47f cmd/link: move issue 43830 tests out of TestScript
These tests pass or fail depending on the exact compiler version,
which the TestScript tests don't support. Rewrite into Go.

For #43830
For #46295

Change-Id: I91b61dfe329d518e461ee56f186f0e9b42858e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/324049
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-06-02 00:36:24 +00:00
Keith Randall
cae68700cc runtime: fix formatting
Fix up a gofmt complaint from CL 310591.

Change-Id: I73534ef064a4cfc53539e5e65a8653e2cd684c64
Reviewed-on: https://go-review.googlesource.com/c/go/+/324090
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-02 00:20:16 +00:00
Ian Lance Taylor
567ee865f6 cmd/go: add declaration to cgo_lto_issue43830 test
This permits the test to work in C99 mode.

For #43830

Change-Id: Ide54bd62239cfe602e2664300f04e472df5daf43
Reviewed-on: https://go-review.googlesource.com/c/go/+/324009
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-01 21:14:02 +00:00
Ian Lance Taylor
24e9707cbf cmd/link, cmd/cgo: support -flto in CFLAGS
The linker now accepts unrecognized object files in external linking mode.
These objects will simply be passed to the external linker.
This permits using -flto which can generate pure byte code objects,
whose symbol table the linker does not know how to read.

The cgo tool now passes -fno-lto when generating objects whose symbols
it needs to read. The cgo tool now emits matching types in different
objects, so that the lto linker does not report a mismatch.

This is based on https://golang.org/cl/293290 by Derek Parker.

For #43505
Fixes #43830
Fixes #46295

Change-Id: I6787de213417466784ddef5af8899e453b4ae1ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/322614
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2021-06-01 19:59:18 +00:00
OneOfOne
272552275f A+C: update name
Change-Id: I1f88304858da5147bfd082c2fc2b7d24ed371cd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/321955
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-01 17:08:12 +00:00
Cherry Mui
2bec019fb5 doc/go1.17: add release notes for register ABI
Also delete the TODO for the linker section.

Updates #44513.
Updates #40724.

Change-Id: I4d62a907e8c3070831a052cdfe1e21648698df12
Reviewed-on: https://go-review.googlesource.com/c/go/+/323289
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-06-01 16:26:24 +00:00
Vitaly Zdanevich
2e59cc5fb4 cmd/go: add [-src] to documentation
Change-Id: I554b5021386575af6ff44571a95bb31b38a0547f
GitHub-Last-Rev: 20aaec3aa0
GitHub-Pull-Request: golang/go#45956
Reviewed-on: https://go-review.googlesource.com/c/go/+/317109
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
2021-06-01 13:23:26 +00:00
Jay Conrod
0b80cf1136 cmd/go: make 'go get' save sums for incidentally updated modules
When 'go get' updates a module, it may update another module in the
build list that provides a package in 'all' that wasn't loaded as part
of the 'go get' command. If 'go get' doesn't add a sum for that
module, builds may fail later.

With this change, 'go get' will fetch a sum for the content of an
updated module if we had a sum for the version before the update.

'go get' won't load the complete package graph, so there are still
cases where the build may be broken, like when an updated (but not
loaded) package imports a package from a new module.

Fixes #44129

Change-Id: I62eba3df4137a3e84e2ca8d549c36eec3670f08c
Reviewed-on: https://go-review.googlesource.com/c/go/+/322832
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-06-01 12:20:06 +00:00
Rob Findley
3b770f2ccb go/types: don't declare 'comparable' when typeparams are disabled
Fixes #46453

Change-Id: I92b9b1e43ec5182162b2eeeb667f1f548ea373a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/323609
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-30 17:47:50 +00:00
Rob Findley
1607c28172 go/types: unexport the GoVersion configuration option for Go 1.17
The GoVersion field was added to types.Config as part of the work on
type parameters. Specifically, it was added to be consistent with
cmd/compile/internal/types2, which requires such an option.

This configuration option is useful, but is also non-trivial and did not
go through the proposal process. Unexport it for Go 1.17; we can create
a proposal to export it for Go 1.18.

Fixes #46296

Change-Id: Id82d8a7096887dcfc404c4d6d8da9c761b316609
Reviewed-on: https://go-review.googlesource.com/c/go/+/323430
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-30 02:37:38 +00:00
Ian Lance Taylor
79bda65041 doc/go1.17: mention time.Layout
For #44513

Change-Id: Id4624e977654f7e8c489508a9dce98c9fab621a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/323490
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-05-29 01:59:17 +00:00
Ariel Mashraki
f6cc392d1d doc/go1.17: document text/template/parse.SkipFuncCheck
Documents the newly added mode that skips type checking
functions as per CL 301493.

Fixes #46025
For #34652
For #44513
For #38627

Change-Id: I56c4f65924702a931944796e39f43cfeb66abc8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/311569
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-05-29 00:16:11 +00:00
Ian Lance Taylor
1419ca7cea doc/go1.17: mention new definitions of MSG_CMSG_CLOEXEC
For #44513

Change-Id: I8c0070b116ee520a76726eb9d3dcbdd489a1fb1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323351
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:41:07 +00:00
Ian Lance Taylor
6624771c83 doc/go1.17: mention testing.[TB].Setenv methods
For #41260
For #44513

Change-Id: I47ac0c751dafeb05abfe66fdf77938774164915f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323353
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2021-05-28 18:36:54 +00:00
Ian Lance Taylor
bbda923592 doc/go1.17: mention new Windows SysProcAttr fields
For #44011
For #44513

Change-Id: I512466f2e775e36098eb36ca7ef82333cd9e632a
Reviewed-on: https://go-review.googlesource.com/c/go/+/323352
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:35:37 +00:00
Ian Lance Taylor
6f58088bd8 doc/go1.17: document new go/build/BuildContext.ToolTags field
For #44513

Change-Id: Ib21af742e574fcaa7e38bb437d42dbeed9d01f0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/323350
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 18:34:18 +00:00
Ian Lance Taylor
c295107708 doc/go1.17: mention new encoding/csv/Reader.FieldPos method
For #44221
For #44513

Change-Id: I2d2d1c55255f4411c11fd51f0f3ae726cbf4d136
Reviewed-on: https://go-review.googlesource.com/c/go/+/323349
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2021-05-28 18:33:29 +00:00
Ian Lance Taylor
ccd9784edf doc/go1.17: document new debug/elf constant
For #39677
For #44513

Change-Id: I8c4193fd4359b83e6739e7e30a3a42b5f21b0f1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/323275
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-28 04:09:07 +00:00
Rob Findley
3de3440fb9 go/ast: remove FuncDecl.IsMethod for Go 1.17
The IsMethod method was added to FuncDecl in the process of working on
support for type parameters, but is now only used in one place. It also
didn't go through the proposal process. Remove it for 1.17.

Also clean up a doc comment that mentioned type parameters.

Fixes #46297

Change-Id: I432bdd626324f613baf059540b7c5436985b2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/323369
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-28 03:34:02 +00:00
Ian Lance Taylor
639acdc833 doc/go1.17: clarify that compress/lzw Reader and Writer types are new
For #26535
For #44513
For #46005

Change-Id: I70d3711ab6451a61b526abb3da8e91243f637656
Reviewed-on: https://go-review.googlesource.com/c/go/+/323273
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2021-05-27 23:51:57 +00:00
Manlio Perillo
193d514131 net/http: correct Client.Do doc about context cancelation
The documentation of the Client.Do method and Get function incorrectly
stated that, in case of context cancelation, the returned url.Error
Timeout method returns true.

Update the documentation to correctly match the implementation.
See also CL 200798 that, due to an oversight, corrected only the
documentation of the Client.Get method.

Remove a TODO note added in CL 125575 (net/http: document that Client
methods always return *url.Error), since it is no longer applicable
after CL 200798 (net/http: fix and lock-in Client.Do docs on request
cancelation).

Fixes #46402

Change-Id: Ied2ee971ba22b61777762dbb19f16e08686634ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/323089
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-05-27 21:41:58 +00:00
Damien Neil
ab2ef4aaa7 doc/go1.17: document reflect changes
For #44513.
Fixes #46019.

Change-Id: Ica84edd5703a4ccf343ff01e10483f8d51d1c79f
Reviewed-on: https://go-review.googlesource.com/c/go/+/323069
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-27 20:59:35 +00:00
Jay Conrod
0ece95a0fe cmd/go: don't let 'go mod download' save sums for inconsistent requirements
'go mod download' calls modload.LoadModFile early to find the main
module path in order to validate arguments. LoadModFile may write
go.mod and go.sum to fix formatting and add a go directive. This calls
keepSums, which, in eager mode, loaded the complete module graph in
order to find out what sums are needed to load the complete module
graph. If go.mod requires a lower version of a module than will be
selected later, keepSums causes the sum for that version's go.mod to
be retained, even though it isn't needed later after a consistent
go.mod is written.

This CL fixes keepSums not to load the graph if it hasn't already been
loaded (whether eager or lazy), addressing comments from CL 318629.

For #45332

Change-Id: I20d4404004e4ad335450fd0fd753e7bc0060f702
Reviewed-on: https://go-review.googlesource.com/c/go/+/322369
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-27 20:38:20 +00:00
Roland Shoemaker
cdcd02842d net: verify results from Lookup* are valid domain names
For the methods LookupCNAME, LookupSRV, LookupMX, LookupNS, and
LookupAddr check that the returned domain names are in fact valid DNS
names using the existing isDomainName function.

Thanks to Philipp Jeitner and Haya Shulman from Fraunhofer SIT for
reporting this issue.

Fixes #46241
Fixes CVE-2021-33195

Change-Id: I47a4f58c031cb752f732e88bbdae7f819f0af4f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/323131
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-27 19:55:46 +00:00
Than McIntosh
8bf5bf5173 cmd/compile: improve debug locations for partially live in-params
During DWARF debug location generation, as a preamble to the main data
flow analysis, examine the function entry block to look for in-params
arriving in registers that are partially or completely dead, and
insert new OpArg{Int,Float}Reg values for the dead or partially-dead
pieces. In addition, add entries to the f.NamedValues table for
incoming live register-resident params that don't already have
entries. This helps create better/saner DWARF location expressions for
params. Example:

  func foo(s string, used int, notused int) int {
      return len(s) + used
  }

When optimization is complete for this function, the parameter
"notused" is completely dead, meaning that there is no entry for it in
the f.NamedValues table (which then means we don't emit a DWARF
variable location expression for it in the function enty block). In
addition, since only the length field of "s" is used, there is no
DWARF location expression for the other component of "s", leading to
degraded DWARF.

There are still problems/issues with DWARF location generation, but
this does improve things with respect to being able to print the
values of incoming parameters when stopped in the debugger at the
entry point of a function (when optimization is enabled).

Updates #40724.

Change-Id: I5bb5253648942f9fd33b081fe1a5a36208e75785
Reviewed-on: https://go-review.googlesource.com/c/go/+/322631
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-27 18:49:23 +00:00
Than McIntosh
56af34f875 cmd/compile: place reg spills after OpArg{Int,Float}Reg ops
Tweak the register allocator to maintain the invariant that
OpArg{Int,Float}Reg values are placed together at the start of the
entry block, before any other non-pseudo-op values. Without this
change, when the register allocator adds spills we can wind up with an
interleaving of OpArg*Reg and stores, which complicates debug location
analysis.

Updates #40724.

Change-Id: Icf30dd814a9e25263ecbea2e48feb840a6e7f2bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/322630
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-27 18:47:37 +00:00