1
0
mirror of https://github.com/golang/go synced 2024-11-17 21:04:43 -07:00
Commit Graph

46700 Commits

Author SHA1 Message Date
Robert Griesemer
2ff1e05a4c [dev.typeparams] all: update parent repository
Change-Id: Ib38d42f99e6a28970970e64c31cccac5bc3f25b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/293955
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 22:34:52 +00:00
Robert Griesemer
8960ce7735 [dev.typeparams] cmd/compile/internal/types2: minor adjustments to match go/types more closely
Change-Id: Ib0144e0dd33e9202037e461a85f72f5db08ebd3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/293631
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:37 +00:00
Robert Griesemer
6f3878b942 [dev.typeparams] cmd/compile/internal/types: review of typestring_test.go
The changes between (equivalent, and reviewed) go/types/typestring_test.go
and typestring_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I66150c0ab738763d2d8b94483ef8314cbe28a374
Reviewed-on: https://go-review.googlesource.com/c/go/+/293473
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:32 +00:00
Robert Griesemer
d6bdd1aeef [dev.typeparams] cmd/compile/internal/types: review of typestring.go
The changes between (equivalent, and reviewed) go/types/typestring.go
and typestring.go can be seen by comparing patchset 1 and 3. The actual
change is just removing the "// UNREVIEWED" marker plus an adjustment
to writeTParamList (we now always write type constraints).

Change-Id: Ieb109c17756addc954e1ca0da606fa5b335ff30d
Reviewed-on: https://go-review.googlesource.com/c/go/+/293472
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:27 +00:00
Robert Griesemer
c2314babb8 [dev.typeparams] cmd/compile/internal/types: review of type.go
The changes between (equivalent, and reviewed) go/types/type.go
and type.go can be seen by comparing patchset 1 and 3. The actual
change is just removing the "// UNREVIEWED" marker and some
comment adjustments.

Change-Id: Ied0e2f942bc96a9fcae0466761cfaa60a87668db
Reviewed-on: https://go-review.googlesource.com/c/go/+/293471
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:22 +00:00
Robert Griesemer
099374b55e [dev.typeparams] cmd/compile/internal/types2: remove Type.Under method in favor of function
This removes the need for the aType embedded type and brings the types2.Type
API in sync with the go/types.Type API.

For reasons not fully understood yet, introducing the new under function
causes a very long initialization cycle error, which doesn't exist in
go/types. For now, circumvent the problem through a helper function variable.

This CL also eliminates superflous (former) Under() method calls
inside optype calls (optype takes care of this).

Plus some minor misc. cleanups and comment adjustments.

Change-Id: I86e13ccf6f0b34d7496240ace61a1c84856b6033
Reviewed-on: https://go-review.googlesource.com/c/go/+/293470
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-02-18 20:47:17 +00:00
Robert Griesemer
653386a89a [dev.typeparams] cmd/compile/internal/types2: replace Named, TypeParam methods with functions
This removes two more converter methods in favor of functions.
This further reduces the API surface of types2.Type and matches
the approach taken in go/types.

Change-Id: I3cdd54c5e0d1e7664a69f3697fc081a66315b969
Reviewed-on: https://go-review.googlesource.com/c/go/+/293292
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:11 +00:00
Robert Griesemer
5e4da8670b [dev.typeparams] cmd/compile/internal/types2: use converter functions rather than methods
This change replaces methods with functions to reduce the API surface of
types2.Type and to match the approach taken in go/types. The converter
methods for Named and TypeParam will be addressed in a follow-up CL.

Also: Fixed behavior of optype to return the underlying type for
      arguments that are not type parameters.

Change-Id: Ia369c796754bc33bbaf0c9c8478badecb729279b
Reviewed-on: https://go-review.googlesource.com/c/go/+/293291
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-18 20:47:07 +00:00
Rob Findley
5ecb9a7887 [dev.typeparams] go/types: use a new ast.ListExpr for multi-type instances
Modify go/parser to consistently represent type instantiation as an
ast.IndexExpr, rather than use an ast.CallExpr (with Brackets:true) for
instantiations with multiple type parameters. To enable this, introduce
a new ast expr type: ListExpr.

