1
0
mirror of https://github.com/golang/go synced 2024-11-16 19:14:43 -07:00
Commit Graph

50749 Commits

Author SHA1 Message Date
Pedro Lopez Mareque
c3c4a2bf65 math/bits: add examples for Add, Sub, Mul and Div
Change-Id: I2f3619aa827e18f356871511c20cf2c712f496b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/353189
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
2021-11-11 21:27:05 +00:00
Katie Hockman
9d89a5eb64 all: update terminology for fuzzing
This change doesn't modify any functionality.
It also doesn't update all of the comments and
variable names of the internal code, but everything
user facing should be correct.

Updates #49185

Change-Id: Ia8b2c94b89ba45897c4085ea0c17a3d8896f7ec7
Reviewed-on: https://go-review.googlesource.com/c/go/+/362794
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-11-11 21:06:07 +00:00
Robert Griesemer
ccd41cc05e go/types, types2: document nil scope for imported and instantiated Func objects
Also, don't set the scope anymore when instantiating (substituting)
a signature.

Per discussion with rfindley.

Change-Id: I560d4571c7ff14b0df3e15fece634cb5f9f94a99
Reviewed-on: https://go-review.googlesource.com/c/go/+/363435
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-11 20:45:40 +00:00
Keith Randall
10d3b13551 cmd/compile: ensure stenciled function bodies are nonempty
Our compiler gets confused between functions that were declared
with no body, and those which have a body but it is empty.

Ensure that when stenciling, we generate a nonempty body.

The particular test that causes this problem is in
cmd/compile/internal/gc/main.go:enqueueFunc. It thinks that if
a function has no body, then we need to generate ABI wrappers for
it, but not compile it.

Fixes #49524

Change-Id: Id962666a2098f60a2421484b6a776eafdc4f4a63
Reviewed-on: https://go-review.googlesource.com/c/go/+/363395
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-11 20:34:56 +00:00
Ian Lance Taylor
c622d1d3f6 go/build: skip rune literals when looking for go:embed
Fixes #49514

Change-Id: Id687eead731ba49974f11d2e5b489f11eff7d07b
Reviewed-on: https://go-review.googlesource.com/c/go/+/363275
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>
2021-11-11 20:25:49 +00:00
cuiweixie
eb68e3367b runtime: fix typo
Change filepath reference from cmd/internal/ld/symtab.go to
cmd/link/internal/ld/symtab.go.

Change-Id: Icb207a2e2c82d3976787d2d5cfb0f8005696f738
GitHub-Last-Rev: 428d99c6ca
GitHub-Pull-Request: golang/go#49518
Reviewed-on: https://go-review.googlesource.com/c/go/+/363276
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-11 20:25:07 +00:00
Michael Anthony Knyszek
46b2fc05a2 runtime: adjust TestPhysicalMemoryUtilization to handle large page sizes
Currently TestPhysicalMemoryUtilization can fail on systems with large
physical page sizes like 64 KiB because all the of the holes to be
scavenged are not aligned to the page size. The holes themselves are 64
KiB so this is actually quite likely.

Bump the size of the allocations for systems with larger physical page
sizes, and add additional slack to the threshold for unaligned pieces of
the holes that may be unaligned.

Fixes #49411.

Change-Id: Iafb35b8761dc9cdc53d3745c4771b1a64c5c97b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/363415
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-11-11 20:20:50 +00:00
Michael Anthony Knyszek
3e94140465 runtime/debug: make TestFreeOSMemory more robust
FreeOSMemory relies on the function FreeOSMemory increasing HeapReleased
as opposed to the background scavenger, because it reads memory stats
*after* the free of a large allocation. However, before that even
happens, the background scavenger can swoop in and release all that
memory, making it appear as if FreeOSMemory didn't do anything.

This change modifies the test to just make sure that the large
allocation's memory is returned to the OS *somehow*, by the end of the
test. It doesn't really care which happens. It also increases the size
of that large allocation to increase the likelihood that the test isn't
relying 100% on the background scavenger, and that FreeOSMemory is doing
some of the work.

