]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 years agointernal/poll: specify current file position when calling TransmitFile
Alex Brainman [Mon, 11 Jun 2018 02:09:18 +0000 (12:09 +1000)]
internal/poll: specify current file position when calling TransmitFile

Current SendFile implementation assumes that TransmitFile starts from
the current file position. But that appears not true for Windows 10
Version 1803.

TransmitFile documentation

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740565(v=vs.85).aspx

suggests, "You can use the lpOverlapped parameter to specify a 64-bit
offset within the file at which to start the file data transfer by
setting the Offset and OffsetHigh member of the OVERLAPPED structure."

Do as it advises.

Fixes #25722

Change-Id: I241d3bf76d0d5590d4df27c6f922d637068232fb
Reviewed-on: https://go-review.googlesource.com/117816
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoflag: fix headers in documentation, again
Dominik Honnef [Sat, 9 Jun 2018 00:39:06 +0000 (02:39 +0200)]
flag: fix headers in documentation, again

Godoc expects text after a header, not code.

Change-Id: I99f412ad15e10bf9cea0dbd19019ed6ce477736c
Reviewed-on: https://go-review.googlesource.com/117595
Reviewed-by: Rob Pike <r@golang.org>
6 years agocmd/go: document convention to signify generated code.
Akhil Indurti [Thu, 14 Jun 2018 00:52:05 +0000 (20:52 -0400)]
cmd/go: document convention to signify generated code.

This change updates the go tool's documentation under the section
"Generate Go files by processing source" to mention the convention that
generated source files should have a line of text that matches the
following regular expression:

    ^// Code generated .* DO NOT EDIT\.$