This brings go/types in line with types2, with the exception of a small
change to funcInst to eliminate redundant errors if values are
erroneously used as types. In a subsequent CL, call.go and expr.go will
be marked as reviewed.

This also catches some type instance syntax using '()' that was
previously accepted incorrectly. Tests are updated accordingly.

Change-Id: I30cd0181c7608f1be7486a9a8b63df993b412e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/293010
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-18 20:38:41 +00:00
Rob Findley
7b679617f3 [dev.typeparams] go/types: conversions to type parameters are not constant
This is a port of CL 290471 to go/types. However, this change preserves
the existing check for constant types in recordTypeAndValue, which uses
is(..., isConstType) rather than the isConstType predicate. In types2,
this code path is not hit with type parameters because convertUntyped
walks the type list in order before calling updateExprType with the type
parameter, at which point the expression type would have already been
recorded as the first element of the type list -- probably something
that should be corrected.

Longer term, I believe we actually could allow const type parameters if
the optype is a sum of constant types.

Change-Id: Iaa91ffa740b5f08a5696bd96918a866bffd7aef6
Reviewed-on: https://go-review.googlesource.com/c/go/+/291323
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-18 14:58:11 +00:00
Rob Findley
f5d0c653e6 [dev.typeparams] merge master (2f0da6d) into dev.typeparams
This was a mostly clean merge, with the exception of codereview.cfg and
changes in src/go/types.

codereview.cfg for dev.typeparams is preserved in this CL. It should be
deleted before merging back to master.

The go/types changes were merged manually. For the most part this
involved taking the union of patches, with the following exceptions:
 + declInfo.aliasPos is removed, as it is not necessary in
   dev.typeparams where we have access to the full TypeSpec.
 + Checker.overflow is updated to use the asBasic converter.
 + A TODO is added to errorcodes.go to ensure that go1.16 error codes
   are preserved.

Change-Id: If9595196852e2163e27a9478df1e7b2c3704947d
2021-02-17 20:04:03 -05:00
Dan Scales
e196cb8258 [dev.typeparams] cmd/dist: disable -G=3 on the std go tests for now
Disable -G=3 tests on the std go tests, in order to see if -G=3 is
causing the flakiness for the dev.typeparams builder, as opposed to
other changes in typeparams branch. It's possible that -G=3 is using
more CPU/RAM that causes flakiness, as opposed to more specific bugs.

Change-Id: I610bce2aabd26b2b1fddc5e63f85ffe4e958e0d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/292850
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-17 17:00:37 +00:00
Rob Findley
2f0da6d9e2 go/types: revert "no 'declared but not used' errors for invalid var decls"
This reverts commit CL 289712 (afd67f3). It breaks x/tools tests, and
those tests highlight that perhaps I didn't think through the
repercussions of this change as much as I should have.

Fixes #44316

Change-Id: I5db39b4e2a3714131aa22423abfe0f34a0376192
Reviewed-on: https://go-review.googlesource.com/c/go/+/292751
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-17 01:29:54 +00:00
Cherry Zhang
70c37ee7d0 cmd/compile/internal/test: gofmt abiutils_test.go
Turns out that file is not formatted properly in the dev.regabi
branch.

Change-Id: I93125e65d5d3e8448c6ec1f077332c9bf7f0dd26
Reviewed-on: https://go-review.googlesource.com/c/go/+/292594
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-17 00:04:02 +00:00
Cherry Zhang
84825599dc all: merge branch dev.regabi (d3cd4830ad) into master
This CL merges the dev.regabi branch to the master branch.

