]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agomisc/cgo/test: use char, not int, so test works on big-endian systems
Ian Lance Taylor [Tue, 25 Jun 2019 17:58:47 +0000 (10:58 -0700)]
misc/cgo/test: use char, not int, so test works on big-endian systems

Updates #32579
Fixes #32770

Change-Id: I32d1dea7505e8ad22e11a9806e10d096924b729b
Reviewed-on: https://go-review.googlesource.com/c/go/+/183778
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agocmd/compile: don't mark argument array as noalg
Keith Randall [Fri, 14 Jun 2019 02:11:25 +0000 (19:11 -0700)]
cmd/compile: don't mark argument array as noalg

It ends up making two similar types, [N]uint8 of both
alg and noalg varieties. Comparsions between the two then
don't come out equal when they should.
In particular, the type *[N]uint8 has an Elem pointer which
must point to one of the above two types; it can't point to both.
Thus allocating a *[N]uint8 and dereferencing it might be a
different type than a [N]uint8.

The fix is easy. Making a small test for this is really hard. It
requires that both a argless defer and the test be imported by a
common parent package. This is why a main binary doesn't see this
issue, but a test does (as Agniva noticed), because there's a wrapper
package that imports both the test and the defer.

Types like [N]uint8 don't really need to be marked noalg anyway,
as the generated code (if any) will be shared among all
vanilla memory types of the same size.

Fixes #32595

Change-Id: If7b77fa6ed56cd4495601c3f90170682d853b82f
Reviewed-on: https://go-review.googlesource.com/c/go/+/182357
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.13: binary-only package are no longer supported
Jay Conrod [Mon, 24 Jun 2019 23:04:15 +0000 (19:04 -0400)]
doc/go1.13: binary-only package are no longer supported

Change-Id: Ieb4a78730a0685627b4730381b72cbd01031c8fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/183633
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.13: close <em> and <code> tags
Dmitri Shuralyov [Tue, 25 Jun 2019 18:57:50 +0000 (14:57 -0400)]
doc/go1.13: close <em> and <code> tags

Fixup for two typos from CL 183630.

Change-Id: I7968a736680e8a6bbd1f4691d443b217702bc190
Reviewed-on: https://go-review.googlesource.com/c/go/+/183843
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.13: describe new cmd/go environment variables
Bryan C. Mills [Mon, 24 Jun 2019 21:49:36 +0000 (17:49 -0400)]
doc/go1.13: describe new cmd/go environment variables

Change-Id: I99669339b816a3ae56bbe082a8c47ae17e763d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/183632
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.13: describe 'go env -w'
Bryan C. Mills [Mon, 24 Jun 2019 22:03:57 +0000 (18:03 -0400)]
doc/go1.13: describe 'go env -w'

Change-Id: I0c8c30b40a33763dc34f15d144346eb1a0997df2
Reviewed-on: https://go-review.googlesource.com/c/go/+/183631
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.13: describe changes to 'go get'
Bryan C. Mills [Mon, 24 Jun 2019 21:47:52 +0000 (17:47 -0400)]
doc/go1.13: describe changes to 'go get'

Also fix up markup in the “Version validation” section to correct
indentation on Chrome.

Change-Id: Ib930d324567c086bbd0c67b105272bdfcca77b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/183630
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/internal/obj/ppc64: add doc.go
Lynn Boger [Mon, 24 Jun 2019 20:30:30 +0000 (16:30 -0400)]
cmd/internal/obj/ppc64: add doc.go

Adding some details on writing Go assembler for ppc64.

Change-Id: I46fc6b75ee6c36946f90280b2b670e0d32bcc6b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/183837
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: validate path in mod init path
LE Manh Cuong [Mon, 17 Jun 2019 04:07:39 +0000 (11:07 +0700)]
cmd/go: validate path in mod init path

When mod init with given module path, validate that module path is a
valid import path.

Note that module.CheckImportPath is used, because module.CheckPath
verifies that module path is something that "go get" can fetch, which is
strictly stronger condition than "a valid module path".

Updates #28389
Fixes #32644

Change-Id: Ia60f218dd7d79186f87be723c28a96d6cb63017e
Reviewed-on: https://go-review.googlesource.com/c/go/+/182560
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: ensure that runtime/cgo is not stale in TestExecBuildX
Bryan C. Mills [Tue, 25 Jun 2019 13:17:28 +0000 (09:17 -0400)]
cmd/go: ensure that runtime/cgo is not stale in TestExecBuildX

Fixes #29004

Change-Id: Ifc8330b47fbec6f902057cb9b6db44f2c0082056
Reviewed-on: https://go-review.googlesource.com/c/go/+/183838
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.13: add release notes for the errors package
Andrew [Mon, 24 Jun 2019 19:28:00 +0000 (15:28 -0400)]
doc/go1.13: add release notes for the errors package

Also removes remaining TODOs

Change-Id: Id80021b7a64c923c4ebd69fb6e8831a43a76dc72
Reviewed-on: https://go-review.googlesource.com/c/go/+/183625
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocmd/go/internal/modfetch: filter pseudo-versions from proxy /list endpoints
Bryan C. Mills [Fri, 21 Jun 2019 19:13:10 +0000 (15:13 -0400)]
cmd/go/internal/modfetch: filter pseudo-versions from proxy /list endpoints

The /list files in the module cache include pseudo-versions, but the
documentation for (*modfetch).Repo.Versions explicitly states that
they are not included in the output of that method.

Fixes #32715

Change-Id: Ieba1500b91f52b5fa689e70e16dbe3ad40de20f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/183402
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go/internal/modfetch: return structured errors from proxy operations
Bryan C. Mills [Mon, 24 Jun 2019 16:29:28 +0000 (12:29 -0400)]
cmd/go/internal/modfetch: return structured errors from proxy operations

CL 181881 added structured error types for direct fetches.
Use those same structured errors to format proxy errors consistently.

Also ensure that an empty @v/list is treated as equivalent to the module
not existing at all.

Updates #27173
Updates #32715

Change-Id: I203fd8259bc4f28b3389745f1a1fde936b0fa24d
Reviewed-on: https://go-review.googlesource.com/c/go/+/183619
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: fix a register save/restore bug in sigtramp of arm-darwin
Ben Shi [Mon, 24 Jun 2019 02:17:40 +0000 (02:17 +0000)]
runtime: fix a register save/restore bug in sigtramp of arm-darwin

In sigtramp of sys_darwin_arm.s, the callee-save register R4 is
saved to the stack, but later R2 is also saved to the save position.

That CL fixes the unexpected lost of the value in R4.

fixes #32744