Previously, the canonical documentation for this convention
(https://golang.org/s/generatedcode) referenced Rob Pike's comment at
https://golang.org/issue/13560#issuecomment-288457920. This change
merely moves that information to a more visible place.

Updates #25433.

Change-Id: I804d95d307d1dc68cb28da3750ebe9090178c474
Reviewed-on: https://go-review.googlesource.com/118756
Reviewed-by: Rob Pike <r@golang.org>
6 years agocrypto/x509: re-enable TestSystemRoots on darwin
Brad Fitzpatrick [Thu, 7 Jun 2018 15:18:16 +0000 (08:18 -0700)]
crypto/x509: re-enable TestSystemRoots on darwin

It was apparently waiting on CL 36942, which was submitted.

Fixes #21416

Change-Id: I8f4ccc5a3176070abf0df019c82700c5761b5f53
Reviewed-on: https://go-review.googlesource.com/117055
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/cgo: add import path to hash
Ian Lance Taylor [Wed, 13 Jun 2018 22:49:52 +0000 (15:49 -0700)]
cmd/cgo: add import path to hash

This avoids name conflicts when two identical packages use cgo.
This can happen in practice when the same package is vendored multiple
times in a single build.

Fixes #23555

Change-Id: I9f0ec6db9165dcf9cdf3d314c668fee8ada18f9c
Reviewed-on: https://go-review.googlesource.com/118739
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: make case insensitive suggestions aware of package
Emmanuel T Odeke [Mon, 11 Jun 2018 00:17:49 +0000 (17:17 -0700)]
cmd/compile: make case insensitive suggestions aware of package

Ensure that compiler error suggestions after case insensitive
field lookups don't mistakenly reported unexported fields if
those fields aren't in the local package being processed.

Fixes #25727

Change-Id: Icae84388c2a82c8cb539f3d43ad348f50a644caa
Reviewed-on: https://go-review.googlesource.com/117755
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomisc/cgo/test: add test for passing compatible typedefs
Ian Lance Taylor [Wed, 13 Jun 2018 22:22:55 +0000 (15:22 -0700)]
misc/cgo/test: add test for passing compatible typedefs

Fixes #23720

Change-Id: I28e0c16503bc043f793e0dab19668f7a66313312
Reviewed-on: https://go-review.googlesource.com/118737
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocgo: update documentation on calling C variadic functions
Sabin Mihai Rapan [Sun, 28 Jan 2018 12:08:14 +0000 (14:08 +0200)]
cgo: update documentation on calling C variadic functions

The current implementation does not support calling C variadic
functions (as discussed in #975). Document that.

Fixes #23537

Change-Id: If4c684a3d135f3c2782a720374dc4c07ea66dcbb
Reviewed-on: https://go-review.googlesource.com/90415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomath: add examples to Ceil, Floor, Pow, Pow10 functions
Andrii Soldatenko [Wed, 13 Jun 2018 15:58:09 +0000 (18:58 +0300)]
math: add examples to Ceil, Floor, Pow, Pow10 functions

Change-Id: I9154df128b349c102854bb0f21e4c313685dd0e6
Reviewed-on: https://go-review.googlesource.com/118659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodoc: fix fmt usage in code.html
Tim Cooper [Wed, 13 Jun 2018 21:57:40 +0000 (18:57 -0300)]
doc: fix fmt usage in code.html

Fixes #25876

Change-Id: I149dbb2afef13cc13fb5722d930377ed918d7e3c
Reviewed-on: https://go-review.googlesource.com/118717
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoarchive/zip: warn about FileHeader.Name being unvalidated on read
Brad Fitzpatrick [Tue, 12 Jun 2018 19:33:23 +0000 (19:33 +0000)]
archive/zip: warn about FileHeader.Name being unvalidated on read

Updates #25849

Change-Id: I09ee928b462ab538a9d38c4e317eaeb8856919f2
Reviewed-on: https://go-review.googlesource.com/118335
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
6 years agobufio: clarify SplitFunc docs for nil token
Ian Lance Taylor [Wed, 13 Jun 2018 19:44:50 +0000 (12:44 -0700)]
bufio: clarify SplitFunc docs for nil token

Fixes #25472

Change-Id: Idb72ed06a3dc43c49ab984a80f8885352b036465
Reviewed-on: https://go-review.googlesource.com/118695
Reviewed-by: Rob Pike <r@golang.org>
6 years agogo/internal/gccgoimporter: remove dead code
Robert Griesemer [Wed, 13 Jun 2018 06:18:33 +0000 (23:18 -0700)]
go/internal/gccgoimporter: remove dead code

The function parseInitData appears to be unused. Deleted.

Change-Id: I7d4efed9d2519cfbd0ba03d89b45add8b314ea84
Reviewed-on: https://go-review.googlesource.com/118556
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: use expandable columns in ssa.html
Yury Smolsky [Thu, 7 Jun 2018 21:25:12 +0000 (00:25 +0300)]
cmd/compile: use expandable columns in ssa.html

Display just a few columns in ssa.html, other
columns can be expanded by clicking on collapsed column.

Use sans serif font for the text, slightly smaller font size
for non program text.

Fixes #25286

Change-Id: I1094695135401602d90b97b69e42f6dda05871a2
Reviewed-on: https://go-review.googlesource.com/117275
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agosyscall: check Fchmodat flags parameter on Linux
Tobias Klauser [Wed, 13 Jun 2018 13:54:42 +0000 (15:54 +0200)]
syscall: check Fchmodat flags parameter on Linux

As mentioned in #25845, port CL 46474 from golang.org/x/sys/unix to the
syscall package.

Currently Linux' fchmodat(2) syscall implementation doesn't support the
flags parameter (though it might in future versions [1]). Fchmodat in
the syscall package takes the parameter and (wrongly) passes it on to the
syscall which will ignore it.

According to the POSIX.1-2008 manual page [2], AT_SYMLINK_NOFOLLOW is
the only valid value for the flags parameter and EOPNOTSUPP should be
returned in case changing the mode of a symbolic link is not supported
by the underlying system. EINVAL should be returned for any other value
of the flags parameter.

  [1] https://patchwork.kernel.org/patch/9596301/
  [2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

Updates #20130
Updates #25845

Change-Id: I1021dd0e6a4f4cb3557cb1c1b34dd618c378cda6
Reviewed-on: https://go-review.googlesource.com/118658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoos: don't poll fifos on Darwin
Ian Lance Taylor [Wed, 13 Jun 2018 18:56:15 +0000 (11:56 -0700)]
os: don't poll fifos on Darwin

The Darwin kqueue implementation doesn't report any event when the
last writer for a fifo is closed.

Fixes #24164

Change-Id: Ic2c47018ef1284bf2e26379f8dd7646edaad4d05
Reviewed-on: https://go-review.googlesource.com/118566
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: move iOS kevent calls to libc
Elias Naur [Wed, 13 Jun 2018 16:21:23 +0000 (18:21 +0200)]
runtime: move iOS kevent calls to libc

Change-Id: Ie97c9c9163f5af7b4768c34faac726e21627aa79
Reviewed-on: https://go-review.googlesource.com/118660
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agoruntime: move darwin kevent calls to libc
Keith Randall [Wed, 13 Jun 2018 15:20:23 +0000 (08:20 -0700)]
runtime: move darwin kevent calls to libc

kqueue, kevent, closeonexec, setitimer, with sysctl and fcntl helpers.

TODO:arm,arm64

Change-Id: I9386f377186d6ac7cb99064c524a67e0c8282eba
Reviewed-on: https://go-review.googlesource.com/118561
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

6 years agoruntime/pprof: skip TestMapping if CGO is not available
Hana Kim [Wed, 13 Jun 2018 17:37:33 +0000 (13:37 -0400)]
runtime/pprof: skip TestMapping if CGO is not available

The test requires cgo

Change-Id: I1bffee5f187afcf4b7e27516451c56ddfc263a26
Reviewed-on: https://go-review.googlesource.com/118638
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoRevert "cmd/link: separate virtual address layout from file layout"
Austin Clements [Wed, 13 Jun 2018 17:42:22 +0000 (17:42 +0000)]
Revert "cmd/link: separate virtual address layout from file layout"

This reverts commit bd83774593bca66cc899d5180c77680bc907fab8.

Reason for revert: This broke ELF layout on arm, arm64, mips*, mips64*, ppc64*, and s390x.

Change-Id: I56a27b76e6f4b22ce39a99790af9116f8687eee9
Reviewed-on: https://go-review.googlesource.com/118675
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http: make Transport.RoundTrip check context.Done earlier
Brad Fitzpatrick [Wed, 13 Jun 2018 15:12:28 +0000 (15:12 +0000)]
net/http: make Transport.RoundTrip check context.Done earlier

Fixes #25852

Change-Id: I35c630367c8f1934dcffc0b0e08891d55a903518
Reviewed-on: https://go-review.googlesource.com/118560
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agosyscall: support Linux syscalls without error return on mipsx/mips64x
Tobias Klauser [Wed, 13 Jun 2018 13:40:50 +0000 (15:40 +0200)]
syscall: support Linux syscalls without error return on mipsx/mips64x

Like on other architectures, use rawSyscallNoError for Linux syscalls
that don't return an error and convert all applicable occurences of
RawSyscall to use it instead.

This was missed in CL 84485 because mkall.sh doesn't support
mipsx/mips64x, so add the corresponding entries as well.

Updates #22924

Change-Id: I762cbee0827140b9890c4a10830e0b4cd33de92f
Reviewed-on: https://go-review.googlesource.com/118655
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/wasm: remove use of performance.timeOrigin
Richard Musiol [Wed, 13 Jun 2018 08:36:01 +0000 (10:36 +0200)]
misc/wasm: remove use of performance.timeOrigin

This commit changes wasm_exec.js to not depend on the existence of
performance.timeOrigin. The field is not yet supported on all
browsers, e.g. it is unavailable on Safari.

Change-Id: I6cd3834376c1c55424c29166fde1219f0d4d338f
Reviewed-on: https://go-review.googlesource.com/118617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime/pprof: set HasFunctions of mapping entries
Hana Kim [Tue, 12 Jun 2018 16:01:59 +0000 (12:01 -0400)]
runtime/pprof: set HasFunctions of mapping entries

The pprof tool utilizes attributes of mapping entries
such as HasFunctions to determine whether the profile
includes necessary symbol information.
If none of the attributes is set, pprof tool tries to
read the corresponding binary to use for local symbolization.
If the binary doesn't exist, it prints out error messages.

Go runtime generated profiles without any of the attributes
set so the pprof tool always printed out the error messages.
The error messages became more obvious with the new
terminal support that uses red color for error messages.

Go runtime can symbolize all Go symbols and generate
self-contained profile for pure Go program. Thus, there
is no reason for the pprof tool to look for the copy of
the binary. So, this CL sets one of the attributes
(HasFunctions) true if all PCs in samples look fully
symbolized.

For non-pure Go program, however, it's possible that
symbolization of non-Go PCs is incomplete. In this case,
we need to leave the attributes all false so pprof can attempt
to symbolize using the local copy of the binary if available.
It's hard to determine whether a mapping includes non-Go
code. Instead, this CL checks PCs from collected samples.
If unsuccessful symbolization is observed, it skips setting
the HasFunctions attribute.

Fixes #25743

Change-Id: I5108be45bbc37ab486d145fa03e7ce37d88fad50
Reviewed-on: https://go-review.googlesource.com/118275
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/dist, go/types: add support for GOARCH=riscv64
Tobias Klauser [Wed, 13 Jun 2018 08:51:17 +0000 (10:51 +0200)]
cmd/dist, go/types: add support for GOARCH=riscv64

This is needed in addition to CL 110066 in order to be able to generate
Go type definitions for linux/riscv64 in the golang.org/x/sys/unix
package.

Change-Id: I4a27e6424aaea63283b55bd4f73b958b41f29d72
Reviewed-on: https://go-review.googlesource.com/118618
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix go list usage line
Russ Cox [Tue, 12 Jun 2018 20:40:52 +0000 (16:40 -0400)]
cmd/go: fix go list usage line

CL 108156 added -cgo and -export,
but in the usage line it added -cgo and -list.
CL 117015 correctly added -export to the usage line.
All that remains is to remove -list.

Change-Id: I8cc5cfc78bc6b52080ae1b861f92620a8f18b53f
Reviewed-on: https://go-review.googlesource.com/118375
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodoc: use HTTPS for links
Suriyaa Sundararuban [Wed, 13 Jun 2018 07:06:04 +0000 (07:06 +0000)]
doc: use HTTPS for links

Change-Id: I9d2d25df067ca573589db5ff18296a5ec33866be
Reviewed-on: https://go-review.googlesource.com/118595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoencoding/gob: correct issue number typo in comment
Ian Lance Taylor [Tue, 12 Jun 2018 23:41:14 +0000 (16:41 -0700)]
encoding/gob: correct issue number typo in comment

Change-Id: I3ac25cf1770b5ac0d36690c37615b3badd27463d
Reviewed-on: https://go-review.googlesource.com/118455
Reviewed-by: Rob Pike <r@golang.org>
6 years agodoc/contribute.html: add whitespace after <code> blocks, where missing
Dave Russell [Wed, 13 Jun 2018 03:43:12 +0000 (03:43 +0000)]
doc/contribute.html: add whitespace after <code> blocks, where missing

Change-Id: Iea5c705dd58f9b83fbeb0500defcc08c34716169
GitHub-Last-Rev: 35702c784e2329fe3e44947430d246f8cdb04645
GitHub-Pull-Request: golang/go#25858
Reviewed-on: https://go-review.googlesource.com/118536
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agogo/importer: better error message when importer is out of date
Robert Griesemer [Wed, 13 Jun 2018 00:32:50 +0000 (17:32 -0700)]
go/importer: better error message when importer is out of date

Separated out panic handling for bimporter and importer so that
the handler can consider the current version and report a better
error.

Added new export data test for export data version 999 (created
by changing the compiler temporarily) and verifying expected
error message.

Fixes #25856.

Change-Id: Iaafec07b79499154ef7c007341783fa07c57f24d
Reviewed-on: https://go-review.googlesource.com/118496
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agodoc: document the lack of support for symlinks under GOPATH
Nathan Cantelmo [Wed, 6 Sep 2017 15:19:25 +0000 (11:19 -0400)]
doc: document the lack of support for symlinks under GOPATH

In an effort to help others avoid the issues I've hit due to lack of
symlink support under GOPATH, I've added a note of warning to the
Workspaces section.

I have not changed the contents of go help gopath, because on reflection
it seems this change alone may be sufficient.

Fixes #21320

Change-Id: Ib8969bf12cecad878e89ff66b5864bbf3caaf219
Reviewed-on: https://go-review.googlesource.com/61930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoencoding/base32: eliminate alphabet bounds check
Niek Sanders [Thu, 15 Jun 2017 16:38:57 +0000 (09:38 -0700)]
encoding/base32: eliminate alphabet bounds check

name              old time/op   new time/op   delta
EncodeToString-4   35.5µs ± 7%   33.3µs ± 6%  -6.27%   (p=0.008 n=10+9)
DecodeString-4      120µs ± 7%    113µs ± 8%  -5.88%  (p=0.011 n=10+10)

name              old speed     new speed     delta
EncodeToString-4  231MB/s ± 8%  247MB/s ± 5%  +6.55%   (p=0.008 n=10+9)
DecodeString-4    109MB/s ± 7%  116MB/s ± 8%  +6.27%  (p=0.011 n=10+10)

Change-Id: I60bf962464179e35b1711617adbc45a822eaece5
Reviewed-on: https://go-review.googlesource.com/45876
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoregexp: add QuoteMeta example
Matthew Broberg [Sat, 15 Jul 2017 23:40:29 +0000 (17:40 -0600)]
regexp: add QuoteMeta example

Change-Id: I0bbb53cad9a7c464ab1cfca381128f33496813ff
Reviewed-on: https://go-review.googlesource.com/49130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocontext: add docs to ExampleWithValue
Ioannis Georgoulas [Sat, 15 Jul 2017 18:16:56 +0000 (12:16 -0600)]
context: add docs to ExampleWithValue

Change-Id: I3a83c63f4db2e46fd96f373378a429896e93f9d1
Reviewed-on: https://go-review.googlesource.com/48861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime/internal/sys: rename Wasm to WASM
Richard Musiol [Tue, 12 Jun 2018 21:22:03 +0000 (23:22 +0200)]
runtime/internal/sys: rename Wasm to WASM

This commit changes sys.Wasm to sys.WASM, as requested on
https://groups.google.com/forum/#!topic/golang-dev/VquDxlhjPkg

Change-Id: I30a208c34576a8bb49b9beb524203d71df8fdf1c
Reviewed-on: https://go-review.googlesource.com/118395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/link: separate virtual address layout from file layout
Austin Clements [Fri, 4 May 2018 18:55:31 +0000 (14:55 -0400)]
cmd/link: separate virtual address layout from file layout

Currently these two forms of layout are done in a single pass. This
makes it difficult to compress DWARF sections because that must be
done after relocations are applied, which must happen after virtual
address layout, but we can't layout the file until we've compressed
the DWARF sections.

Fix this by separating the two layout steps. In the process, we can
also unify the copy-pasted code in Link.address to compute file
offsets. Currently, each instance of this is slightly different, but
there's no reason for it to be. For example, we don't perform
PEFILEALIGN alignment on Segrodata or Selreltodata even when HeadType
== Hwindows, but it turns out it doesn't matter whether you do or
don't because these segments simply don't exist on Windows. Hence, in
the unified code path, we do this alignment for all segments.
Likewise, there are two ways of computing Fileoff:
  seg.Vaddr - prev.Vaddr + prev.Fileoff
and
  prev.Fileoff + uint64(Rnd(int64(prev.Filelen), int64(*FlagRound)))
At the moment, these always have the same value, but the latter will
continue to work after we start compressing sections on disk.

Tested by comparing test binaries for all packages in std before and
after this change for GOOS={linux,windows,darwin,plan9}. All binaries
are identical.

For #11799.

Change-Id: If09f28771bb4d78dd392fd58b8d7c9d5f22b0b9f
Reviewed-on: https://go-review.googlesource.com/111682
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: use build cache for tests when GOCACHE is unset
Russ Cox [Tue, 12 Jun 2018 20:05:29 +0000 (16:05 -0400)]
cmd/go: use build cache for tests when GOCACHE is unset

Before this CL, if you had GOCACHE=/some/dir, then the cmd/go tests used it.
But if you were relying on the implicit behavior that GOCACHE being empty
meant an appropriate system-specific cache directory, then the cmd/go tests
ran with no cache at all, which makes them about 4X slower.

During all.bash GOCACHE is set to a fresh temporary directory and is therefore
already getting proper caching; this CL mainly helps people running 'go test cmd/go'
by hand.

Change-Id: I7c322ca79b877c1d0a3b448b95d5354fbfcba7f8
Reviewed-on: https://go-review.googlesource.com/118320
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: use a different register for updated value in AtomicAnd8/Or8 on ARM64
Cherry Zhang [Mon, 11 Jun 2018 17:41:23 +0000 (13:41 -0400)]
cmd/compile: use a different register for updated value in AtomicAnd8/Or8 on ARM64

ARM64 manual says it is "constrained unpredictable" if the src
and dst registers of STLXRB are same, although it doesn't seem
to cause any problem on real hardwares so far. Fix by allocating
a different register to hold the updated value for
AtomicAnd8/Or8. We do this by making the ops returns <val,mem>
like AtomicAdd, although val will not be used elsewhere.

Fixes #25823.

Change-Id: I735b9822f99877b3c7aee67a65e62b7278dc40df
Reviewed-on: https://go-review.googlesource.com/117976
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Wei Xiao <Wei.Xiao@arm.com>
6 years agotest: add test to verify that string copies don't get optimized away
Brad Fitzpatrick [Tue, 12 Jun 2018 16:16:38 +0000 (16:16 +0000)]
test: add test to verify that string copies don't get optimized away

Fixes #25834

Change-Id: I33e58dabfd04b84dfee1a9a3796796b5d19862e7
Reviewed-on: https://go-review.googlesource.com/118295
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: correct alias cycle detection
Robert Griesemer [Wed, 6 Jun 2018 17:21:15 +0000 (10:21 -0700)]
cmd/compile: correct alias cycle detection

The original fix (https://go-review.googlesource.com/c/go/+/35831)
for this issue was incorrect as it reported cycles in cases where
it shouldn't.

Instead, use a different approach: A type cycle containing aliases
is only a cycle if there are no type definitions. As soon as there
is a type definition, alias expansion terminates and there is no
cycle.

Approach: Split sprint_depchain into two non-recursive and more
easily understandable functions (cycleFor and cycleTrace),
and use those instead for cycle reporting. Analyze the cycle
returned by cycleFor before issueing an alias cycle error.

Also: Removed original fix (main.go) which introduced a separate
crash (#23823).

Fixes #18640.
Fixes #23823.
Fixes #24939.

Change-Id: Ic3707a9dec40a71dc928a3e49b4868c5fac3d3b7
Reviewed-on: https://go-review.googlesource.com/118078
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agodoc/go1.11: first draft of release notes
Andrew Bonventre [Mon, 11 Jun 2018 17:36:05 +0000 (13:36 -0400)]
doc/go1.11: first draft of release notes

Updates golang/go#23122

Change-Id: I2d6769101cdd580901cb08a3027d787fa438d4bc
Reviewed-on: https://go-review.googlesource.com/117975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: use libc for signal functions on iOS
Elias Naur [Thu, 7 Jun 2018 10:19:42 +0000 (12:19 +0200)]
runtime: use libc for signal functions on iOS

Also:
 - Add extra SystemStack space for darwin/arm64 just
like for darwin/arm.
 - Removed redundant stack alignment; the arm64 hardware enforces
 the 16 byte alignment.
 - Save and restore the g registers at library initialization.
 - Zero g registers since libpreinit can call libc functions
 that in turn use asmcgocall. asmcgocall requires an initialized g.
 - Change asmcgocall to work even if no g is set. The change mimics
 amd64.

Change-Id: I1b8c63b07cfec23b909c0d215b50dc229f8adbc8
Reviewed-on: https://go-review.googlesource.com/117176
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agoruntime: use libc's signal functions on Darwin
Keith Randall [Sun, 20 May 2018 15:57:53 +0000 (08:57 -0700)]
runtime: use libc's signal functions on Darwin

sigaction, sigprocmask, sigaltstack, and raiseproc.

Fix bug in mstart_stub where we weren't saving callee-saved registers,
so if an m finished the pthread library calling mstart_stub would
sometimes fail.

Update #17490
Update #22805

Change-Id: Ie297ede0997910aa956834e49e85711b90cdfaa7
Reviewed-on: https://go-review.googlesource.com/116875
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/doc: classify function returning slice or array of T as constructor
Thomas Wanielista [Fri, 22 Dec 2017 21:17:56 +0000 (16:17 -0500)]
go/doc: classify function returning slice or array of T as constructor

Previously, go/doc would only consider functions and slices that
return types of T or any number of pointers to T: *T, **T, etc. This
change expands the definition of a constructor to include functions
that return arrays of a type (or pointer to that type) in its first
return.

With this change, the following return types also classify a function
as a constructor of type T:

[1]T
[1]*T
[1]**T
(and so on)

Fixes #22856.

Change-Id: I37957c5f2d6a7b2ceeb3fbaef359057f2039393d
Reviewed-on: https://go-review.googlesource.com/85355
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoruntime: convert a darwin/arm64 syscall to libc
Elias Naur [Tue, 12 Jun 2018 09:10:49 +0000 (11:10 +0200)]
runtime: convert a darwin/arm64 syscall to libc

Change-Id: I5704a07375fc672ac70c1f4e8df6f4fff760b4bf
Reviewed-on: https://go-review.googlesource.com/118117
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agodoc: use HTTPS for man.openbsd.org link in go1.7.html
Suriyaa Sundararuban [Tue, 12 Jun 2018 12:11:58 +0000 (12:11 +0000)]
doc: use HTTPS for man.openbsd.org link in go1.7.html

Change-Id: I88855dfa3166e90386c90bf6220be0596dab3c0d
Reviewed-on: https://go-review.googlesource.com/118175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: use HTTPS for clang.llvm.org link in go1.6.html
Suriyaa Sundararuban [Tue, 12 Jun 2018 12:17:51 +0000 (12:17 +0000)]
doc: use HTTPS for clang.llvm.org link in go1.6.html

Change-Id: I67aac387359378cf7aa8f7cafa6557ebf1338baf
Reviewed-on: https://go-review.googlesource.com/118176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http, net/http/httptrace: make Transport support 1xx responses properly
Brad Fitzpatrick [Wed, 6 Jun 2018 22:50:01 +0000 (22:50 +0000)]
net/http, net/http/httptrace: make Transport support 1xx responses properly

Previously the Transport had good support for 100 Continue responses,
but other 1xx informational responses were returned as-is.

But per https://tools.ietf.org/html/rfc7231#section-6.2:

> A client MUST be able to parse one or more 1xx responses received
> prior to a final response, even if the client does not expect one. A
> user agent MAY ignore unexpected 1xx responses.

We weren't doing that. Instead, we were returning any 1xx that wasn't
100 as the final result.

With this change we instead loop over up to 5 (arbitrary) 1xx
responses until we find the final one, returning an error if there's
more than 5. The limit is just there to guard against malicious
servers and to have _some_ limit.

By default we ignore the 1xx responses, unless the user defines the
new httptrace.ClientTrace.Got1xxResponse hook, which is an expanded
version of the previous ClientTrace.Got100Continue.

Still remaining:

* httputil.ReverseProxy work. (From rfc7231#section-6.2: "A proxy MUST
  forward 1xx responses unless the proxy itself requested the
  generation of the 1xx response."). Which would require:

* Support for an http.Handler to generate 1xx informational responses.

Those can happen later. Fixing the Transport to be resilient to others
using 1xx in the future without negotiation (as is being discussed
with HTTP status 103) is most important for now.

Updates #17739

Change-Id: I55aae8cd978164643fccb9862cd60a230e430486
Reviewed-on: https://go-review.googlesource.com/116855
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agonet: update file read position after sendfile syscall
Tobias Klauser [Mon, 11 Jun 2018 12:41:58 +0000 (14:41 +0200)]
net: update file read position after sendfile syscall

On dragonfly, freebsd and solaris the sendfile syscall does not update
the read position of the source fd. Update it after sendfile so
successive calls start at the correct position.

Fixes #25809

Change-Id: Iaac79f89704b75b8038d4bb60eaf793a262cdd8f
Reviewed-on: https://go-review.googlesource.com/117895
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years ago.github: use HTTPS for Stack Overflow link in SUPPORT.md
Suriyaa Sundararuban [Tue, 12 Jun 2018 09:40:24 +0000 (09:40 +0000)]
.github: use HTTPS for Stack Overflow link in SUPPORT.md

Change-Id: I4e339b7c359a7cdb0933f7624ce190086c9c3599
Reviewed-on: https://go-review.googlesource.com/118155
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
6 years agodoc: remove GOROOT custom install instruction
Joe Cortopassi [Mon, 30 Apr 2018 22:32:33 +0000 (22:32 +0000)]
doc: remove GOROOT custom install instruction

Setting GOROOT is no longer necessary for custom installation as of 1.10 (reference: https://go-review.googlesource.com/c/go/+/42533). Fixes #25002

Change-Id: Ic3980833ac437b7a20b951df33805ad1071a40ce
GitHub-Last-Rev: 156bf6510a21266bfb8397e564635278aa3bb1e5
GitHub-Pull-Request: golang/go#25190
Reviewed-on: https://go-review.googlesource.com/110435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/vet: use vet-specific export data to record detected printf wrappers
Russ Cox [Thu, 7 Jun 2018 14:55:28 +0000 (10:55 -0400)]
cmd/vet: use vet-specific export data to record detected printf wrappers

This CL takes advantage of the ability to record vet-specific export data,
added in CL 108558, to save information about observed printf wrappers.
Then calls to those wrappers from other packages can be format-checked.
This found a few real mistakes using previously-unrecognized printf
wrappers in cmd/compile. It will no doubt find real mistakes in external code.

Change-Id: I9c29c92d89bbdc984571a174a96e6054585e9cd4
Reviewed-on: https://go-review.googlesource.com/108559
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agocmd/go/internal/cfg: note the copy of this code in x/tools/cmd/godoc
Brad Fitzpatrick [Tue, 12 Jun 2018 01:24:00 +0000 (01:24 +0000)]
cmd/go/internal/cfg: note the copy of this code in x/tools/cmd/godoc

Updates #23445

Change-Id: I4b09073e53b1cf04de698b711fb5fb0d08bc02df
Reviewed-on: https://go-review.googlesource.com/118077
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: add support for vet-specific export data
Russ Cox [Fri, 20 Apr 2018 16:16:36 +0000 (12:16 -0400)]
cmd/go: add support for vet-specific export data

This CL makes it possible for vet to write down notes about one package
and then access those notes later, when analyzing other code importing
that package. This is much like what the compiler does with its own export
data for type-checking, so we call it "vet-export" data or vetx data.

The next CL in the stack makes vet actually use this functionality.

Change-Id: Ic70043ab407dfbfdb3f30eaea7c0e3c8197009cf
Reviewed-on: https://go-review.googlesource.com/108558
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/link: treat cgo exported symbols as C symbols
Ian Lance Taylor [Mon, 11 Jun 2018 23:46:23 +0000 (16:46 -0700)]
cmd/link: treat cgo exported symbols as C symbols

Fixes #25827

Change-Id: I6736c3ac061ca32aac2eb68b01ba53a179d68cf4
Reviewed-on: https://go-review.googlesource.com/118076
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/doc: continue to search when package import fails
Michael Fraenkel [Wed, 23 May 2018 21:23:35 +0000 (17:23 -0400)]
cmd/doc: continue to search when package import fails

Keep searching for a package that is both findable and importable. The
current code would always guarantee that a package was findable but
exited if it was not importable.

Fixes #25478

Change-Id: I237b7dfafb930cae02538c4a2e4d5ce0c1058478
Reviewed-on: https://go-review.googlesource.com/114295
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: remove TODO notes suggesting jump tables
Iskander Sharipov [Fri, 1 Jun 2018 15:55:36 +0000 (18:55 +0300)]
runtime: remove TODO notes suggesting jump tables

For memmove/memclr using jump tables only reduces overall
function performance for both amd64 and 386.

Benchmarks for 32-bit memclr:

name            old time/op    new time/op    delta
Memclr/5-8        8.01ns ± 0%    8.94ns ± 2%  +11.59%  (p=0.000 n=9+9)
Memclr/16-8       9.05ns ± 0%    9.49ns ± 0%   +4.81%  (p=0.000 n=8+8)
Memclr/64-8       9.15ns ± 0%    9.49ns ± 0%   +3.76%  (p=0.000 n=9+10)
Memclr/256-8      16.6ns ± 0%    16.6ns ± 0%     ~     (p=1.140 n=10+9)
Memclr/4096-8      179ns ± 0%     166ns ± 0%   -7.26%  (p=0.000 n=9+8)
Memclr/65536-8    3.36µs ± 1%    3.31µs ± 1%   -1.48%  (p=0.000 n=10+9)
Memclr/1M-8       59.5µs ± 3%    60.5µs ± 2%   +1.67%  (p=0.009 n=10+10)
Memclr/4M-8        239µs ± 3%     245µs ± 0%   +2.49%  (p=0.004 n=10+8)
Memclr/8M-8        618µs ± 2%     614µs ± 1%     ~     (p=0.315 n=10+8)
Memclr/16M-8      1.49ms ± 2%    1.47ms ± 1%   -1.11%  (p=0.029 n=10+10)
Memclr/64M-8      7.06ms ± 1%    7.05ms ± 0%     ~     (p=0.573 n=10+8)
[Geo mean]        3.36µs         3.39µs        +1.14%

For less predictable data, like loop iteration dependant sizes,
branch table still shows 2-5% worse results.
It also makes code slightly more complicated.

This CL removes TODO note that directly suggest trying this
optimization out. That encourages people to spend their time
in a quite hopeless endeavour.

The code used to implement branch table used a 32/64-entry table
with pointers to TEXT blocks that implemented every associated
label work. Most last entries point to "loop" code that is
a fallthrough for all other sizes that do not map into specialized
routines. The only inefficiency is extra MOVL/MOVQ required
to fetch table pointer itself as MOVL $sym<>(SB)(AX*4) is not valid
in Go asm (it works in other assemblers):

TEXT ·memclrNew(SB), NOSPLIT, $0-8
         MOVL    ptr+0(FP), DI
         MOVL    n+4(FP), BX
         // Handle 0 separately.
         TESTL   BX, BX
         JEQ     _0
         LEAL    -1(BX), CX // n-1
         BSRL    CX, CX
// AX or X0 zeroed inside every text block.
        MOVL    $memclrTable<>(SB), AX
         JMP     (AX)(CX*4)
_0:
         RET

Change-Id: I4f706931b8127f85a8439b95834d5c2485a5d1bf
Reviewed-on: https://go-review.googlesource.com/115678
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/nm: fix TestGoExec on Plan 9
David du Colombier [Mon, 11 Jun 2018 20:34:03 +0000 (22:34 +0200)]
cmd/nm: fix TestGoExec on Plan 9

CL 115975 changed TestGoExec to check symbol types.
However, this test is failing on Plan 9, because
there is no read-only data segment symbol on Plan 9.

This change fixes TestGoExec to replace the check
of read-only data segment symbol (R) by data segment
symbol (D) on Plan 9.

Fixes #25820.

Change-Id: I7164cd9056fa1dfcd1dc1b0f87653290c14c85fa
Reviewed-on: https://go-review.googlesource.com/118035
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: set DepOnly on package when calling go list -deps
Paul Jolly [Fri, 11 May 2018 14:02:45 +0000 (15:02 +0100)]
cmd/go: set DepOnly on package when calling go list -deps

Currently .DepOnly is set when go list -test is invoked to help
distinguish those packages that matched the command line spec from those
which are dependencies (of test packages). This is also useful when
calling go list -deps for the same reason.

Change-Id: Ifc0e68dad0fd01355928793ef803691dee5f4f29
Reviewed-on: https://go-review.googlesource.com/112755
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/vet: add support for vet-specific export data
Russ Cox [Fri, 20 Apr 2018 16:16:58 +0000 (12:16 -0400)]
cmd/vet: add support for vet-specific export data

An upcoming change to cmd/go will enable this functionality, which
allows vet to write down information about one package for use by
later invocation of vet that analyze code importing that package.

We've intended to do this for a long time, but the build caching was
necessary to have a decent way to manage the vet-specific export data.

This is also an experiment in building scalable whole-program analyses.
In the long term we'd like to allow other analyses to be invoked this way.

Change-Id: I34e4b70445786b2e8707ff6a0c00947bf1491511
Reviewed-on: https://go-review.googlesource.com/117099
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoruntime/race: implement race detector for ppc64le
Lynn Boger [Thu, 29 Mar 2018 15:15:18 +0000 (11:15 -0400)]
runtime/race: implement race detector for ppc64le

This adds the support to enable the race detector for ppc64le.

Added runtime/race_ppc64le.s to manage the calls from Go to the
LLVM tsan functions, mostly converting from the Go ABI to the
PPC64 ABI expected by Clang generated code.

Changed racewalk.go to call racefuncenterfp instead of racefuncenter
on ppc64le to allow the caller pc to be obtained in the asm code
before calling the tsan version.

Changed the set up code for racecallbackthunk so it doesn't use
the autogenerated save and restore of the link register since that
sequence uses registers inconsistent with the normal ppc64 ABI.

Made various changes to recognize that race is supported for
ppc64le.

Ensured that tls_g is updated and accessible from race_linux_ppc64le.s
so that the race ctx can be obtained and passed to tsan functions.

This enables the race tests for ppc64le in cmd/dist/test.go and
increases the timeout when running the benchmarks with the -race
option to avoid timing out.

Updates #24354, #23731

Change-Id: Ib97dc7ac313e6313c836dc7d2fb698f9d8fba3ef
Reviewed-on: https://go-review.googlesource.com/107935
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: fix wording in README
Yury Smolsky [Sun, 10 Jun 2018 09:27:47 +0000 (12:27 +0300)]
cmd/compile: fix wording in README

"Syntax analysis" sounds more familiar and fits the
item before, which says "lexical analysis".
If there was specific intention to the original wording,
I, as a reader, would like to see it instead of this
confusing wording.

Change-Id: Id32dbf75300a86b21cb9f35e54526184fe5df6cb
Reviewed-on: https://go-review.googlesource.com/117696
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/compile: add doc comment to the parseFiles function
Yury Smolsky [Sun, 10 Jun 2018 07:26:40 +0000 (10:26 +0300)]
cmd/compile: add doc comment to the parseFiles function

Change-Id: Ifa14557ba834865602c207297ccf0c63e93feb4c
Reviewed-on: https://go-review.googlesource.com/117695
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agolib/time: update vendored tzdata to release 2018e
Alberto Donizetti [Mon, 11 Jun 2018 09:56:45 +0000 (11:56 +0200)]
lib/time: update vendored tzdata to release 2018e

It has been a long time since the last time the vendored zoneinfo in
lib/time was updated, and we're well into the freeze. Update it to the
lastest release from IANA.

Updates #22487

Change-Id: Ib9a8eb409554848285fc88363dbb04ed9d6d9eb0
Reviewed-on: https://go-review.googlesource.com/117855
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: restore r2 when restoring state from gobuf in gogo on ppc64x
Lynn Boger [Fri, 8 Jun 2018 15:07:18 +0000 (11:07 -0400)]
runtime: restore r2 when restoring state from gobuf in gogo on ppc64x

When using plugins with goroutines calling cgo, we hit a case where
an intermittent SIGSEGV occurs when referencing an address that is based
on r2 (TOC address). When the failure can be generated in gdb, the
contents of r2 is wrong even though the value in the current stack's
slot for r2 is correct. So that means it somehow switched to start
running the code in this function without passing through the beginning
of the function which had the correct value of r2 and stored it there.

It was noted that in runtime.gogo when the state is restored from
gobuf, r2 is not restored from its slot on the stack. Adding the
instruction to restore r2 prevents the SIGSEGV.

This adds a testcase under testplugin which reproduces the problem if
the program is run multiple times. The team who reported this problem
has verified it fixes the issue on their larger, more complex
application.

Fixes #25756

Change-Id: I6028b6f1f8775d5c23f4ebb57ae273330a28eb8f
Reviewed-on: https://go-review.googlesource.com/117515
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocrypto, internal/cpu: fix s390x AES feature detection and update SHA implementations
Michael Munday [Thu, 24 May 2018 12:20:21 +0000 (13:20 +0100)]
crypto, internal/cpu: fix s390x AES feature detection and update SHA implementations

Hardware AES support in Go on s390x currently requires ECB, CBC
and CTR modes be available. It also requires that either the
GHASH or GCM facilities are available. The existing checks missed
some of these constraints.

While we're here simplify the cpu package on s390x, moving masking
code out of assembly and into Go code. Also, update SHA-{1,256,512}
implementations to use the cpu package since that is now trivial.

Finally I also added a test for internal/cpu on s390x which loads
/proc/cpuinfo and checks it against the flags set by internal/cpu.

Updates #25822 for changes to vet whitelist.

Change-Id: Iac4183f571643209e027f730989c60a811c928eb
Reviewed-on: https://go-review.googlesource.com/114397
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet: skip TestSendfileParts on dragonfly and solaris
Tobias Klauser [Mon, 11 Jun 2018 07:40:45 +0000 (09:40 +0200)]
net: skip TestSendfileParts on dragonfly and solaris

Skip it like on freebsd until there is proper a fix for #25809

Updates #25809

Change-Id: Id53c433aee75f2a992ab6a8d58d98fd1f8a6c1c6
Reviewed-on: https://go-review.googlesource.com/117698
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
6 years agonet: add TestSendfileParts
Alex Brainman [Mon, 11 Jun 2018 01:03:25 +0000 (11:03 +1000)]
net: add TestSendfileParts

Add test for freebsd issue #25809.

This test also fails on my Windows 10 Version 1803.
My hope is that adding new test will break one of our builders.

Updates #25722
Updates #25809

Change-Id: Ia103bc708b8fa3b9af57613acc44893f90b3fa18
Reviewed-on: https://go-review.googlesource.com/117775
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agosyscall: update TOKEN_ALL_ACCESS according to WinNT.h
Thanabodee Charoenpiriyakij [Sat, 9 Jun 2018 18:01:27 +0000 (01:01 +0700)]
syscall: update TOKEN_ALL_ACCESS according to WinNT.h

TOKEN_ALL_ACCESS was changed at some stage by Microsoft.

Updates #25775

Change-Id: I3e18914207a0020b2ebfb99f4e57aa55f9de813b
Reviewed-on: https://go-review.googlesource.com/117635
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
6 years agonet/http: add application/wasm mime type
Agniva De Sarker [Wed, 16 May 2018 13:59:41 +0000 (19:29 +0530)]
net/http: add application/wasm mime type

Although not part of http://mimesniff.spec.whatwg.org,
for WASM streaming compilation to happen, the response
needs to have the application/wasm MIME type
as mentioned here:
https://webassembly.github.io/spec/web-api/index.html#streaming-modules.

And all current browsers prevent streaming compilation
from happening if this MIME type is not present in the response.

The magic number is mentioned here:
https://webassembly.org/docs/binary-encoding

Since we are already adding WASM support, it makes sense
to support this MIME type.

Change-Id: I8dd7b413a8c438a5c23c29d843b42f6da2a20ba4
Reviewed-on: https://go-review.googlesource.com/113396
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http/httptest: deprecate ResponseRecorder.HeaderMap
Caleb Spare [Sun, 10 Jun 2018 03:14:44 +0000 (20:14 -0700)]
net/http/httptest: deprecate ResponseRecorder.HeaderMap

Users of this field are better off using Result instead.

Fixes #25763.

Change-Id: I4391afa6ed3873107628630adc1d409d77fb3f20
Reviewed-on: https://go-review.googlesource.com/117675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: split pe .text section into .text and .rdata
Alex Brainman [Sat, 2 Jun 2018 05:35:25 +0000 (15:35 +1000)]
cmd/link: split pe .text section into .text and .rdata

Fixes #24725

Change-Id: I2864b88315ab15be036e8940d0a5884d876698d6
Reviewed-on: https://go-review.googlesource.com/115975
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agostrconv: add missing period to godoc comment
Mark Rushakoff [Sat, 9 Jun 2018 00:01:42 +0000 (00:01 +0000)]
strconv: add missing period to godoc comment

Change-Id: I90ba0a6e0c6ccdce16938eed09424308a84fc6fb
GitHub-Last-Rev: 66b6db1a674e6817209a69a7ccd1846d3b0e1900
GitHub-Pull-Request: golang/go#25801
Reviewed-on: https://go-review.googlesource.com/117575
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: add Solaris assembler syntax for gccgo buildid file
Ian Lance Taylor [Tue, 24 Apr 2018 22:09:38 +0000 (15:09 -0700)]
cmd/go: add Solaris assembler syntax for gccgo buildid file

The Solaris assembler uses a different syntax for section directives.

Fixes https://gcc.gnu.org/PR85429.

Change-Id: I1e54dffee3290046dbb68ba4e90ab795c6b72571
Reviewed-on: https://go-review.googlesource.com/109140
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: fix duplicated "unresolved inter-package jump" errors
Iskander Sharipov [Wed, 6 Jun 2018 17:13:19 +0000 (20:13 +0300)]
cmd/link: fix duplicated "unresolved inter-package jump" errors

This is extension to https://golang.org/cl/113955 that handled
duplicated "unresolved relocation" errors.

For platforms with trampoline support, additional error is generated
per each undefined symbol. This breaks TestUndefinedRelocErrors test
on these platforms.

Proposed fix:

1. Changes error text to be identical to normal undefined reloc.
   If relocation is undefined, jump to it will be unresolved
   as well.

2. Introduces a map that can be used by all sites that
   handle this kind of errors which makes it easier
   to report such errors exactly once.

Errors on ppc64 before this change (note first 4 lines):

main.defined1: unresolved inter-package jump to main.undefined()
main.defined1: unresolved inter-package jump to main.undefined()
main.defined2: unresolved inter-package jump to main.undefined()
main.defined2: unresolved inter-package jump to main.undefined()
main.defined1: relocation target main.undefined not defined
main.defined2: relocation target main.undefined not defined
runtime.main_main·f: function main is undeclared in the main package

After this change:

main.defined1: relocation target main.undefined not defined
main.defined2: relocation target main.undefined not defined
runtime.main_main·f: function main is undeclared in the main package

Because of (1), errors output is the same on all platforms now.

Fixes #25753

Change-Id: Ic3084202a6fc5d4a6d2d0a93344f012b37fe58ed
Reviewed-on: https://go-review.googlesource.com/116676
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomisc/wasm: set non-empty default for os.Args
Richard Musiol [Fri, 8 Jun 2018 16:28:37 +0000 (18:28 +0200)]
misc/wasm: set non-empty default for os.Args

os.Args is usually never empty and the flag package panics if it is.
This commit makes os.Args default to ["js"] for js/wasm.

Change-Id: Iba527145686487b052da438fca40159e57e61a81
Reviewed-on: https://go-review.googlesource.com/117475
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: fix pprof livelock on arm
philhofer [Wed, 6 Jun 2018 19:05:36 +0000 (12:05 -0700)]
runtime: fix pprof livelock on arm

On 32-bit architectures without native 64-bit atomic instructions,
64-bit atomics are emulated using spinlocks. However,
the sigprof handling code expects to be able to perform
64-bit atomic operations in signal handlers. Spinning on an
acquired spinlock in a signal handler leads to a livelock.
This is issue #20146.

The original fix for #20146 did not include arm in
the list of architectures that need to work around portability
issues in the sigprof handler code. The unit test designed to
catch this issue does not fail on arm builds because arm uses
striped spinlocks, and thus the livelock takes many minutes
to reproduce. This is issue #24260. (This patch doesn't completely
fix #24260 on go1.10.2 due to issue #25785, which is probably
related to the arm cas kernel helpers. Those have been removed
at tip.)

With this patch applied, I was able to run the reproducer for
issue #24260 for more than 90 minutes without reproducing the
livelock. Without this patch, the livelock took as little as
8 minutes to reproduce.

Fixes #20146
Updates #24260

Change-Id: I64bf53a14d53c4932367d919ac55e17c99d87484
Reviewed-on: https://go-review.googlesource.com/117057
Run-TryBot: Philip Hofer <phofer@umich.edu>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/cover: fix TestCoverHTML on Plan 9
David du Colombier [Fri, 8 Jun 2018 08:14:29 +0000 (10:14 +0200)]
cmd/cover: fix TestCoverHTML on Plan 9

CL 116975 added TestCoverHTML. However, this test is failing
on Plan 9, because the GNU diff tool is called "ape/diff"
instead of "diff" on Plan 9.

This change replaces the "diff" command by the "ape/diff"
command on Plan 9.

Fixes #25795.

Change-Id: I15b49868cd09f3f977aa13fffdfc430c882bf757
Reviewed-on: https://go-review.googlesource.com/117415
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: mark BS{F,R}L as clobbering flags
Keith Randall [Fri, 8 Jun 2018 00:25:28 +0000 (17:25 -0700)]
cmd/compile: mark BS{F,R}L as clobbering flags

Turns out it doesn't currently matter, as these ops are always issued
together with a BTSL which does clobber flags. So I can't write a test
that currently fails. But better to be future-proof.

BS{F,R}Q generates flags, so it doesn't need to be marked as clobbering.

Change-Id: I70daea154023fd435fac696bf3a384803c647cd3
Reviewed-on: https://go-review.googlesource.com/117375
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/cover: fix test on Solaris
David Symonds [Fri, 8 Jun 2018 00:33:54 +0000 (10:33 +1000)]
cmd/cover: fix test on Solaris

Solaris diff doesn't know about -d (a.k.a. --minimal).

Change-Id: I86146b4b93e3d0bdea52a0fde59afca20b5bab51
Reviewed-on: https://go-review.googlesource.com/117335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/cover: fix sorting of profile segment boundaries, again
David Symonds [Thu, 7 Jun 2018 10:44:17 +0000 (20:44 +1000)]
cmd/cover: fix sorting of profile segment boundaries, again

This is a refinement of CL 114855, which fixed the empty clause case,
but broke some other cases where segment boundaries can coincide
for other reasons.

Fixes #25767.

Change-Id: I2a387c83f9d651c8358f3e11b03f6167af0eb8bf
Reviewed-on: https://go-review.googlesource.com/116976
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agogo/types: extend cycle detection past simple type cycles
Robert Griesemer [Mon, 4 Jun 2018 22:42:12 +0000 (15:42 -0700)]
go/types: extend cycle detection past simple type cycles

This change improves upon cycle detection by taking into account
cycles involving constants, variables, _and_ types. All new code
(except for the additional tests) is guarded by the useCycleMarking
(internal) flag and thus can be disabled on short notice if it
introduced new problems. (The intent is to remove this flag shortly
after 1.11 is released.)

The test suite has been extended with various additional (and mostly
esoteric) test cases which now correctly report cycles. A handful of
existing test cases now report additional errors, but those are mostly
esoteric cases. Overall, this is an improvement over the status quo.

Fixes #8699.
For #20770.

Change-Id: I6086719acd0d5200edca4a3dbe703d053496af31
Reviewed-on: https://go-review.googlesource.com/116815
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agocmd/cover: add test for HTML output
David Symonds [Thu, 7 Jun 2018 10:25:10 +0000 (20:25 +1000)]
cmd/cover: add test for HTML output

This adds a case for what was fixed in 4fe688c to prevent regression;
a follow-on change will address #25767.

Change-Id: Iced8cc10e2993ef7caf7e9c59ffbc7147d78ddd7
Reviewed-on: https://go-review.googlesource.com/116975
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: don't refuse to update a present package only because of its source configuration
David Symonds [Wed, 16 May 2018 23:39:21 +0000 (09:39 +1000)]
cmd/go: don't refuse to update a present package only because of its source configuration

If a package is checked out in the right place, but uses, for instance,
an unusual Git remote configuration, don't refuse to update just because
cmd/go can't parse it. In most cases, `git pull -ff-only` (or the
equivalent in other VCSes) works just fine.

Updates #25432.

Change-Id: I1952a0e6e03f185f34029b186e1756c9549689e1
Reviewed-on: https://go-review.googlesource.com/113456
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agocrypto/tls: expand docs on client-side session ticket support
Filippo Valsorda [Thu, 7 Jun 2018 20:24:52 +0000 (16:24 -0400)]
crypto/tls: expand docs on client-side session ticket support

Users are sometimes confused why session tickets are not enabled even if
SessionTicketsDisabled is false.

Change-Id: I3b783d2cf3eed693a3ad6acb40a8003db7e0b648
Reviewed-on: https://go-review.googlesource.com/117255
Reviewed-by: Adam Langley <agl@golang.org>
6 years agocmd/go: restore "go list" exit code for missing binary packages
Bryan C. Mills [Thu, 7 Jun 2018 16:50:21 +0000 (12:50 -0400)]
cmd/go: restore "go list" exit code for missing binary packages

Prior to CL 108156, "go list" exited with code 0 if there were missing binary packages.
Restore that behavior to fix the failing TestBinaryOnlyPackages.

Fixes golang/go#25784.

Change-Id: Iaeca6bcc840f5ac8f2a016cef131f5c59a8261a8
Reviewed-on: https://go-review.googlesource.com/117036
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodebug/pe: add IMAGE_FILE_MACHINE_ARM64
Brad Fitzpatrick [Thu, 7 Jun 2018 15:29:41 +0000 (15:29 +0000)]
debug/pe: add IMAGE_FILE_MACHINE_ARM64

Fixes #20849

Change-Id: If2a330185aa7e95eb84dccdbc4c7f3e9b970cca1
Reviewed-on: https://go-review.googlesource.com/117056
Reviewed-by: Matti Moell <matti.moell@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: skip TestBinaryOnlyPackages until it's fixed
Brad Fitzpatrick [Thu, 7 Jun 2018 15:46:19 +0000 (15:46 +0000)]
cmd/go: skip TestBinaryOnlyPackages until it's fixed

Updates #25784

Change-Id: I638eab82b026d3df89da532b5cc3f5c06b02d6c8
Reviewed-on: https://go-review.googlesource.com/117075
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

6 years agocrypto: randomly read an extra byte of randomness in some places.
Adam Langley [Mon, 18 Sep 2017 21:49:21 +0000 (14:49 -0700)]
crypto: randomly read an extra byte of randomness in some places.

Code has ended up depending on things like RSA's key generation being
deterministic given a fixed random Reader. This was never guaranteed and
would prevent us from ever changing anything about it.

This change makes certain calls randomly (based on the internal
fastrand) read an extra byte from the random Reader. This helps to
ensure that code does not depend on internal details.

I've not added this call in the key generation of ECDSA and DSA because,
in those cases, key generation is so obvious that it probably is
acceptable to do the obvious thing and not worry about code that depends
on that.

This does not affect tests that use a Reader of constant bytes (e.g. a
zeroReader) because shifting such a stream is a no-op. The stdlib uses
this internally (which is fine because it can be atomically updated if
the crypto libraries change).

It is possible that external tests could be doing the same and would
thus break if we ever, say, tweaked the way RSA key generation worked.
I feel that addressing that would be more effort than it's worth.

Fixes #21915

Change-Id: I84cff2e249acc921ad6eb5527171e02e6d39c530
Reviewed-on: https://go-review.googlesource.com/64451
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

6 years agoencoding/asn1: gofmt
Tobias Klauser [Thu, 7 Jun 2018 07:38:18 +0000 (09:38 +0200)]
encoding/asn1: gofmt

CL 113837 introduced some changes which were not properly gofmt'ed, fix them.

Change-Id: I89329063f9c468238051e45380d752e66efdb939
Reviewed-on: https://go-review.googlesource.com/116895
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agointernal/cpu: convert CRLF to LF line ending, and some superfulous space
Zhou Peng [Fri, 25 May 2018 14:34:45 +0000 (14:34 +0000)]
internal/cpu: convert CRLF to LF line ending, and some superfulous space

Change-Id: Ie355f06e9be93d7f7501f697a94ff83d6d0826a2
Reviewed-on: https://go-review.googlesource.com/114556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: fix typo in runqput comment
cch123 [Thu, 7 Jun 2018 10:08:48 +0000 (10:08 +0000)]
runtime: fix typo in runqput comment

Change-Id: Idd88a1d9420545e3e326f8e3b57a38d8c7515555
GitHub-Last-Rev: 59528f552238eb4070cb9a66c1dbfafd6bc3808d
GitHub-Pull-Request: golang/go#25779
Reviewed-on: https://go-review.googlesource.com/116935
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: final edits for add go list -cgo and -export
Russ Cox [Thu, 19 Apr 2018 14:54:12 +0000 (10:54 -0400)]
cmd/go: final edits for add go list -cgo and -export

These got lost because I violated the cardinal rule of Gerrit
which is never click the Submit button in the web UI.

Change-Id: I8ccdfb5d8691960f244941036d33fb5a5a3f0c9a
Reviewed-on: https://go-review.googlesource.com/117015
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/go/internal: add wasm magic header
Agniva De Sarker [Thu, 7 Jun 2018 07:13:56 +0000 (12:43 +0530)]
cmd/go/internal: add wasm magic header

This is needed when we are re-building to the wasm target.

Fixes #25774

Change-Id: I5dc47bd7e56c8570b8d2485273ef0d10f2feac6f
Reviewed-on: https://go-review.googlesource.com/116915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: add go list -cgo and -export
Russ Cox [Thu, 19 Apr 2018 14:54:12 +0000 (10:54 -0400)]
cmd/go: add go list -cgo and -export

We want package analysis tools to be able to ask cmd/go for
cgo-translated files and for the names of files holding export
type information, instead of reinventing that logic themselves.
Allow them to do so, with the new list -cgo and -export flags.

Change-Id: I860df530d8dcc130f1f328413381b5664cc81c3b
Reviewed-on: https://go-review.googlesource.com/108156
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoruntime: remove unused darwinVersion and getDarwinVersion
Tobias Klauser [Thu, 7 Jun 2018 10:17:40 +0000 (12:17 +0200)]
runtime: remove unused darwinVersion and getDarwinVersion

They are unused since CL 114799.

Also remove consts _CTL_KERN and _KERN_OSRELEASE previously used by
getDarwinVersion.

Change-Id: I51b701e8effbe4dd4301b0e6d52e8885469032f4
Reviewed-on: https://go-review.googlesource.com/116955
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoflag: removed the colon after "Usage" in the documentation
hellozee [Thu, 7 Jun 2018 05:14:23 +0000 (05:14 +0000)]
flag: removed the colon after "Usage" in the documentation

Removing the colon will make the "Usage" and "Command line flag syntax" in the docs, a header when interpreted by godoc.

Fixes #25749

Change-Id: Ifc5572e171db1aaef9775b1d6c86091a8f2528fd
GitHub-Last-Rev: 1b579734308cbcb96f17d945b9c7af70e259cb5b
GitHub-Pull-Request: golang/go#25750
Reviewed-on: https://go-review.googlesource.com/116555
Reviewed-by: Rob Pike <r@golang.org>
6 years agocrypto/cipher: replace NewGCMWithNonceAndTagSize with NewGCMWithTagSize
212472270 [Tue, 5 Jun 2018 23:15:40 +0000 (16:15 -0700)]
crypto/cipher: replace NewGCMWithNonceAndTagSize with NewGCMWithTagSize

This function was added during the Go 1.11 dev cycle and isn't part of
the API compatibility promise yet.

In the previous implementation, NewGCMWithNonceAndTagSize was being used
as a helper function for NewGCM, NewGCMWithTagSize, and NewGCMWithNonceSize.
With the removal of Nonce size from the name and parameters, we needed to
add an unexported helper function newGCMWithNonceAndTagSize.

Fixes #24977

Change-Id: Ie70f2a192d0556c4f890deb62e68cff6bbbccd33
Reviewed-on: https://go-review.googlesource.com/116435
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: fix panic-okay-to-inline change; adjust tests
David Chase [Wed, 6 Jun 2018 16:38:35 +0000 (12:38 -0400)]
cmd/compile: fix panic-okay-to-inline change; adjust tests

This line of the inlining tuning experiment
https://go-review.googlesource.com/c/go/+/109918/1/src/cmd/compile/internal/gc/inl.go#347
was incorrectly rewritten in a later patch to use the call
cost, not the panic cost, and thus the inlining of panic
didn't occur when it should.  I discovered this when I
realized that tests should have failed, but didn't.

Fix is to make the correct change, and also to modify the
tests that this causes to fail.  One test now asserts the
new normal, the other calls "ppanic" instead which is
designed to behave like panic but not be inlined.

Change-Id: I423bb7f08bd66a70d999826dd9b87027abf34cdf
Reviewed-on: https://go-review.googlesource.com/116656
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agogo/types: add missing test case for https://golang.org/cl/116735
Robert Griesemer [Wed, 6 Jun 2018 19:35:09 +0000 (12:35 -0700)]
go/types: add missing test case for https://golang.org/cl/116735

Missed this in the prior submit.

For #24182.

Change-Id: If8349d39c80b7ff57bc0c857985f9e52241321b8
Reviewed-on: https://go-review.googlesource.com/116775
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>