In the dev.regabi branch we have refactored the compiler, and laid
some preliminary work for enabling a register-based ABI (issue #40724),
including improved late call/return lowering, improved ABI wrapper
generation, reflect call prepared for the new ABI, and reserving
special registers in the internal ABI. The actual register-based ABI
has not been enabled for the moment. The ABI-related changes are behind
GOEXPERIMENT=regabi and currently off by default.

Updates #40724, #44222.
Fixes #44224.

Change-Id: Id5de9f734d14099267ab717167aaaeef31fdba70
2021-02-16 17:18:37 -05:00
Cherry Zhang
d3cd4830ad [dev.regabi] test: run abi/regabipragma test with -c=1
Currently, we call Warnl in SSA backend when we see a function
(defined or called) with regparams pragma. Calling Warnl in
concurrent environment is racy. As the debugging output is
temporary, for testing purposes we just pass -c=1. We'll remove
the pragma and the debugging print some time soon.

Change-Id: I6f925a665b953259453fc458490c5ff91f67c91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/291710
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
2021-02-16 21:51:58 +00:00
Cherry Zhang
03cea563d1 [dev.regabi] all: merge master (5faf941) into dev.regabi
Merge List:

+ 2021-02-16 5faf941df0 internal/goversion: update Version to 1.17
+ 2021-02-16 6f3da9d2f6 README: pull gopher image from website
+ 2021-02-16 098504c73f cmd/link: generate trampoline for inter-dependent packages
+ 2021-02-16 1004a7cb31 runtime/metrics: update documentation to current interface
+ 2021-02-16 6530f2617f doc/go1.16: remove draft notice
+ 2021-02-16 353e111455 doc/go1.16: fix mismatched id attribute
+ 2021-02-16 f0d23c9dbb internal/poll: netpollcheckerr before sendfile
+ 2021-02-16 0cb3415154 doc: remove all docs not tied to distribution
+ 2021-02-16 626ef08127 doc: remove install.html and install-source.html
+ 2021-02-16 30641e36aa internal/poll: if copy_file_range returns 0, assume it failed
+ 2021-02-15 33d72fd412 doc/faq: update generics entry to reflect accepted proposal
+ 2021-02-15 852ce7c212 cmd/go: provide a more helpful suggestion for "go vet -?"
+ 2021-02-13 66c27093d0 cmd/link: fix typo in link_test.go

Change-Id: I98f047b79b93c5ceb344dd43408bcb919b23aeb3
2021-02-16 16:18:19 -05:00
Cherry Zhang
b8fb049c7a [dev.regabi] cmd/go: copy internal/abi in TestNewReleaseRebuildsStalePackagesInGOPATH
The internal/abi package is used by runtime and needs to be
copied.

Fix longtest builders.

Change-Id: I7a962df3db2c6bf68cc6a7da74b579f381920009
Reviewed-on: https://go-review.googlesource.com/c/go/+/292592
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
2021-02-16 21:17:18 +00:00
Bryan C. Mills
5faf941df0 internal/goversion: update Version to 1.17
(The corresponding update for the last release cycle was CL 248038.)

For #40705.

Change-Id: I13becdc4c3718a1c6986876ec56879cce3bcb34f
Reviewed-on: https://go-review.googlesource.com/c/go/+/275297
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-16 21:07:42 +00:00
Rob Findley
ed55da46ab [dev.regabi] go/types: overlapping embedded interfaces requires go1.14
This is an exact port of CL 290911 to go/types.

For #31793

Change-Id: I28c42727735f467a5984594b455ca58ab3375591
Reviewed-on: https://go-review.googlesource.com/c/go/+/291319
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-02-16 21:01:52 +00:00
Rob Findley
7696c94334 [dev.regabi] go/types: type alias decl requires go1.9
This is a port of CL 289570 to go/types. It has some notable differences
with that CL:
 + A new _BadDecl error code is added, to indicate declarations with bad
   syntax.
 + declInfo is updated hold not an 'alias' bool, but an aliasPos
   token.Pos to identify the location of the type aliasing '=' token.
   This allows for error messages to be accurately placed on the '='

For #31793

Change-Id: Ib15969f9cd5be30228b7a4c6406f978d6fc58018
Reviewed-on: https://go-review.googlesource.com/c/go/+/291318
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-16 21:01:14 +00:00
Michael Anthony Knyszek
c2358a1ae7 [dev.regabi] runtime: stub out spillArgs and unspillArgs
Currently these two functions assume that constants in internal/abi are
set correctly, but we actually just made them zero if
GOEXPERIMENT_REGABI is set. This means reflectcall is broken. Fix it by
stubbing out these routines even if GOEXPERIMENT_REGABI is set.

Change-Id: I4c8df6d6af28562c5bb7b85f48c03d37daa9ee0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/292650
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2021-02-16 20:42:26 +00:00
Michael Anthony Knyszek
8cfbf34dd9 internal/abi: set register count constants to zero for regabi experiment
This change sets the register count constants to zero for the
GOEXPERIMENT regabi because currently the users of it (i.e. reflect)
will be broken, since they expect Go functions that implement the new
ABI.

Change-Id: Id3e874c61821a36605eb4e1cccdee36a2759f303
Reviewed-on: https://go-review.googlesource.com/c/go/+/292649
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2021-02-16 19:40:58 +00:00
Ian Lance Taylor
6f3da9d2f6 README: pull gopher image from website
Fixes breakage accidentally introduced by https://golang.org/cl/291711.

Fixes #44295

Change-Id: I76f3e5577d1d24027d4ed2a725b5b749ab2d059c
Reviewed-on: https://go-review.googlesource.com/c/go/+/292629
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-02-16 18:25:10 +00:00
Cherry Zhang
d28aae26b0 [dev.regabi] cmd/link: recognize internal/abi as runtime package
The runtime imports the internal/abi package. Recognize
internal/abi as a runtime dependent, to make trampoline generation
algorithm work.

Fix ARM build.

Change-Id: I26b6778aa41dcb959bc226ff04abe08a5a82c4f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/292610
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-16 18:21:51 +00:00
Cherry Zhang
098504c73f cmd/link: generate trampoline for inter-dependent packages
Currently, in the trampoline generation pass we expect packages
are laid out in dependency order, so a cross-package jump always
has a known target address so we can check if a trampoline is
needed. With linknames, there can be cycles in the package
dependency graph, making this algorithm no longer work. For them,
as the target address is unkown we conservatively generate a
trampoline. This may generate unnecessary trampolines (if the
packages turn out laid together), but package cycles are extremely
rare so this is fine.

Updates #44073.

Change-Id: I2dc2998edacbda27d726fc79452313a21d07787a
Reviewed-on: https://go-review.googlesource.com/c/go/+/292490
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-16 17:42:55 +00:00
Branden J Brown
1004a7cb31 runtime/metrics: update documentation to current interface
The package documentation referenced sample metadata that was removed in CL 282632. Update this documentation to be less specific
about what metadata is available.

Additionally, the documentation on the Sample type referred to Descriptions instead of All as the source of metrics names.

Fixes #44280.

Change-Id: I24fc63a744bf498cb4cd5bda56c1599f6dd75929
Reviewed-on: https://go-review.googlesource.com/c/go/+/292309
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-16 16:26:30 +00:00
Dmitri Shuralyov
6530f2617f doc/go1.16: remove draft notice
Fixes #40700.

Change-Id: I99ed479d1bb3cdf469c0209720c728276182a7a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291809
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-16 16:26:11 +00:00
KimMachineGun
353e111455 doc/go1.16: fix mismatched id attribute
For #40700.

Change-Id: I186a21899404bfb79c08bfa8623caf9da74b6b0d
GitHub-Last-Rev: 25d240db3c
GitHub-Pull-Request: golang/go#44145
Reviewed-on: https://go-review.googlesource.com/c/go/+/290329
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-16 15:56:38 +00:00
Michael Anthony Knyszek
e0215315f5 [dev.regabi] reflect: support for register ABI on amd64 for reflect.(Value).Call
This change adds support for the new register ABI on amd64 to
reflect.(Value).Call. If internal/abi's register counts are non-zero,
reflect will try to set up arguments in registers on the Call path.

Note that because the register ABI becomes ABI0 with zero registers
available, this should keep working as it did before.

This change does not add any tests for the register ABI case because
there's no way to do so at the moment.

For #40724.

Change-Id: I8aa089a5aa5a31b72e56b3d9388dd3f82203985b
Reviewed-on: https://go-review.googlesource.com/c/go/+/272568
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-02-16 15:51:50 +00:00
Wei Fu
f0d23c9dbb internal/poll: netpollcheckerr before sendfile
In net/http package, the ServeContent/ServeFile doesn't check the I/O
timeout error from chunkWriter or *net.TCPConn, which means that both
HTTP status and headers might be missing when WriteTimeout happens. If
the poll.SendFile() doesn't check the *poll.FD state before sending
data, the client will only receive the response body with status and
report "malformed http response/status code".

This patch is to enable netpollcheckerr before sendfile, which should
align with normal *poll.FD.Write() and Splice().

Fixes #43822

Change-Id: I32517e3f261bab883a58b577b813ef189214b954
Reviewed-on: https://go-review.googlesource.com/c/go/+/285914
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
2021-02-16 11:01:41 +00:00
Russ Cox
0cb3415154 doc: remove all docs not tied to distribution
They have moved to x/website in CL 291693.
The docs that are left are the ones that are edited at the same time
as development in this repository and are tied to the specific version
of Go being developed. Those are:

 - the language spec
 - the memory model
 - the assembler manual
 - the current release's release notes

Change-Id: I437c4d33ada1b1716b1919c3c939c2cacf407e83
Reviewed-on: https://go-review.googlesource.com/c/go/+/291711
Trust: Russ Cox <rsc@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-16 02:07:02 +00:00
Russ Cox
626ef08127 doc: remove install.html and install-source.html
These live in x/website/content/doc now.
The copies here just attract edits that have no actual effect.

For #40496.
For #41861.

Change-Id: I2fdd7375e373949eb9a88f4cdca440b6a5d45eea
Reviewed-on: https://go-review.googlesource.com/c/go/+/291709
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-16 02:06:56 +00:00
Ian Lance Taylor
30641e36aa internal/poll: if copy_file_range returns 0, assume it failed
On current Linux kernels copy_file_range does not correctly handle
files in certain special file systems, such as /proc. For those file
systems it fails to copy any data and returns zero. This breaks Go's
io.Copy for those files.

Fix the problem by assuming that if copy_file_range returns 0 the
first time it is called on a file, that that file is not supported.
In that case fall back to just using read. This will force an extra
system call when using io.Copy to copy a zero-sized normal file,
but at least it will work correctly.

For #36817
Fixes #44272

Change-Id: I02e81872cb70fda0ce5485e2ea712f219132e614
Reviewed-on: https://go-review.googlesource.com/c/go/+/291989
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-02-16 00:46:04 +00:00
Ian Lance Taylor
33d72fd412 doc/faq: update generics entry to reflect accepted proposal
For #43651

Change-Id: Idb511f4c759d9a77de289938c19c2c1d4a542a17
Reviewed-on: https://go-review.googlesource.com/c/go/+/291990
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-02-15 01:54:22 +00:00
Rob Pike
852ce7c212 cmd/go: provide a more helpful suggestion for "go vet -?"
For the command

	go vet -?

the output was,

	usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
	Run 'go help vet' for details.
	Run 'go tool vet -help' for the vet tool's flags.

but "go help vet" is perfunctory at best. (That's another issue I'm
working on—see https://go-review.googlesource.com/c/tools/+/291909—
but vendoring is required to sort that out.) Add another line and rewrite
a bit to make it actually helpful:

	usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
	Run 'go help vet' for details.
	Run 'go tool vet help' for a full list of flags and analyzers.
	Run 'go tool vet -help' for an overview.

Change-Id: I9d8580f0573321a57d55875ac3185988ce3eaf64
Reviewed-on: https://go-review.googlesource.com/c/go/+/291929
Trust: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-15 01:37:28 +00:00
Ikko Ashimine
66c27093d0 cmd/link: fix typo in link_test.go
specfic -> specific

Change-Id: Icad0f70c77c866a1031a2929b90fef61fe92aaee
GitHub-Last-Rev: f66b56491c
GitHub-Pull-Request: golang/go#44246
Reviewed-on: https://go-review.googlesource.com/c/go/+/291829
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-02-13 15:15:13 +00:00
Rob Findley
b81efb7ec4 [dev.regabi] go/types: add support for language version checking
This is a port of CL 289509 to go/types. It differs from that CL in
codes added to errors, to fit the new factoring of check_test.go, and to
allow go/types to import regexp in deps_test.go

For #31793

Change-Id: Ia9e4c7f5aac1493001189184227c2ebc79a76e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/291317
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-02-13 00:40:18 +00:00
Rob Findley
a7e9b4b948 [dev.regabi] go/types: untyped shift counts must fit into uint
This is a port of CL 283872 to go/types. It differs from that CL only in
added error codes.

For #43697

Change-Id: I62277834cef1c0359bcf2c6ee4388731babbc855
Reviewed-on: https://go-review.googlesource.com/c/go/+/291316
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-13 00:39:59 +00:00
Rob Findley
060fa49bd2 [dev.regabi] go/types: refuse excessively long constants
This is a port of CL 289049 to go/types. In that CL, tests were written
using the ability of tests/run.go to generate test packages dynamically.
For this CL, similar functionality is added to the go/types errmap
tests: tests are refactored to decouple the loading of source code from
the filesystem, so that tests for long constants may be generated
dynamically rather than checked-in as a large testdata file.

Change-Id: I92c7cb61a8d42c6593570ef7ae0af86b501fa34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/290949
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-13 00:39:48 +00:00
Robert Griesemer
a06bd9fecb [dev.typeparams] cmd/compile/internal/types: review of resolver_test.go
The changes between (equivalent, and reviewed) go/types/resolver_test.go
and resolver_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Ibd5850f0d68e393d81e55651bffc886d71665545
Reviewed-on: https://go-review.googlesource.com/c/go/+/291180
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:20:06 +00:00
Robert Griesemer
042f88fe30 [dev.typeparams] cmd/compile/internal/types: review of errors_test.go
The changes between (equivalent, and reviewed) go/types/errors_test.go
and errors_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I74de039b9e655445f0407a0203ac52a95c6c8a40
Reviewed-on: https://go-review.googlesource.com/c/go/+/291179
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:19:50 +00:00
Robert Griesemer
0abd7b768b [dev.typeparams] cmd/compile/internal/types: review of universe.go
The changes between (equivalent, and reviewed) go/types/universe.go
and universe.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I217a4ace016129e661b4a43821c6b306812850b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/291178
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:19:39 +00:00
Robert Griesemer
1b6f0bf1b2 [dev.typeparams] cmd/compile/internal/types: review of sizes_test.go
The changes between (equivalent, and reviewed) go/types/sizes_test.go
and sizes_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I36a9a8a9e0e5a869af392a6d04b50c166c8dbedf
Reviewed-on: https://go-review.googlesource.com/c/go/+/291177
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:19:24 +00:00
Robert Griesemer
1758780181 [dev.typeparams] cmd/compile/internal/types: review of sizes.go
The changes between (equivalent, and reviewed) go/types/sizes.go
and sizes.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: Iacdcffe56023ec53bfaaac8fb112f813a7de0a95
Reviewed-on: https://go-review.googlesource.com/c/go/+/291176
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-02-12 22:19:01 +00:00
Robert Griesemer
3aee461d5c [dev.typeparams] cmd/compile/internal/types: review of return.go
The changes between (equivalent, and reviewed) go/types/return.go
and return.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I7bb3201abec75043804296d6c37307fd243d58f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/291175
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:18:12 +00:00
Robert Griesemer
7428318af6 [dev.typeparams] cmd/compile/internal/types: review of object_test.go
The changes between (equivalent, and reviewed) go/types/object_test.go
and object_test.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I0ebc564fb8edf42c901bf3bf3bae242760aa7c0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/291174
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:17:40 +00:00
Robert Griesemer
b20f9e2da1 [dev.typeparams] cmd/compile/internal/types: review of object.go
The changes between (equivalent, and reviewed) go/types/object.go
and object.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I0fcc08c19c94a60f642036697ccd12f0667d22cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/291173
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:17:25 +00:00
Robert Griesemer
20746b2f37 [dev.typeparams] cmd/compile/internal/types: review of labels.go
The changes between (equivalent, and reviewed) go/types/labels.go
and labels.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker.

Change-Id: I8f1a9927beadff7ac851681739902c13300b6c39
Reviewed-on: https://go-review.googlesource.com/c/go/+/291172
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-12 22:17:13 +00:00
Robert Griesemer
bab3461123 [dev.typeparams] cmd/compile/internal/types: review of infer.go
The changes between (equivalent, and reviewed) go/types/infer.go
and infer.go can be seen by comparing patchset 1 and 2. The actual
change is just removing the "// UNREVIEWED" marker and fixing a
few comments.

Change-Id: Ieb0c07c325a2e446550f85b159f99d4dfe5f1d5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/291171
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-02-12 22:16:58 +00:00