Fixes #49478.

Change-Id: Ief1d839753720ebb88cbb616c46302293ee2d19c
Reviewed-on: https://go-review.googlesource.com/c/go/+/363414
Reviewed-by: David Chase <drchase@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-11-11 20:20:42 +00:00
Pavel
48f1cde942 database/sql: prevent closes slices from assigning to free conn
In function connectionCleanerRunLocked append to closing slice affects db.freeConns and vise versa. Sometimes valid connections are closed and some invalid not.

Change-Id: I5282f15be3e549533b7d994b17b2060db3c0e7da
GitHub-Last-Rev: b3eb3ab6f4
GitHub-Pull-Request: golang/go#49429
Reviewed-on: https://go-review.googlesource.com/c/go/+/362214
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-11 19:46:03 +00:00
Robert Griesemer
d60a4e69f1 spec: fix a broken link
Thanks for jtagcat@ for finding this.

Change-Id: If7324808edbae19ec8bf503b04e0426f3fb3b47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/363394
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-11 19:44:13 +00:00
hasheddan
f1935c5270 obj/riscv: fix link to risc-v dwarf register numbers
The repository name and structure in the RISC-V GitHub org has been
modified, rendering the existing link invalid. This updates to point at
the new location of the RISC-V DWARF specification.

Change occured in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/208

Change-Id: I8ca4c390bee2d7ce20418cdd00e4945a426cf5f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/363355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-11-11 19:41:06 +00:00
jiahua wang
8ce1a953fb io: add error check to TeeReader Example
Change-Id: I0b94bdced47483c6412e9979ce2d103fbfc52afb
Reviewed-on: https://go-review.googlesource.com/c/go/+/353729
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
2021-11-11 19:34:23 +00:00
Cherry Mui
84277bfd07 runtime: fix C compilation error in TestCgoTracebackGoroutineProfile
Use C89 declaration. Also fix indentation.

Change-Id: Ib974eb32ac95610d0b0eca00ca3b139b388c73bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/363356
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-11 18:32:21 +00:00
Cuong Manh Le
73a4bbb0df cmd/compile: fix missing ddd when building call for function instantiation closure
When building a call expression for function instantiation closure, if
it's a variadic function, the CallExpr.IsDDD must be set for typecheck
to work properly. Otherwise, there will be a mismatch between the
arguments type and the function signature.

Fixes #49516

Change-Id: I0af90ee3fcc3e6c8bba8b20e331e044cbce17985
Reviewed-on: https://go-review.googlesource.com/c/go/+/363314
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-11-11 17:18:13 +00:00
Neil Alexander
666fc173c0 doc/go1.18: document http.Transport.Dial* being used in js/wasm
This PR adds a note into the Go 1.18 changelog for CL 330852.

Updates #46923.

Change-Id: I99150e9275ce23fcf3697d6a22ac216818223c74
GitHub-Last-Rev: b2772ce68b
GitHub-Pull-Request: golang/go#49258
Reviewed-on: https://go-review.googlesource.com/c/go/+/360297
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-11 16:17:21 +00:00
Cherry Mui
8c73f80400 runtime: bypass scheduler when doing traceback for goroutine profile
When acquire a goroutine profile, we stop the world then acquire a
stack trace for each goroutine. When cgo traceback is used, the
traceback code may call the cgo traceback function using cgocall.
As the world is stopped, cgocall will be blocked at exitsyscall,
causing a deadlock. Bypass the scheduler (using asmcgocall) to fix
this.

Change-Id: Ic4e596adc3711310b6a983d73786d697ef15dd72
Reviewed-on: https://go-review.googlesource.com/c/go/+/362757
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-11 15:34:02 +00:00
Bryan C. Mills
47b3ab5ede doc/go1.18: add a release note for 'go mod vendor -o'
For #47327

Change-Id: I50418c0d017c4e90a2c13d26945ee639079e4e33
Reviewed-on: https://go-review.googlesource.com/c/go/+/363174
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Paschalis Tsilias <paschalistsilias@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-11 14:57:18 +00:00
Than McIntosh
d76b1ac3e1 net: skip new testpoint TestUDPIPVersionReadMsg on plan9
Skip TestUDPIPVersionReadMsg on plan9, since it does things
not supported on that OS.