Change-Id: Ifaeb99f11e4abf0c79bec9da67e0db97c358010c
Reviewed-on: https://go-review.googlesource.com/c/go/+/183517
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agobufio: fix ExampleScanner_Bytes comment, add error check
Ian Lance Taylor [Mon, 24 Jun 2019 18:54:15 +0000 (11:54 -0700)]
bufio: fix ExampleScanner_Bytes comment, add error check

Followup to CL 51412.

Change-Id: Ic83c833e2c571cd7c8293d998ff745f181037a61
Reviewed-on: https://go-review.googlesource.com/c/go/+/183657
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agodoc/go1.13: cmd/go, math/big, and a leftover crypto/x509 release note
Filippo Valsorda [Mon, 24 Jun 2019 17:49:06 +0000 (13:49 -0400)]
doc/go1.13: cmd/go, math/big, and a leftover crypto/x509 release note

Change-Id: I80f2b50c8dd3d3f0fea6ed25fa2581786152d470
Reviewed-on: https://go-review.googlesource.com/c/go/+/183621
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: fix a typo in module-private help text
Bryan C. Mills [Mon, 24 Jun 2019 19:44:05 +0000 (15:44 -0400)]
cmd/go: fix a typo in module-private help text

Change-Id: Idbdcb78d40cf58d7c878cfeaa4a34ab580fe472f
Reviewed-on: https://go-review.googlesource.com/c/go/+/183626
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: fix inappropriate array copy
kawakami [Sat, 22 Jun 2019 20:30:24 +0000 (05:30 +0900)]
cmd/cgo: fix inappropriate array copy

Ensure that during rewriting of expressions that take the address of
an array, that we properly recognize *ast.IndexExpr as an operation
to create a pointer variable and thus assign the proper addressOf
and deference operators as "&" and "*" respectively.

This fixes a regression from CL 142884.

Fixed #32579

Change-Id: I3cb78becff4f8035d66fc5536e5b52857eacaa3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/183458
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go: silence ar with D flag failures
Clément Chigot [Thu, 13 Jun 2019 08:12:06 +0000 (10:12 +0200)]
cmd/go: silence ar with D flag failures

The first call of ar must not show its output in order to avoid useless
error messages about D flag.

Change-Id: I3a2f5144b3bb271705000b67cd46cd02e98aca77
Reviewed-on: https://go-review.googlesource.com/c/go/+/182077
Run-TryBot: Clément Chigot <clement.chigot@atos.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.13: mention {NetBSD,OpenBSD}/arm64 ports
Ian Lance Taylor [Mon, 24 Jun 2019 17:02:41 +0000 (10:02 -0700)]
doc/go1.13: mention {NetBSD,OpenBSD}/arm64 ports

Also alphabetize port listing.

Change-Id: I4cc552a74856c9955571d721deb6223438c7d856
Reviewed-on: https://go-review.googlesource.com/c/go/+/183637
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/go/internal/modfetch: treat a missing go.mod file as a “not exist” error
Bryan C. Mills [Mon, 24 Jun 2019 14:16:12 +0000 (10:16 -0400)]
cmd/go/internal/modfetch: treat a missing go.mod file as a “not exist” error

If we have found a repository at the requested version but it does not
contain a go.mod file in an appropriate subdirectory, then the module
with the given path does not exist at that version. Therefore, we
should report it with an error equivalent to os.ErrNotExist so that
modload.Query will continue to check other possible module paths.

Updates #27173

Change-Id: Ica73f4bb97f58e611a7f7d38183ee52fef5ee69a
Reviewed-on: https://go-review.googlesource.com/c/go/+/183618
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.13: remove bytes TODO since it does not require a release note
Andrew [Mon, 24 Jun 2019 14:11:26 +0000 (10:11 -0400)]
doc/go1.13: remove bytes TODO since it does not require a release note

Change-Id: I8c19c6df6fec74dcc8c3bfdc667576ea00e86ec1
Reviewed-on: https://go-review.googlesource.com/c/go/+/183617
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agotest: update blank1.go for changed gofrontend error messages
Ian Lance Taylor [Sat, 22 Jun 2019 19:56:49 +0000 (12:56 -0700)]
test: update blank1.go for changed gofrontend error messages

Adjusting gofrontend error messages for GCC standards causes the
messages expected by this test to be adjusted slightly: the gofrontend
code now quotes the _ identifier.

Change-Id: I55ee2ae70b4da3bf7a421ceea80b254dd17601a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/183477
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime/cgo: on Solaris link against -lxnet
Ian Lance Taylor [Fri, 21 Jun 2019 18:50:25 +0000 (11:50 -0700)]
runtime/cgo: on Solaris link against -lxnet

Fixes #32205

Change-Id: If5b1d32a5e19ff5d9337862c07fb77890d19d69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/183379
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agodoc: add release notes for godoc and go doc
Dmitri Shuralyov [Mon, 17 Jun 2019 20:28:18 +0000 (16:28 -0400)]
doc: add release notes for godoc and go doc

Updates #30029
Updates #31457

Change-Id: I08414a544615e74afb47f7a10a00f1e22adfd40c
Reviewed-on: https://go-review.googlesource.com/c/go/+/182619
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocmd/go: validate pseudo-versions against module paths and revision metadata
Bryan C. Mills [Tue, 11 Jun 2019 19:49:44 +0000 (15:49 -0400)]
cmd/go: validate pseudo-versions against module paths and revision metadata

Previously, most operations involving pseudo-versions allowed any
arbitrary combination of version string and date, and would resolve to
the underlying revision (typically a Git commit hash) as long as that
revision existed.

There are a number of problems with that approach:

• The pseudo-version participates in minimal version selection. If its
  version prefix is inaccurate, the pseudo-version may appear to have
  higher precedence that the releases that follow it, effectively
  “pinning” the module to that commit. For release tags, module
  authors are the ones who make the decision about release tagging;
  they should also have control over the pseudo-version precedence
  within their module.

• The commit date within the pseudo-version provides a total order
  among pseudo-versions. If it is not accurate, the pseudo-version
  will sort into the wrong place relative to other commits with the
  same version prefix.

To address those problems, this change restricts the pseudo-versions
that the 'go' command accepts, rendering some previously
accepted-but-not-canonical versions invalid. A pseudo-version is now
valid only if all of:

1. The tag from which the pseudo-version derives points to the named
   revision or one of its ancestors as reported by the underlying VCS
   tool, or the pseudo-version is not derived from any tag (that is,
   has a "vX.0.0-" prefix before the date string and uses the lowest
   major version appropriate to the module path).

2. The date string within the pseudo-version matches the UTC timestamp
   of the revision as reported by the underlying VCS tool.

3. The short name of the revision within the pseudo-version (such as a
   Git hash prefix) is the same as the short name reported by the
   underlying cmd/go/internal/modfetch/codehost.Repo. Specifically, if
   the short name is a SHA-1 prefix, it must use the same number of
   hex digits (12) as codehost.ShortenSHA1.