Change-Id: Icd1716fb5ed4e8877e57acb8c851ec3be72e83e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/363354
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-11 13:58:28 +00:00
Than McIntosh
c49627e81b cmd/compile: use canonical stringslice/ representations in abiutils
A chunk of code in abiutils was synthesizing the internals of a Go
string type as "struct { unsafe.Pointer, uintptr }" instead of the
more canonical representation "struct { *uint8, int }" used elsewhere
in the compiler. The abiutils type was being pulled into the code
during late call expansion, which resulted in two different entries in
the SSA named value table for the same variable piece, each with
different types; this then confused DWARF location list generation.
This patch changes the abiutils synthesized type to be consistent with
other parts of the back end, and makes a similar change for
synthesized slice types (use "struct { *uint8, int, int }").

Fixes #47354.

Change-Id: If789031cdc7abaf215bc75ee6eb863defbe530be
Reviewed-on: https://go-review.googlesource.com/c/go/+/362715
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-11-11 11:47:33 +00:00
Than McIntosh
79e03a9281 cmd/compile: include register-resident output params in DWARF-gen
During the register ABI work, a change was made in CL 302071 to
"stackframe" to treat register-resident output parameter (PARAMOUT)
variables that same as locals, which meant that if they were unused,
we'd delete them from the "Dcl" slice. This has the effect of making
them invisible to DWARF generation later on in the pipeline, meaning
that we don't get DIEs for them in the debug info. This patch fixes
the problem by capturing these params prior to optimization and then
adding them back in for consideration when we're processing the
params/locals of a function during DWARF generation.

Fixes #48573.

Change-Id: I2b32882911c18f91c3e3d009486517522d262685
Reviewed-on: https://go-review.googlesource.com/c/go/+/362618
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-11-11 11:47:18 +00:00
Than McIntosh
e9ef931e06 cmd/compile/internal/ssa: fix debug location gen issue with zero width ops
Revamp the way that buildLocationLists() handles zero-width
operations, to fix a couple of problems that result in bad debug
locations.

The problematic scenario in this specific bug is where you have a
parameter arriving in a register X, then a spill of register X to
memory as the first non-zero-width instruction in the function.
Example:

    v68 = ArgIntReg <unsafe.Pointer> {ctx+0} [1] : BX (ctx[unsafe.Pointer])
    v67 = ArgIntReg <unsafe.Pointer> {ctx+8} [2] : CX (ctx+8[unsafe.Pointer])
    ...
    v281 = StoreReg <unsafe.Pointer> v67 : ctx+8[unsafe.Pointer]

The existing buildLocationLists implementation effectively buffers or
bundles changes from zero-width instructions until it it sees a
non-zero-width instruction, but doing that in this case winds up
making it look as though the parameter is live into the function in
memory, not in a register.

The fix for this to separate out zero-width ops into two distinct
categories: those that whose lifetimes begin at block start (ex:
OpArg, Phi) and those whose effects are taking place at the nearest
non-zero-width instruction (ex: OpSelect0). In this patch we now
handle the first category of ops in an initial pre-pass for each
block, and leave the second category for the main pass through the
block. See the notes on the issue below for a more detailed
explanation of the failure mode.

Fixes #46845.

Change-Id: I27488d4c041019d5a0b897b7cf53000f63aab1cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/362244
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-11-11 11:47:08 +00:00
Jason A. Donenfeld
a01a6d6efe net: add conversion from AddrPort to TCPAddr to complement existing inverse
We already have various member functions of TCPAddr that return an
AddrPort, but we don't have a helper function to go from a AddrPort to a
TCPAddr. UDP has this, but it was left out of TCP. This commit adds the
corresponding function.

Updates #49298.

Change-Id: I85732cf34f47c792fe13a6b4af64fd4b0e85d06a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362596
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-11 11:00:33 +00:00
Dmitry Vyukov
1ec51087e5 cmd/link/internal/loadelf: better error message for ignored symbols
Currently it's quite hard to debug these error messages about ignored symbols
because there are only some numbers and no symbol name. Add symbol name. Before:
135029: sym#952: ignoring symbol in section 11 (type 0)
After:
135029: sym#952 (_ZN11__sanitizer9SpinMutexC5Ev): ignoring symbol in section 11 (type 0)

Change-Id: I7fec50b5798068c74827376613be529803838c5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/363034
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitry Vyukov <dvyukov@google.com>
2021-11-11 07:03:15 +00:00
Ian Lance Taylor
99fa49e4b7 lib/time, time/tzdata: update to 2021e
Doing this a little early in the release cycle as there have been some
changes in the handling of old timezones. They should continue to
work as expected, but more testing time may be useful.

For #22487

Change-Id: I3686fed79a052c46112445055044cff5842f2a45
Reviewed-on: https://go-review.googlesource.com/c/go/+/362874
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-11-11 05:16:39 +00:00
Ian Lance Taylor
4b27d40b50 misc/cgo/testshared: correct test of gccgo version number
We still don't run the gccgo tests, because they don't run in module mode.
But now we at least get the version number check right.

Change-Id: Ifde4512c30605d1cb7e3a521f381a05c783549b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/362996
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-11 04:54:05 +00:00
Changkun Ou
d5a5a13ad9 sync: clarify the validity to call Map methods inside Range
This change clarifies that calling all Map methods inside the callback
of Range is allowed. For further assurance, a nested range call test
is also added.

Fixes #46399

Change-Id: I0a766a5c1470e6b573ec35df1ccd62b2e46f1561
Reviewed-on: https://go-review.googlesource.com/c/go/+/337389
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2021-11-11 04:41:56 +00:00
Ian Lance Taylor
3949faf72e test: add test that was miscompiled by gccgo
For #49512

Change-Id: Ic08652a4ec611b27150bf10b1118c1395715e5d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/363156
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>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-11-11 04:02:33 +00:00
Jason A. Donenfeld
4d0683965b net: do more faithful conversion from AddrPort to UDPAddr
A UDPAddr with a nil IP is a valid state, representing an AF-agnostic
unspecified address, so checking for addr.IsValid() isn't correct;
remove that, as it's only needed in the UDP rx path where it can be
added. Secondly, forcing everything to be IPv6 also is not correct, and
was likely done when the missing .AsSlice() made doing the right thing
less ergonomic. Fix this by using .AsSlice(), which properly preserves
IP version.

Change-Id: Idd1eaecd4076f32a843f859a0a9802ef98f956d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/361478
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-11-10 22:16:25 +00:00
Robert Griesemer
23f653df96 cmd/compile/internal/types2: remove structuralString in favor of inlined code
structuralString was used only in one place (for built-in copy).
Remove it in favor of custom and more efficient inlined code.

Follow-up on feedback received for CL 363075.

Change-Id: Ic5857c47255c5c712be7971aae4542fef9960fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/363154
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-10 21:59:24 +00:00
Robert Griesemer
96c94c2c83 cmd/compile/internal/types2: slightly relax notion of structural type
If we have all channel types in a constraint, there is no structural type
if they don't all have the same channel direction (and identical element
types, of course). By allowing different channel types for the purposes of
the structural type, as long as there is not a send-only _and_ a receive-
only channel in the type set, we make it possible to find a useful, if
restricted by channel direction, structural type where before there was
none.

So if we have unrestricted and send-only channels, the structural type is
the send-only channel, and vice versa.

For all operations on channels that rely on a structural type, it's always
ok to have an unrestricted channel, so this is not affecting their behavior.
But it makes those operations more flexible in the presence of type parameters
containing mixed channel types.

For constraint type inference, where we currently may not infer a channel
at all, this change allows us to infer a more restricted channel (send- or
receive-only). If the inferred channel type is a valid type argument we win;
if not we haven't lost anything.

Use structuralType for send and receive operations and adjust related
error messages (the error message that change are the ones involving
type parameters, so historic error messages are preserved).