4. The pseudo-version includes a '+incompatible' suffix only if it is
   needed for the corresponding major version, and only if the
   underlying module does not have a go.mod file.

We believe that all releases of the 'go' tool have generated
pseudo-versions that meet these constraints. However, a few
pseudo-versions edited by hand or generated by third-party tools do
not. If we discover invalid-but-benign pseudo-versions in widely-used
existing dependencies, we may choose to add a whitelist for those
specific path/version combinations.



To work around invalid dependencies in leaf modules, users may add a
'replace' directive from the invalid version to its valid equivalent.
Note that the go command's go.mod parser automatically resolves commit
hashes found in 'replace' directives to the appropriate
pseudo-versions, so in most cases one can write something like:

replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker e7b5f7dbe98c

and then run any 'go' command (such as 'go list' or 'go mod tidy') to
resolve it to an appropriate pseudo-version. Note that the invalid
version will still be used in minimal version selection, so this use
of 'replace' directives is an incomplete workaround.



One of the common use cases for higher-than-tagged pseudo-versions is
for projects that do parallel development on release branches. For
example, if a project cuts a 'v1.2' release branch at v1.2.0, they may
want future commits on the main branch to show up as pre-releases for
v1.3.0 rather than for v1.2.1 — especially if v1.2.1 is already tagged
on the release branch. (On the other hand, a backport of a patch to
the v1.2 branch should not show up as a pre-release for v1.3.0.)

To address this use-case, module authors can make use of our existing
support for pseudo-versions derived from pre-release tags: if the
author adds an explicit pre-release tag (such as 'v1.3.0-devel') to
the first commit after the branch, then the pseudo-versions for that
commit and its descendents will be derived from that tag and will sort
appropriately in version selection.



Updates #27171
Fixes #29262
Fixes #27173
Fixes #32662
Fixes #32695

Change-Id: I0d50a538b6fdb0d3080aca9c9c3df1040da1b329
Reviewed-on: https://go-review.googlesource.com/c/go/+/181881
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go/testdata: update addmod.go to work with the mainline go command
Bryan C. Mills [Fri, 21 Jun 2019 19:03:57 +0000 (15:03 -0400)]
cmd/go/testdata: update addmod.go to work with the mainline go command

Updates #32715

Change-Id: I4ea41d7bd1a2daeba8cebb283aaa096b6c3d4533
Reviewed-on: https://go-review.googlesource.com/c/go/+/183401
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/gofmt: fix normalization of imaginary number literals
Robert Griesemer [Fri, 21 Jun 2019 16:06:56 +0000 (09:06 -0700)]
cmd/gofmt: fix normalization of imaginary number literals

The old code only normalized decimal integer imaginary number
literals. But with the generalized imaginary number syntax,
the number value may be decimal, binary, octal, or hexadecimal,
integer or floating-point.

The new code only looks at the number pattern. Only for decimal
integer imaginary literals do we need to strip leading zeroes.
The remaining normalization code simply ignore the 'i' suffix.
As a result, the new code is both simpler and shorter.

Fixes #32718.

Change-Id: If43fc962a48ed62002e65d5c81fddbb9bd283984
Reviewed-on: https://go-review.googlesource.com/c/go/+/183378
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/link: revise previous __DWARF segment protection fix
Than McIntosh [Thu, 20 Jun 2019 13:02:05 +0000 (09:02 -0400)]
cmd/link: revise previous __DWARF segment protection fix

Tweak the previous fix for issue 32673 (in CL 182958) to work around
problems with c-shared build mode that crop up on some of the builders
(10.11, 10.12).  We now consistently set vmaddr and vmsize to zero
for the DWARF segment regardless of build mode.

Updates #32673

Change-Id: Id1fc213590ad00c28352925e2d754d760e022b5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/183237
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/go: add more docs for go directive in go.mod file
Ian Lance Taylor [Wed, 12 Jun 2019 14:01:04 +0000 (07:01 -0700)]
cmd/go: add more docs for go directive in go.mod file

Updates #30791

Change-Id: I67efd7fd3b3a550428b16518bb27a3d81c178d28
Reviewed-on: https://go-review.googlesource.com/c/go/+/181840
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agobufio: add example for Scanner.Bytes
guitarbum722 [Thu, 27 Jul 2017 03:26:18 +0000 (20:26 -0700)]
bufio: add example for Scanner.Bytes

Change-Id: I4a5c7573e13dd85531ee9f4dd2a0d1981bf8cdfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/51412
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoRevert "runtime: use dispatch semaphores on Darwin"
Ian Lance Taylor [Wed, 19 Jun 2019 17:48:33 +0000 (17:48 +0000)]
Revert "runtime: use dispatch semaphores on Darwin"

This reverts https://golang.org/cl/182258.

The new code caused unpredictable crashes that are not understood.  The old code was occasionally flaky but still better than this approach.

Fixes #32655
Updates #31264