Fixes #45920.

Change-Id: If3a64d29c37e7734d3163df330f8b02dd032bc60
Reviewed-on: https://go-review.googlesource.com/c/go/+/363075
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 21:59:23 +00:00
Dan Scales
229b909313 cmd/compile: don't do Resolve on OKEY identifiers during import
For generic functions, we can export untransformed OKEY nodes, and the
key identifier is written as an ONONAME. But in this case, we do not
want to call Resolve() on the identifier, since we may resolve to a
global type (as happens in this issue) or other global symbol with the
same name, if it exists. We just want to keep the key identifier as an
Ident node.

To solve this, I added an extra bool when exporting an ONONAME entry,
which indicates if this entry is for a key or for a global (external)
symbol. When the bool is true (this is for a key), we avoid calling
Resolve().

Fixes #49497

Change-Id: Ic8fa93d37bcad2110e0e0d060080b733e07e35d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/363074
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-11-10 21:53:03 +00:00
Paschalis Tsilias
f410786c5f cmd/go: add 'go mod vendor -o' flag
Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location for use by other tools.
The argument can be a relative or an absolute path.
This flag has no other influence on how the command behaves.

Fixes #47327

Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Reviewed-on: https://go-review.googlesource.com/c/go/+/338149
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-10 21:32:50 +00:00
Michael Anthony Knyszek
a881409960 runtime: rewrite TestPhysicalMemoryUtilization
This test changes TestPhysicalMemoryUtilization to be simpler, more
robust, and more honest about what's going on.

Fixes #49411.

Change-Id: I913ef055c6e166c104c62595c1597d44db62018c
Reviewed-on: https://go-review.googlesource.com/c/go/+/362978
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-11-10 20:45:04 +00:00
emahiro
b2d826c09f internal/cache: document 'go clean -fuzzcache' in README
Fixes: #48900

Change-Id: I9235441886ed7cbdfdcbd283480f52d9216c3ea2
Reviewed-on: https://go-review.googlesource.com/c/go/+/357233
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
2021-11-10 20:04:06 +00:00
Robert Griesemer
23dd389ac6 cmd/compile/internal/types2: refer to structural rather than single underlying type in errors
This brings the error messages in sync with the terminology that
will be used it the spec.

Change-Id: Ia05993776c649be9eb2cdf948a583b9a49f9b192
Reviewed-on: https://go-review.googlesource.com/c/go/+/362997
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-11-10 18:24:20 +00:00
Robert Griesemer
6406e09f69 cmd/compile/internal/types2: move some functions into different files (cleanup)
- move structuralType/structuralString into type.go
- move functions exported for the compiler into compilersupport.go
- updated/added comments
- removed AsNamed and AsInterface - not needed by compiler

No semantic changes.

Change-Id: Ia454a49edafd627c2a25b0b71db4aa93ddd7f1f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/362995
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 18:24:14 +00:00
Robert Findley
097aaa9cd6 go/doc: don't treat functions returning type parameters as constructors
Functions returning type parameters were erroneously being interpreted
as 'constructors' of their type parameter, resulting in them being
excluded from documentation. Fix this by explicitly excluding type
parameters when looking for defined type names among function results.

Fixes #49477

Change-Id: I22510f655f47e192a852332df5b91740f46c51eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/362758
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-10 18:06:32 +00:00
Robert Griesemer
8a3be15077 cmd/compile/internal/types2: rename structure to structuralType
And rename structureString to structuralString.

Now that we have an updated definition for structural types in
the (forthcoming) spec, name the corresponding function accordingly.

No semantic changes.

Change-Id: Iab838f01a37075bedf2d8bc4f166b0217672b85f
Reviewed-on: https://go-review.googlesource.com/c/go/+/362994
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-10 17:15:54 +00:00
Robert Griesemer
0aa194f758 cmd/compile/internal/types2: use type variables consistently in Checker.conversion
We have V and T and Vu and Tu. When calling the various isX predicates
consistently use Vu and Tu.

(We could also use V an T because the predicates call under anyway,
but using Vu and Tu removes an unnecessary call to Named.under if
V or T are *Named.)