Change-Id: I2e9d27d6052e84bf75106d8b844549ba4f571695
Reviewed-on: https://go-review.googlesource.com/c/go/+/182880
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agodoc/go1.13: document changes to gofmt, go/* libs, and fix entry for text/scanner
Robert Griesemer [Thu, 20 Jun 2019 23:50:48 +0000 (16:50 -0700)]
doc/go1.13: document changes to gofmt, go/* libs, and fix entry for text/scanner

Change-Id: I2230a97c681406f248b7f2fff45dd80a4b54a4b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/183357
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agobufio: Reader.Read may return io.EOF even when it has data buffered
Daniel Cormier [Wed, 19 Jun 2019 16:32:30 +0000 (12:32 -0400)]
bufio: Reader.Read may return io.EOF even when it has data buffered

If reading 0 bytes, don't return the error from the underlying
io.Reader if there is still data buffered.

Fixes #32693

Change-Id: I12a97bd6003c638c15d41028942f27edf88340e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/182997
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agocrypto/x509: normalize and expand docs of Parse and Marshal functions
Filippo Valsorda [Thu, 20 Jun 2019 01:13:20 +0000 (21:13 -0400)]
crypto/x509: normalize and expand docs of Parse and Marshal functions

Change-Id: I8f0e109053bbbd8bde4fa64059fd070d8f4acef2
Reviewed-on: https://go-review.googlesource.com/c/go/+/183117
Reviewed-by: Adam Langley <agl@golang.org>
5 years agocrypto/tls: reject low-order Curve25519 points
Filippo Valsorda [Wed, 19 Jun 2019 22:31:43 +0000 (18:31 -0400)]
crypto/tls: reject low-order Curve25519 points

The RFC recommends checking the X25519 output to ensure it's not the
zero value, to guard against peers trying to remove contributory
behavior.

In TLS there should be enough transcript involvement to mitigate any
attack, and the RSA key exchange would suffer from the same issues by
design, so not proposing a backport.

See #31846

Change-Id: I8e657f8ee8aa72c3f8ca3b124555202638c53f5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/183039
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
5 years agocrypto/tls: move shared code and resources to handshake_test.go
Filippo Valsorda [Wed, 19 Jun 2019 21:07:26 +0000 (17:07 -0400)]
crypto/tls: move shared code and resources to handshake_test.go

Removed cross-dependencies between handshake_server_test.go and
handshake_client_test.go; moved all initialization to TestMain; replaced
SSLKEYLOGFILE environment variable with -keylog flag.

Change-Id: Ida6712daa44e01a2c00658e8a1896087ee88bcb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/183057
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
5 years agotext/scanner: rename AllowNumberbars to AllowDigitSeparators
Robert Griesemer [Wed, 19 Jun 2019 22:50:06 +0000 (15:50 -0700)]
text/scanner: rename AllowNumberbars to AllowDigitSeparators

Fixes #32661.

Change-Id: I32dc4e7b276b95ac2e87a384caa6c48702368d05
Reviewed-on: https://go-review.googlesource.com/c/go/+/183077
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agocmd/go/internal/imports: match solaris files for illumos
Tobias Klauser [Sat, 1 Jun 2019 22:51:46 +0000 (00:51 +0200)]
cmd/go/internal/imports: match solaris files for illumos

Like the android/linux pair, match files with GOOS=solaris if
GOOS=illumos

Follow-up for CL 174457

Fixes #32370
Updates #20603

Change-Id: Id01de8bb3990d7bbb22f735a4abed2b3cf8b4062
Reviewed-on: https://go-review.googlesource.com/c/go/+/179997
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: add necessary operand to mergePoint in rewrite rules
David Chase [Wed, 19 Jun 2019 22:09:39 +0000 (18:09 -0400)]
cmd/compile: add necessary operand to mergePoint in rewrite rules

A missing operand to mergePoint caused lower to place values
in the wrong blocks.

Includes test, belt+suspenders to do both ssa check and verify
the output (was is how the bug was originally observed).

The fixed bug here is very likely present in Go versions
1.9-1.12 on amd64 and s390x

Fixes #32680.

Change-Id: I63e702c4c40602cb795ef71b1691eb704d38ccc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/183059
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go: install binaries in cmd/ in $GOROOT/bin instead of $GOBIN
Jay Conrod [Wed, 19 Jun 2019 21:25:27 +0000 (17:25 -0400)]
cmd/go: install binaries in cmd/ in $GOROOT/bin instead of $GOBIN

This was caused by CL 167748, which removed a special case for command
line arguments starting with "cmd/". This CL restores the behavior
from go1.12.

Fixes #32674

Change-Id: I72180d11fb0261ef0af9632e512bd9c03481b6c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/183058
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.13: add release notes for the testing package
Andrew [Tue, 18 Jun 2019 17:32:04 +0000 (13:32 -0400)]
doc/go1.13: add release notes for the testing package

Change-Id: I4ddbe22061579383ca47e14d0b64a74365fb3d19
Reviewed-on: https://go-review.googlesource.com/c/go/+/182797
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocrypto/tls: disable RSA-PSS in TLS 1.2 again
Filippo Valsorda [Thu, 13 Jun 2019 22:33:33 +0000 (18:33 -0400)]
crypto/tls: disable RSA-PSS in TLS 1.2 again

Signing with RSA-PSS can uncover faulty crypto.Signer implementations,
and it can fail for (broken) small keys. We'll have to take that
breakage eventually, but it would be nice for it to be opt-out at first.

TLS 1.3 requires RSA-PSS and is opt-out in Go 1.13. Instead of making a
TLS 1.3 opt-out influence a TLS 1.2 behavior, let's wait to add RSA-PSS
to TLS 1.2 until TLS 1.3 is on without opt-out.

Note that since the Client Hello is sent before a protocol version is
selected, we have to advertise RSA-PSS there to support TLS 1.3.
That means that we still support RSA-PSS on the client in TLS 1.2 for
verifying server certificates, which is fine, as all issues arise on the
signing side. We have to be careful not to pick (or consider available)
RSA-PSS on the client for client certificates, though.

We'd expect tests to change only in TLS 1.2:

    * the server won't pick PSS to sign the key exchange
      (Server-TLSv12-* w/ RSA, TestHandshakeServerRSAPSS);
    * the server won't advertise PSS in CertificateRequest
      (Server-TLSv12-ClientAuthRequested*, TestClientAuth);
    * and the client won't pick PSS for its CertificateVerify
      (Client-TLSv12-ClientCert-RSA-*, TestHandshakeClientCertRSAPSS,
      Client-TLSv12-Renegotiate* because "R" requests a client cert).

Client-TLSv13-ClientCert-RSA-RSAPSS was updated because of a fix in the test.

This effectively reverts 88343530720a52c96b21f2bd5488c8fb607605d7.

Testing was made more complex by the undocumented semantics of OpenSSL's
-[client_]sigalgs (see openssl/openssl#9172).

Updates #32425

Change-Id: Iaddeb2df1f5c75cd090cc8321df2ac8e8e7db349
Reviewed-on: https://go-review.googlesource.com/c/go/+/182339
Reviewed-by: Adam Langley <agl@golang.org>
5 years agodoc/go1.13: expand ports, add skeleton language changes section
Austin Clements [Tue, 18 Jun 2019 21:42:44 +0000 (17:42 -0400)]
doc/go1.13: expand ports, add skeleton language changes section

Change-Id: I6338bba2a86fb27421f91203a04b39830bae1e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/182800
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/link: macos: set initial protection of 0 for __DWARF segment
Than McIntosh [Wed, 19 Jun 2019 17:33:33 +0000 (13:33 -0400)]
cmd/link: macos: set initial protection of 0 for __DWARF segment

For later versions of MacOS, the dynamic loader is more picky about
enforcing restrictions on __DWARF MachO load commands/segments,
triggering aborts of the form

  dyld: malformed mach-o image: segment __DWARF has vmsize < filesize

for Go programs that use cgo on Darwin. The error is being triggered
because the Go linker is setting "vmsize" in the DWARF segment entry
to zero as a way to signal that the DWARF doesn't need to be mapped
into memory at runtime (which we need to continue to do).

This patch changes the initial protection on the __DWARF segment to
zero, which dyld seems to be happy with (this is used for other similar
non-loadable sections such as __LLVM).

Fixes #32673

Change-Id: I9a73449c6d26c172f3d70361719943af381f37e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/182958
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: correct comments of gc.Val fields
LE Manh Cuong [Mon, 17 Jun 2019 18:14:22 +0000 (01:14 +0700)]
cmd/compile: correct comments of gc.Val fields

Refer to Val.Ctype method instead of non-existed n.ValCtype one.

Change-Id: Ie0fbcae87d9f4f97632865676309d98e0b5138c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/182561
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agodoc/go1.13: add release notes for language changes
Robert Griesemer [Wed, 19 Jun 2019 00:40:09 +0000 (17:40 -0700)]
doc/go1.13: add release notes for language changes

Change-Id: I17b156e77f279e1387ad27ab0e41ae8f50c9a325
Reviewed-on: https://go-review.googlesource.com/c/go/+/182857
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/link: fix stale link to MachO file format reference in comment
Than McIntosh [Wed, 19 Jun 2019 15:41:54 +0000 (11:41 -0400)]
cmd/link: fix stale link to MachO file format reference in comment

Fix a stale reference to Apple's Mach-O file format reference in the
header comment.

Change-Id: I5f120fd5bf31ee0b8b29a33879305abb31a7913d
Reviewed-on: https://go-review.googlesource.com/c/go/+/182957
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go/internal/modfetch: re-resolve commit hashes in readDiskStat
Bryan C. Mills [Wed, 12 Jun 2019 22:07:32 +0000 (18:07 -0400)]
cmd/go/internal/modfetch: re-resolve commit hashes in readDiskStat

Previously, when we resolved a commit hash (not a complete version),
we always checked the contents of the module cache for any
pseudo-version matching that commit.

However, there are many possible names for a given commit. Generally
the semantically-highest valid name is the best, and that may change
over time as new tags are added, so if we are able to fetch a better
name from upstream we should do so. Otherwise, we should fall back to
the highest appropriate name found in the cache.

Fixes #27171
Updates #27173

Change-Id: Ib5c7d99eb463af84674e969813039cbbee7e395b
Reviewed-on: https://go-review.googlesource.com/c/go/+/182178
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
5 years agomath: add examples for Log, Log2, Mod, and Abs
Michael Brandenburg [Wed, 19 Jun 2019 05:16:05 +0000 (22:16 -0700)]
math: add examples for Log, Log2, Mod, and Abs

Change-Id: I5f57acd5e970b3fec5f33cfceee179235cbf739f
Reviewed-on: https://go-review.googlesource.com/c/go/+/182877
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http: fix Server.IdleTimeout and Server.ReadHeaderTimeout docs
Raghavendra Nagaraj [Tue, 18 Jun 2019 08:30:24 +0000 (08:30 +0000)]
net/http: fix Server.IdleTimeout and Server.ReadHeaderTimeout docs

CL 46434 changed the doc for Server.IdleTimeout to include
falling back to Server.ReadHeaderTimeout if both
Server.IdleTimeout and Server.ReadTimeout are zero.
However, we explicitly set the ReadDeadlines firstly based
off Server.IdleTimeout or Server.ReadTimeout before attempting
to read the next request, thus the current doc is incorrect.

This CL reverts CL 46434 and also updates the doc for
Server.ReadHeaderTimeout to documenting falling back
to Server.ReadTimeout, if the former is zero, otherwise
there is no timeout.

Fixes #32053

Change-Id: I43dd0252d1bcee6c29a8529abd84c84a49b2fba9
GitHub-Last-Rev: e1cdb599772476e0b52d9d2374c3ea3893844eb4
GitHub-Pull-Request: golang/go#32164
Reviewed-on: https://go-review.googlesource.com/c/go/+/178337
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agodoc/go1.13: add crypto-related release notes
Filippo Valsorda [Mon, 17 Jun 2019 22:28:27 +0000 (18:28 -0400)]
doc/go1.13: add crypto-related release notes

Change-Id: I05d4ff3d3a31f56c9ceebdaceb39535a1351b26a
Reviewed-on: https://go-review.googlesource.com/c/go/+/182701
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agocmd/go: fix sumdb test failure with misbehaving DNS server
Jay Conrod [Tue, 18 Jun 2019 19:31:18 +0000 (15:31 -0400)]
cmd/go: fix sumdb test failure with misbehaving DNS server

Broadened the regular expression used to test error messages for
failing to connect to "localhost.localdev/sumdb". Some DNS servers
resolve unknown domains like "localhost.localdev" to real IP addresses
to serve ads. We may get a variety of error messages.

Fixes #31779

Change-Id: Ib389c633c9a9f70f8e89bbcba5282a375da4e708
Reviewed-on: https://go-review.googlesource.com/c/go/+/182799
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.13: add release notes for the net package
Andrew [Mon, 17 Jun 2019 20:20:53 +0000 (16:20 -0400)]
doc/go1.13: add release notes for the net package

Change-Id: I54dc8afc33d6f8946d2c79b0339118fa3710a688
Reviewed-on: https://go-review.googlesource.com/c/go/+/182618
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.13: runtime release notes, some compiler release notes
Austin Clements [Fri, 14 Jun 2019 19:02:35 +0000 (15:02 -0400)]
doc/go1.13: runtime release notes, some compiler release notes

Change-Id: Icc5083a3de0c6b737bfc20b573ed785651910148
Reviewed-on: https://go-review.googlesource.com/c/go/+/182461
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agoreflect,doc: use "the" instead of "a" in IsZero docs
Josh Bleecher Snyder [Mon, 17 Jun 2019 19:57:40 +0000 (12:57 -0700)]
reflect,doc: use "the" instead of "a" in IsZero docs

There is a subtle distinction between a value
*being* the zero value vs being *equal to* the zero value.
This was discussed at length in #31450.

Using "a zero value" in the docs suggests that there may
be more than zero value. That is possible on the "equal to
zero value" reading, but not the "is zero" reading that we
selected for the semantics of IsZero.

This change attempts to prevent any confusion on this front by
switching to "the zero value" in the documentation.

And while we're here, eliminate a double-space.
(Darn macbook keyboards.)

Change-Id: Iaa02ba297438793f5a90be9919a4d53baef92f8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/182617
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: remove a Google+ link since it doesn't exist anymore
Steve Mynott [Mon, 17 Jun 2019 21:05:23 +0000 (21:05 +0000)]
doc: remove a Google+ link since it doesn't exist anymore

Change-Id: I692229a5597a6114a7f4261f7b59c58bf20f3e2b
GitHub-Last-Rev: ab173354caa63345d38a625705aea0c660cfdb9b
GitHub-Pull-Request: golang/go#32660
Reviewed-on: https://go-review.googlesource.com/c/go/+/182677
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go/internal/modload: query correct "latest" version through proxy
Jay Conrod [Mon, 17 Jun 2019 21:03:55 +0000 (17:03 -0400)]
cmd/go/internal/modload: query correct "latest" version through proxy

This fixes a regression introduced in CL 180337. When we query a
module at "latest" that has no tagged versions, we tried to use ""
as the version because we used info.Name instead of info.Version. This
only happened when using a proxy: in direct mode, info.Name is set to
the underlying VCS revision, which is fine.

Also: serve "/mod/path/@latest" through our test proxy.
Previously, we served a 404, which made this bug hard to detect.

Fixes #32636

Change-Id: I5c60975656297f862cad66675170e819685ebd39
Reviewed-on: https://go-review.googlesource.com/c/go/+/182697
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agohtml/template, text/template: document glob semantics
Andrew Gerrand [Fri, 31 May 2019 11:25:04 +0000 (21:25 +1000)]
html/template, text/template: document glob semantics

This change updates the doc comments of the various ParseGlob functions
and methods to state that they use the semantics of filepath.Match when
matching the file name pattern.

Fixes #30608

Change-Id: Iee4bdc0a2a2f8647d1f9a910e4d72a5de9204d11
Reviewed-on: https://go-review.googlesource.com/c/go/+/179739
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agodoc: update 1.13 release notes
Keith Randall [Mon, 10 Jun 2019 19:51:51 +0000 (12:51 -0700)]
doc: update 1.13 release notes

Write release notes for a few reflect, runtime, and syscall changes.

The init randomization has been reverted.

Change-Id: Idae481ca015e325eb7302abaa15b2792312f4c32
Reviewed-on: https://go-review.googlesource.com/c/go/+/181577
Reviewed-by: Austin Clements <austin@google.com>
5 years agohtml/template: handle nil Error values in context.String
Samuel Tan [Tue, 11 Jun 2019 05:18:56 +0000 (22:18 -0700)]
html/template: handle nil Error values in context.String

Add a special case to print a generic nil error when context.err is
nil.

Previously, this case was unchecked, leading to a call to (*Error).Error
with a nil receiver, which was triggering a nil pointer access. However,
this bug was masked by the panic-recovery code in package fmt.

I tested this change by running `dlv test` in src/html/template, running
the `continue` command, and verifying that no "bad access" errors are
returned.

Fixes #28854

Change-Id: I0b637b943de003d9efc294f6f1e49b793668d037
Reviewed-on: https://go-review.googlesource.com/c/go/+/181579
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/go: document GOBIN and 'go install' locations
Jay Conrod [Thu, 13 Jun 2019 23:56:37 +0000 (19:56 -0400)]
cmd/go: document GOBIN and 'go install' locations

* In doc/install-source.html, clarify the meaning of $GOBIN and
  describe where executables from the Go distribution are
  installed. Also describe $GOPATH, since it provides a default value
  for $GOBIN and may conflict with $GOROOT.
* Add more detail to 'go help install' as well.

Fixes #31576

Change-Id: Ib8a8c21677c3aa0ebef97a3b587b6f8fe338b80e
Reviewed-on: https://go-review.googlesource.com/c/go/+/182341
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agosyscall: accept permission errors in TestExecPtrace
Elias Naur [Sun, 16 Jun 2019 15:05:11 +0000 (17:05 +0200)]
syscall: accept permission errors in TestExecPtrace

Fixes the test on the linux-arm64-packet builder.

Change-Id: Icaf9edf9542f4f6e3791ca43298a1e7051eaa576
Reviewed-on: https://go-review.googlesource.com/c/go/+/182378
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: disable ptrace on iOS
Elias Naur [Thu, 13 Jun 2019 21:40:00 +0000 (23:40 +0200)]
syscall: disable ptrace on iOS

It is forbidden by App Store.

Fixes #31628

Change-Id: Ie6d14a524ee55b57af8db685f3a79f474733add5
Reviewed-on: https://go-review.googlesource.com/c/go/+/182297
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agomisc/ios: add missing CGO_ENABLED=1 for running standalone tests
Elias Naur [Fri, 14 Jun 2019 08:23:06 +0000 (10:23 +0200)]
misc/ios: add missing CGO_ENABLED=1 for running standalone tests

Change-Id: Icfd5b9d1ca757081af7885189ae7094fa1b3d8f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/182377
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: use dispatch semaphores on Darwin
Ian Lance Taylor [Thu, 13 Jun 2019 19:49:03 +0000 (12:49 -0700)]
runtime: use dispatch semaphores on Darwin

Changes Darwin semaphore support from using pthread mutexes and
condition variables to using dispatch semaphores. Signaling a dispatch
semaphore is async-signal-safe.

Fixes #31264

Change-Id: If0ce47623501db13e3804b14ace5f4d8eaef461e
Reviewed-on: https://go-review.googlesource.com/c/go/+/182258
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agodoc: release notes for syscall and syscall/js
Katie Hockman [Wed, 12 Jun 2019 17:54:50 +0000 (13:54 -0400)]
doc: release notes for syscall and syscall/js

Change-Id: I0ee4b4f0211cd12803ab33976669350d9dd615f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/181944
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agodoc: add release notes for log
Julie [Wed, 12 Jun 2019 17:38:45 +0000 (13:38 -0400)]
doc: add release notes for log

Change-Id: Ifd330053094c172b7dcd9086da173289efc7f9b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/181942
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agocmd/go: avoid accidental downgrades in 'go get' with latest and patch
Jay Conrod [Fri, 31 May 2019 22:56:28 +0000 (18:56 -0400)]
cmd/go: avoid accidental downgrades in 'go get' with latest and patch

Currently, 'go get -u' and 'go get -u=patch' avoid accidentally
downgrading modules by preventing upgrades in two cases:

1) If the current version is a prerelease that is semantically later
   than the "latest" or "patch" version.
2) If the current version is a pseudoversion that is chronologically
   newer than the "latest" or "patch" version.

With this change, 'go get m@latest' and 'go get m@patch' prevent
downgrades using the same checks.

Also: 'go get m@patch' now works if m is a module path but not a
package path (i.e., there is no package in the module root directory).

Fixes #30634
Fixes #32537

Change-Id: I916630c385b5f3ba7c13e0d65ba08f73a1a67829
Reviewed-on: https://go-review.googlesource.com/c/go/+/180337
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: add release notes for context
Julie [Wed, 12 Jun 2019 16:33:19 +0000 (12:33 -0400)]
doc: add release notes for context

Change-Id: I4c52d9bcf941810dbdfdd39e7f339c8283d6bcc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/181937
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agovendor: go get -u golang.org/x/crypto && go mod vendor
Lynn Boger [Tue, 11 Jun 2019 19:21:51 +0000 (15:21 -0400)]
vendor: go get -u golang.org/x/crypto && go mod vendor

Pick up asm ppc64le implementations for internal/chacha20 and
poly1305.

Change-Id: Ide6fc91da3b10d1c3d9e8e00957c52be06a3cf93
Reviewed-on: https://go-review.googlesource.com/c/go/+/181877
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
5 years agodoc: clarify default go command behavior in the release notes
Katie Hockman [Wed, 12 Jun 2019 21:50:55 +0000 (17:50 -0400)]
doc: clarify default go command behavior in the release notes

Change-Id: I2a0bd295ad9737581d149a7165191b878ae2acda
Reviewed-on: https://go-review.googlesource.com/c/go/+/181880
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodatabase/sql: add support for decimal interface
Daniel Theophanes [Fri, 26 Apr 2019 19:49:23 +0000 (12:49 -0700)]
database/sql: add support for decimal interface

Add support for scanning decimal types into values. If the dest
supports the decimal composer interface and the src supports
the decimal decomposer, set the value of the decimal when Scanning.

Add support for sending decimal decomposer interface values
as parameters.

For #30870

Change-Id: Ic5dbf9069df8d56405852b17542a9188d55c2947
Reviewed-on: https://go-review.googlesource.com/c/go/+/174181
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodatabase/sql: add Conn.Raw to expose the driver Conn safely
Daniel Theophanes [Fri, 26 Apr 2019 21:09:07 +0000 (14:09 -0700)]
database/sql: add Conn.Raw to expose the driver Conn safely

Exposing the underlying driver conn will allow the use of the
standard connection pool while still able to run special function
directly on the driver.

Fixes #29835

Change-Id: Ib6d3b9535e730f008916805ae3bf76e4494c88f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/174182
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go: factor the I/O-retry logic out of renameio
Bryan C. Mills [Mon, 10 Jun 2019 16:01:49 +0000 (12:01 -0400)]
cmd/go: factor the I/O-retry logic out of renameio

Factor the try-on-failure variants are now in the package
cmd/go/internal/robustio.

Add to them a RemoveAll variant using the same retry loop,
and use it to attempt to address the observed flakes in
TestLinkXImportPathEscape.

Fixes #19491
Updates #25965
Updates #28387
Updates #32188

Change-Id: I9db1a0c7537b8aaadccab1b9eca734595668ba29
Reviewed-on: https://go-review.googlesource.com/c/go/+/181541
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: add '--' before repository names when invoking vcs tools
Jay Conrod [Thu, 6 Jun 2019 21:00:27 +0000 (17:00 -0400)]
cmd/go: add '--' before repository names when invoking vcs tools

Also, in 'go get' in GOPATH mode, report an error for package paths
that start with '-'.

Change-Id: Ic2575381aa2d093ba15c53b893bf2eaded8b6066
Reviewed-on: https://go-review.googlesource.com/c/go/+/181237
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: add release notes for reflect
Julie [Wed, 12 Jun 2019 17:54:51 +0000 (13:54 -0400)]
doc: add release notes for reflect

Change-Id: I71a6816f54f8ad0f8531bb3f9de552fd136a0ed4
Reviewed-on: https://go-review.googlesource.com/c/go/+/181943
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: release notes for html/template
Julie [Wed, 12 Jun 2019 17:11:03 +0000 (13:11 -0400)]
doc: release notes for html/template

Change-Id: Ifdc3c5b840e6833f14c8e52948e45d5faa5a0615
Reviewed-on: https://go-review.googlesource.com/c/go/+/181940
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodatabase/sql/driver: document Valuer must not panic
Daniel Theophanes [Fri, 5 Apr 2019 17:33:43 +0000 (10:33 -0700)]
database/sql/driver: document Valuer must not panic

While it is possible for the connection pool to guard against panics
on every valuer read, this seems like a high cost to be added,
in both code complexity and possible runtime performance.

Most uses of the Valuer will be trivial, like returning
a struct field. Optimize for that case. If sometime may panic the
valuer should itself use recover and return an error.

Fixes #26332

Change-Id: Iad18780b8028f669f5a7841b74a5384d62fb6a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/170700
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: mention os.UserConfigDir in release notes
Dmitri Shuralyov [Wed, 12 Jun 2019 18:59:23 +0000 (14:59 -0400)]
doc: mention os.UserConfigDir in release notes

This change makes the release notes for Go 1.13 more complete
by mentioning a new function in the os package.

Change-Id: I0d637fd70ff6d14782bbfb7c13985a0f83b19d6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/181945
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: release notes for text/scanner and text/template
Katie Hockman [Wed, 12 Jun 2019 22:04:00 +0000 (18:04 -0400)]
doc: release notes for text/scanner and text/template

Change-Id: Ib5417cc48959b03befb1579da3281415a11ede9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/181879
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/go: add GOPRIVATE environment variable
Russ Cox [Tue, 11 Jun 2019 17:53:12 +0000 (13:53 -0400)]
cmd/go: add GOPRIVATE environment variable

It is too confusing to have to set GONOSUMDB and GONOPROXY
in common use cases, but one cannot be guaranteed to be a
subset of the other.

This CL adds GOPRIVATE, which takes the same kind of pattern list
but is defined as "these patterns are private (non-public) modules".
Today the implication is that GOPRIVATE is the default setting for
GONOSUMDB and GONOPROXY. If there are other accommodations
to make for private packages in the future or in other tools,
having this clear statement of intent will let us do that.
(For example maybe an IDE integration would hyperlink an import
path to godoc.org; consulting GOPRIVATE would be a reasonable
way to decide not to do that for certain imports. In contrast,
consulting GONOPROXY or GONOSUMDB clearly would not.)

Fixes #32184.

Change-Id: If54c12d353c7a0a5c0e0273764140cce3c154a02
Reviewed-on: https://go-review.googlesource.com/c/go/+/181719
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: fix range analysis of small signed integers
Matthew Dempsky [Wed, 12 Jun 2019 02:52:58 +0000 (19:52 -0700)]
cmd/compile: fix range analysis of small signed integers

For int8, int16, and int32, comparing their unsigned value to MaxInt64
to determine non-negativity doesn't make sense, because they have
negative values whose unsigned representation is smaller than that.
Fix is simply to compare with the appropriate upper bound based on the
value type's size.

Fixes #32560.

Change-Id: Ie7afad7a56af92bd890ba5ff33c86d1df06cfd9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/181797
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc: add release notes for database/sql
Julie [Wed, 12 Jun 2019 16:51:22 +0000 (12:51 -0400)]
doc: add release notes for database/sql

Change-Id: I032a3342c3ac899a39d357420b981b6f281518f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/181939
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
5 years agodoc: add release notes for sync
Katie Hockman [Tue, 11 Jun 2019 19:12:54 +0000 (15:12 -0400)]
doc: add release notes for sync

Change-Id: I49b09349a632a6b6219c85638d9cb6774c0c210a
Reviewed-on: https://go-review.googlesource.com/c/go/+/181721
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: add release notes for the bytes, strings, and time packages
Andrew Bonventre [Tue, 11 Jun 2019 22:09:10 +0000 (18:09 -0400)]
doc: add release notes for the bytes, strings, and time packages

Change-Id: Idb5bf2a61bff635e3ebd926bdeacf943578ac874
Reviewed-on: https://go-review.googlesource.com/c/go/+/181681
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: include -errorsas in go test vet checks
Jonathan Amsterdam [Sat, 1 Jun 2019 21:43:09 +0000 (17:43 -0400)]
cmd/go: include -errorsas in go test vet checks

Make "go test" run the new errorsas vet check by default.

Fixes #31213.

Change-Id: I5c93c000874ffe1c0b6d647bf10de803f414c5c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/179977
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agoerrors: clarify doc for As
Jonathan Amsterdam [Sat, 8 Jun 2019 11:43:40 +0000 (07:43 -0400)]
errors: clarify doc for As

Change-Id: I389d140e8fd2849e4dc438246add47819f6b25a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/181300
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: allow GOPROXY to elide the "https://" prefix
Bryan C. Mills [Thu, 6 Jun 2019 18:43:28 +0000 (14:43 -0400)]
cmd/go: allow GOPROXY to elide the "https://" prefix

Fixes #32191

Change-Id: I6eebe1d4975e904c906e6b839cd6cab9447cbb34
Reviewed-on: https://go-review.googlesource.com/c/go/+/181019
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agodoc: add release notes describing the default mirror and sumdb
Katie Hockman [Tue, 11 Jun 2019 19:12:54 +0000 (15:12 -0400)]
doc: add release notes describing the default mirror and sumdb

Change-Id: I4923f0726ae0261a7c7b0f85e7433ae0f605c123
Reviewed-on: https://go-review.googlesource.com/c/go/+/181738
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/vet: include the errors.As check from upstream x/tools
Bryan C. Mills [Tue, 11 Jun 2019 15:49:09 +0000 (11:49 -0400)]
cmd/vet: include the errors.As check from upstream x/tools

This change revendors golang.org/x/tools to include the check and
modifies cmd/vet to add it to the command.

CL 179977 will enable the check by default for 'go test'.

Commands run (starting in GOROOT/src):
cd cmd
emacs vet/main.go
go get -u=patch golang.org/x/tools/go/analysis/passes/errorsas@latest
go mod tidy
go mod vendor
cd ..
./make.bash
go test all

Updates #31213

Change-Id: Ic2ba9bd2d31c4c5fd9e7c42ca14e8dc38520c93b
Reviewed-on: https://go-review.googlesource.com/c/go/+/181717
Reviewed-by: Jonathan Amsterdam <jba@google.com>
5 years agoerrors: improve As tests
Jonathan Amsterdam [Sat, 8 Jun 2019 11:32:13 +0000 (07:32 -0400)]
errors: improve As tests

Check the value of target after As returns true.

Change-Id: I76a2b25fe825ee1dbb5f39f8f0b211c55bd25a4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/181299
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: add release notes for os and os/exec
Andrew Bonventre [Mon, 10 Jun 2019 21:37:34 +0000 (17:37 -0400)]
doc: add release notes for os and os/exec

Change-Id: I34fd45ee252474c12f2e9c8d9b1a75b9eabb57f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/181549
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: document Go 1.12.6
Dmitri Shuralyov [Mon, 10 Jun 2019 22:02:43 +0000 (18:02 -0400)]
doc: document Go 1.12.6

Change-Id: I8ae00d2392c20c627d58cf7e79015e982b971802
Reviewed-on: https://go-review.googlesource.com/c/go/+/181551
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agodoc: document Go 1.11.11
Dmitri Shuralyov [Mon, 10 Jun 2019 22:02:33 +0000 (18:02 -0400)]
doc: document Go 1.11.11

Change-Id: I1c3e3305dfee4545a6caedd48243770ab3b28277
Reviewed-on: https://go-review.googlesource.com/c/go/+/181550
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/go: in TestScript, set $GOEXE instead of $exe
Bryan C. Mills [Mon, 10 Jun 2019 16:31:13 +0000 (12:31 -0400)]
cmd/go: in TestScript, set $GOEXE instead of $exe

$GOEXE exists and is documented in 'go env', so $exe is redundant and
a bit confusing. Notably, mod_modinfo.txt already assumes that GOEXE
is set (even though it isn't), and thus fails on Windows.

After this CL, `go test cmd/go/...` passes on a windows-amd64-2016
builder. However, given that the $PATH on the builder is very minimal
(#32430) and network access is limited, tests that rely on binaries
(such as 'git') or external networking may still be broken.

Updates #25300

Change-Id: I9d80f2a0fbaa8bc35fa2205b6898aeccecda4e94
Reviewed-on: https://go-review.googlesource.com/c/go/+/181542
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc, net/http: add release notes for net/http and fix doc comments
Andrew Bonventre [Mon, 10 Jun 2019 17:44:56 +0000 (13:44 -0400)]
doc, net/http: add release notes for net/http and fix doc comments

Change-Id: I684e3522e387b2d96d5cfb2878d2f77bf4558443
Reviewed-on: https://go-review.googlesource.com/c/go/+/181545
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go/internal/load: remove unused hasSubdir function
Bryan C. Mills [Mon, 10 Jun 2019 19:35:21 +0000 (15:35 -0400)]
cmd/go/internal/load: remove unused hasSubdir function

No references to this function remain; remove it to avoid confusion
and reduce build overhead.

The last reference was removed in CL 167748.

Change-Id: I9d023c5d8904800edd3898fed79aa9f824dfb46a
Reviewed-on: https://go-review.googlesource.com/c/go/+/181548
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agosyscall: fix freebsd 64-bit test
Keith Randall [Mon, 10 Jun 2019 19:18:44 +0000 (12:18 -0700)]
syscall: fix freebsd 64-bit test

64 bits is 8 bytes. Duh.

Change-Id: I991b359df6241889bdef13152f551af9db6e14c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/181557
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agocmd/go: in tests, don't assume that the 'git' binary is present
Bryan C. Mills [Mon, 10 Jun 2019 15:04:29 +0000 (11:04 -0400)]
cmd/go: in tests, don't assume that the 'git' binary is present

Add a helper-function to testenv to make these skips more ergonomic.
Also update a few existing skips in cmd/go/... to use it.

Updates #25300

Change-Id: I4205b4fb2b685dfac1cff3c999f954bff7b0f3c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/181538
Reviewed-by: Ian Lance Taylor <iant@golang.org>