Also, removed some outdated comments.

Change-Id: I6fcd9ce5f6292e89ac2afd597b72fd0790e84ff1
Reviewed-on: https://go-review.googlesource.com/c/go/+/362895
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 17:15:52 +00:00
Robert Griesemer
17980dff36 doc: make a copy of the latest Go 1.17 spec
This will allow us to compare the changes made for Go 1.18.

Change-Id: I1456270b201967f5cb05e66cec556939e6e33265
Reviewed-on: https://go-review.googlesource.com/c/go/+/362894
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-10 05:08:25 +00:00
Hajime Hoshi
e984240d31 runtime: fix unworkable comments for go:nosplit
Change-Id: I71c29a2dc7e5b2b6bc35093535228d2907b16b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/361595
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
2021-11-10 02:57:43 +00:00
Robert Findley
02d7eab527 go/parser: allow parsing aliases with type parameters
We already guard against this in the type checker, and it will
eventually be allowed per the accepted proposal.

Add a placeholder error code for the corresponding type checker error.

Change-Id: I5cc2f1413ecc89ec2094f7178fdb156fb8cc2e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/360235
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-11-10 02:26:41 +00:00
Robert Findley
57dc6e2475 go/types: disallow type cycles through type parameter lists
This is a port of CL 361922 to go/types.

Change-Id: I790c8121a640c25fb655c926fb434d667dd59f76
Reviewed-on: https://go-review.googlesource.com/c/go/+/362756
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-11-10 01:34:56 +00:00
Robert Griesemer
cc14fcac2b cmd/compile/internal/types2: disallow type cycles through type parameter lists
If we reach a generic type that is part of a cycle
and we are in a type parameter list, we have a cycle
through a type parameter list, which is invalid.

Fixes #49439.

Change-Id: Ia6cf97e1748ca0c0e61c02841202050091365b0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/361922
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 00:56:09 +00:00
Robert Griesemer
318c024b49 cmd/compile/internal/types2: rename Checker.cycle to Checker.validCycle
Also, invert the boolean result. This matches Checker.validType;
it's also easier to understand. Preparation for the next CL which
detects cycles through type parameter lists.

Change-Id: I00a75d2359ca20827c9bf406945508716c826fc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/362336
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 00:56:02 +00:00
Robert Findley
ec86bb52ba go/types: rename Checker.cycle to Checker.validCycle
This is a clean port of CL 362336 to go/types.

Change-Id: Iafeae7024fbb2872b07748affcea9676324ea59e
Reviewed-on: https://go-review.googlesource.com/c/go/+/362755
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-11-10 00:45:37 +00:00
Robert Findley
f5f9434091 go/types: remove most asX converters (cleanup)
This is a port of CL 362118 to go/types, which is itself a roll-forward
of CL 362254, containing a bugfix.

Change-Id: I20067c7adf56bf64fe9ad080d998a7aefbdc1053
Reviewed-on: https://go-review.googlesource.com/c/go/+/362617
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-11-10 00:44:59 +00:00
Illirgway
578ada410d mime: keep parsing after trailing semicolon
Fixes #46323

Change-Id: Ibd624b1aaa15f907b7eb965b4eaec61018a45486
GitHub-Last-Rev: 7ad670b088
GitHub-Pull-Request: golang/go#47029
Reviewed-on: https://go-review.googlesource.com/c/go/+/332509
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2021-11-09 22:58:24 +00:00
Michael Matloob
795cb333d9 cmd/go: add go work sync command
Change-Id: I09b22f05035700e1ed90bd066ee8f77c3913286a
Reviewed-on: https://go-review.googlesource.com/c/go/+/358540
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-09 22:20:29 +00:00
Robert Findley
1c86beeadf go/types: report error for incomplete struct composite literal type
This is a port of CL 361412 to go/types.

Change-Id: Ie5bccc7faba7ca9230e712f867b27ca9dcddba79
Reviewed-on: https://go-review.googlesource.com/c/go/+/362739
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-11-09 22:14:26 +00:00