]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agodoc/go1.14: mention go/doc.NewFromFiles and associated new data fields
Ian Lance Taylor [Fri, 31 Jan 2020 01:06:31 +0000 (17:06 -0800)]
doc/go1.14: mention go/doc.NewFromFiles and associated new data fields

Updates #23864
Updates #36878

Change-Id: I6efdaafbe5207c625643f201a5931ad735941365
Reviewed-on: https://go-review.googlesource.com/c/go/+/217125
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agodoc: document new hash/maphash package
Keith Randall [Thu, 30 Jan 2020 18:49:12 +0000 (10:49 -0800)]
doc: document new hash/maphash package

Update #36878
Update #28322

Change-Id: I793c7c4dbdd23fdecd715500e90b7cc0cbe4cea5
Reviewed-on: https://go-review.googlesource.com/c/go/+/217099
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go.mod: sync x/crypto with std
Filippo Valsorda [Thu, 30 Jan 2020 22:18:42 +0000 (14:18 -0800)]
cmd/go.mod: sync x/crypto with std

    go get golang.org/x/crypto@v0.0.0-20200128174031-69ecbb4d6d5d
    go mod vendor
    git checkout -- vendor/golang.org/x/sys/unix/asm_linux_riscv64.s \
        vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go

Updates #36851

Change-Id: I95c0584ede599f600da927a04f135fe64a85037e
Reviewed-on: https://go-review.googlesource.com/c/go/+/217118
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agomath/big: update comment on Int.GCD
Robert Griesemer [Thu, 30 Jan 2020 20:26:20 +0000 (12:26 -0800)]
math/big: update comment on Int.GCD

Per the suggestion https://golang.org/cl/216200/2/doc/go1.14.html#423.

Updates #28878.

Change-Id: I654d2d114409624219a0041916f0a4030efc7573
Reviewed-on: https://go-review.googlesource.com/c/go/+/217104
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: fix minor typo (update release notes)
Robert Griesemer [Thu, 30 Jan 2020 19:34:24 +0000 (11:34 -0800)]
doc/go1.14: fix minor typo (update release notes)

Follow-up on https://golang.org/cl/216200/2/doc/go1.14.html#423 .

Updates #36878.

Change-Id: I693a9eb05c6f1f42721a92fda46a4f3449defa24
Reviewed-on: https://go-review.googlesource.com/c/go/+/217100
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: document overlapping interfaces change (update release notes)
Robert Griesemer [Thu, 30 Jan 2020 05:18:16 +0000 (21:18 -0800)]
doc/go1.14: document overlapping interfaces change (update release notes)

Updates #6977.
Updates #36878.

Change-Id: I40594be85ee0a0d4b35bacc90104568d2b8a4761
Reviewed-on: https://go-review.googlesource.com/c/go/+/216997
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: edit "Go command" section, move zone CPU cap note
Jay Conrod [Wed, 29 Jan 2020 22:18:13 +0000 (17:18 -0500)]
doc/go1.14: edit "Go command" section, move zone CPU cap note

Minor edits to text on go command changes.

Also, moved a note about runtime respecting zone CPU caps from
Native Client section to Runtime section.

Change-Id: Ic21e59d7ffecb4b5676a841e7f3743203a82d266
Reviewed-on: https://go-review.googlesource.com/c/go/+/216878
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.14.html: describe the runtime/pprof change
Hana Kim [Wed, 29 Jan 2020 22:09:28 +0000 (17:09 -0500)]
doc/go1.14.html: describe the runtime/pprof change

golang.org/cl/204636
golang.org/cl/205097

Updates #36874

Change-Id: I773868fd027e9cc2187f0a738900f0fcb7711635
Reviewed-on: https://go-review.googlesource.com/c/go/+/216877
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: edit "Go command" section, adding note about go test -v streaming
Jean de Klerk [Wed, 29 Jan 2020 23:09:33 +0000 (16:09 -0700)]
doc/go1.14: edit "Go command" section, adding note about go test -v streaming

Change-Id: Ie88fe441521d60a4ba54ebb418860d0f71073387
Reviewed-on: https://go-review.googlesource.com/c/go/+/216917
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agogo/build: update TestImportDirNotExist to accept more detailed error strings
Bryan C. Mills [Wed, 29 Jan 2020 14:14:50 +0000 (09:14 -0500)]
go/build: update TestImportDirNotExist to accept more detailed error strings

In CL 203820, we switched go/build to use the caller's working
directory for the main module (rather than srcDir), so that go/build
resolution now respects the requirements and replacements of the main
module. When the passed-in srcDir is empty, as of that CL we use "go
list" instead of falling back to in-process (GOPATH-mode) path lookup.

Unfortunately, that broke go/build.TestImportDirNotExist when
GO111MODULE=on: the test was looking for the specific error message
produced by the in-process lookup.

This change relaxes the test to accept the error message produced by
"go list" when srcDir is empty.

Updates #34769
Updates #34860
Updates #35734
Fixes #36867

Change-Id: Id0f7814a4b7dabe8917216eb013bb4eaee283648
Reviewed-on: https://go-review.googlesource.com/c/go/+/216817
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/internal/obj/riscv,cmd/link: shorten the riscv64 call sequence
Joel Sing [Wed, 29 Jan 2020 09:14:18 +0000 (20:14 +1100)]
cmd/internal/obj/riscv,cmd/link: shorten the riscv64 call sequence

Now that the other dependent offset has been identified, we can remove the
unnecessary ADDI instruction from the riscv64 call sequence (reducing it
to AUIPC+JALR, rather than the previous AUIPC+ADDI+JALR).

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

5 years agocmd/compile,cmd/link: fix and re-enable open-coded defers on riscv64
Joel Sing [Wed, 29 Jan 2020 09:06:54 +0000 (20:06 +1100)]
cmd/compile,cmd/link: fix and re-enable open-coded defers on riscv64

The R_CALLRISCV relocation marker is on the JALR instruction, however the actual
relocation is currently two instructions previous for the AUIPC+ADDI sequence.
Adjust the platform dependent offset accordingly and re-enable open-coded defers.

Fixes #36786.

Change-Id: I71597c193c447930fbe94ce44b7355e89ae877bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/216797
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodoc: add the change to json.Compact in the 1.14 changelog
Daniel Martí [Wed, 22 Jan 2020 12:20:02 +0000 (12:20 +0000)]
doc: add the change to json.Compact in the 1.14 changelog

Fixes #36690.

Change-Id: Id4234ab9467270d51f0411375b71ece7f41269b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/215817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.14: document RISC-V support
Brad Fitzpatrick [Tue, 28 Jan 2020 21:40:08 +0000 (21:40 +0000)]
doc/go1.14: document RISC-V support

Fixes #36708
Updates #27532

Change-Id: I9e3bb92d15825e2c4a505e1aea41b2897f18e0ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/216757
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agonet/http: don't treat an alternate protocol as a known round tripper
Ian Lance Taylor [Tue, 28 Jan 2020 00:35:28 +0000 (16:35 -0800)]
net/http: don't treat an alternate protocol as a known round tripper

As of CL 175857, the client code checks for known round tripper
implementations, and uses simpler cancellation code when it finds one.
However, this code was not considering the case of a request that uses
a user-defined protocol, where the user-defined protocol was
registered with the transport to use a different round tripper.
The effect was that round trippers that worked with earlier
releases would not see the expected cancellation semantics with tip.

Fixes #36820

Change-Id: I60e75b5d0badcfb9fde9d73a966ba1d3f7aa42b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/216618
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/dist: remove riscv64 from set of incomplete ports
Brad Fitzpatrick [Tue, 28 Jan 2020 22:57:18 +0000 (22:57 +0000)]
cmd/dist: remove riscv64 from set of incomplete ports

Fixes #27532
Fixes #36853
Updates #28944

Change-Id: I4d0f212deb361c941ce7e5999e237a951c89a296
Reviewed-on: https://go-review.googlesource.com/c/go/+/216758
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
5 years agotest: disable the live test on riscv64
Joel Sing [Tue, 28 Jan 2020 18:30:19 +0000 (05:30 +1100)]
test: disable the live test on riscv64

This test expects that open-coded defers are enabled, which is not currently
the case on riscv64.

Updates issue #27532 and #36786.

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

5 years agoruntime: ensure that searchAddr always refers to inUse memory
Michael Anthony Knyszek [Tue, 28 Jan 2020 19:59:19 +0000 (19:59 +0000)]
runtime: ensure that searchAddr always refers to inUse memory

This change formalizes an assumption made by the page allocator, which
is that (*pageAlloc).searchAddr should never refer to memory that is not
represented by (*pageAlloc).inUse. The portion of address space covered
by (*pageAlloc).inUse reflects the parts of the summary arrays which are
guaranteed to mapped, and so looking at any summary which is not
reflected there may cause a segfault.

In fact, this can happen today. This change thus also removes a
micro-optimization which is the only case which may cause
(*pageAlloc).searchAddr to point outside of any region covered by
(*pageAlloc).inUse, and adds a test verifying that the current segfault
can no longer occur.

Change-Id: I98b534f0ffba8656d3bd6d782f6fc22549ddf1c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/216697
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agosrc/go.mod: import x/crypto/cryptobyte security fix for 32-bit archs
Dmitri Shuralyov [Tue, 28 Jan 2020 18:20:57 +0000 (13:20 -0500)]
src/go.mod: import x/crypto/cryptobyte security fix for 32-bit archs

cryptobyte: fix panic due to malformed ASN.1 inputs on 32-bit archs

When int is 32 bits wide (on 32-bit architectures like 386 and arm), an
overflow could occur, causing a panic, due to malformed ASN.1 being
passed to any of the ASN1 methods of String.

Tested on linux/386 and darwin/amd64.

This fixes CVE-2020-7919 and was found thanks to the Project Wycheproof
test vectors.

Change-Id: I8c9696a8bfad1b40ec877cd740dba3467d66ab54
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/645211
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/216677
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

x/crypto/cryptobyte is used in crypto/x509 for parsing certificates.
Malformed certificates might cause a panic during parsing on 32-bit
architectures (like arm and 386).

Change-Id: I840feb54eba880dbb96780ef7adcade073c4c4e3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/647741
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/216680
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocmd/compile: disable open-coded defers on riscv64
Joel Sing [Sun, 26 Jan 2020 22:32:52 +0000 (09:32 +1100)]
cmd/compile: disable open-coded defers on riscv64

Open-coded defers are currently broken on riscv64 - disable them for the
time being. All of the standard package tests now pass on linux/riscv64.

Updates issue #27532 and #36786

Change-Id: I20fc25ce91dfad48be32409ba5c64ca9a6acef1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/internal/obj/riscv: use signed immediates for U-instructions
Joel Sing [Wed, 22 Jan 2020 16:38:31 +0000 (03:38 +1100)]
cmd/internal/obj/riscv: use signed immediates for U-instructions

On RISCV64, the U-instructions (AUIPC and LUI) take 20 bits, append 12 bits
of zeros and sign extend to 64-bits. As such, the 20 bit immediate value is
signed not unsigned.

Updates #27532

Change-Id: I725215a1dc500106dbfdc0a4425f3c0b2a6f411e
Reviewed-on: https://go-review.googlesource.com/c/go/+/216257
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile/internal/ssa/gen: avoid importing internal riscv64 packages
Joel Sing [Mon, 27 Jan 2020 12:55:30 +0000 (23:55 +1100)]
cmd/compile/internal/ssa/gen: avoid importing internal riscv64 packages

Duplicate the register definitions and names to avoid importing the
cmd/internal/obj/riscv64 package. This makes it possible to build compiler rules
with a stable Go tool chain.

Fixes #36663

Change-Id: I09116a97bb037ca1bc00073306a82bb88862b1e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/216518
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodoc/go1.14: remove TODO from Tools section of release notes
Jay Conrod [Mon, 27 Jan 2020 20:37:11 +0000 (15:37 -0500)]
doc/go1.14: remove TODO from Tools section of release notes

Change-Id: I682193eb06b55eb3e9392146579f57a928c728d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/216598
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.14: go command behavior with GO111MODULE=on outside modules
Jay Conrod [Mon, 27 Jan 2020 20:29:29 +0000 (15:29 -0500)]
doc/go1.14: go command behavior with GO111MODULE=on outside modules

Hopefully this won't affect many people, but it's a substantial change
in behavior for a specific case, so it's probably worth mentioning.

Updates #32027

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

5 years agocmd/compile: on PPC64, fold offset into some loads/stores only when offset is 4-aligned
Cherry Zhang [Fri, 24 Jan 2020 19:11:04 +0000 (14:11 -0500)]
cmd/compile: on PPC64, fold offset into some loads/stores only when offset is 4-aligned

On PPC64, MOVWload, MOVDload, and MOVDstore are assembled to a
"DS from" instruction which requiers the offset is a multiple of
4. Only fold offset to such instructions if it is a multiple of 4.

Fixes #36723.

"GOARCH=ppc64 GOOS=linux go build -gcflags=all=-d=ssa/check/on std cmd"
passes now.

Change-Id: I67f2a6ac02f0d33d470f68ff54936c289a4c765b
Reviewed-on: https://go-review.googlesource.com/c/go/+/216379
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
5 years agodoc/go1.14: note that module support is ready for production use
Bryan C. Mills [Fri, 24 Jan 2020 15:26:24 +0000 (10:26 -0500)]
doc/go1.14: note that module support is ready for production use

The public proxy and checksum database launched with Go 1.13 have been
running smoothly, pkg.go.dev is serving module-aware documentation,
and in 1.14 we have improved the vendoring workflow and finished
Subversion support to reach parity with GOPATH mode for users of those
features, updated documentation (including the “How to Write Go Code”
intro document) and published blog posts describing common modes of
usage, and improved the migration path for existing v2+ modules by
making version resolution less aggressive about "+incompatible" major
versions.

We (always) have more fit-and-finish work to do, but at this point we
believe that module mode will provide a better user experience than
GOPATH mode for most users, including in production use.

Change-Id: I897e0a43e3aebe4c90553c414337a46bfc9c2bef
Reviewed-on: https://go-review.googlesource.com/c/go/+/216317
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agodoc/go1.14: document the new GOINSECURE variable
Bryan C. Mills [Fri, 24 Jan 2020 19:57:41 +0000 (14:57 -0500)]
doc/go1.14: document the new GOINSECURE variable

Fixes #36746

Change-Id: Iab9eaceb743ee52c82e7645216a671362189a021
Reviewed-on: https://go-review.googlesource.com/c/go/+/216380
Reviewed-by: witchard <ben.witchard@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agostrconv: stop describing Unicode graphic characters as non-ASCII
Ian Lance Taylor [Sun, 26 Jan 2020 16:12:58 +0000 (08:12 -0800)]
strconv: stop describing Unicode graphic characters as non-ASCII

Fixes #36778

Change-Id: I3c4ce100fc219bda0ff1d7a086c2309ed695691d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216478
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/vendor: provide riscv64 support in tools/go/analysis/passes/asmdecl
Joel Sing [Fri, 24 Jan 2020 15:55:01 +0000 (02:55 +1100)]
cmd/vendor: provide riscv64 support in tools/go/analysis/passes/asmdecl

Manually add riscv64 support.

Currently being added via https://go-review.googlesource.com/c/tools/+/216337.

Updates #27532

Change-Id: I0e1f7c0eeca4e85ae588f427eff818bb7946a851
Reviewed-on: https://go-review.googlesource.com/c/go/+/216262
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agovendor: provide golang.org/x/sys/cpu/cpu_riscv64.go
Joel Sing [Fri, 24 Jan 2020 15:39:59 +0000 (02:39 +1100)]
vendor: provide golang.org/x/sys/cpu/cpu_riscv64.go

Manually provide golang.org/x/sys/cpu/cpu_riscv64.go until such time
as this code can be updated, post release.

This already exists in x/sys/cpu via:

  https://go-review.googlesource.com/c/sys/+/206860

Update #27532

Change-Id: I57d598ef737642f9c3aa7b280c6c680477ae7633
Reviewed-on: https://go-review.googlesource.com/c/go/+/216261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agotest: adjust tests for riscv64
Joel Sing [Fri, 24 Jan 2020 16:10:04 +0000 (03:10 +1100)]
test: adjust tests for riscv64

This disables some tests that are unsupported on riscv64 and adds support
for risc64 to test/nosplit.

Updates #27532, #36739 and #36765

Change-Id: I0a57797a05bc80236709fc240c0a0efb0ee0d16b
Reviewed-on: https://go-review.googlesource.com/c/go/+/216263
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: disable link syso test on linux/riscv64
Joel Sing [Fri, 24 Jan 2020 15:24:02 +0000 (02:24 +1100)]
cmd/go: disable link syso test on linux/riscv64

This test requires support for external linking, which does not currently
exist on linux/riscv64.

Updates #27532 and #36739

Change-Id: Ia0cdf69f1830b995f2882b47d1bc0be82c4b3039
Reviewed-on: https://go-review.googlesource.com/c/go/+/216259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/objdump: disable unsupported tests on riscv64
Joel Sing [Fri, 24 Jan 2020 15:21:28 +0000 (02:21 +1100)]
cmd/objdump: disable unsupported tests on riscv64

Updates #27532, #36738 and #36739.

Change-Id: If10031c6fd2c8ec2aa8c37f7edb148d8f26f8697
Reviewed-on: https://go-review.googlesource.com/c/go/+/216258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/vendor: cherry pick asm_linux_riscv64.s for x/sys/unix
Joel Sing [Fri, 24 Jan 2020 15:32:52 +0000 (02:32 +1100)]
cmd/vendor: cherry pick asm_linux_riscv64.s for x/sys/unix

Manually cherry pick asm_linux_riscv64.s from x/sys/unix rev 4c3a92842,
as needed for the linux/riscv64 port.

Normally this would be a vendor update, however this is significantly
more risky at this point in time - a full update can be done post release.

Updates #27532

Change-Id: I03bb191bc44dcd24b9a29243957b88d7a9091852
Reviewed-on: https://go-review.googlesource.com/c/go/+/216260
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc/go1.14: mention math/big.GCD argument change
Brian Kessler [Fri, 24 Jan 2020 06:12:41 +0000 (23:12 -0700)]
doc/go1.14: mention math/big.GCD argument change

Change-Id: Ib3b5f64471e7b9794b15a97ba86ba001f2c7d2ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/216200
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agoRevert "runtime: don't hold worldsema across mark phase"
Michael Knyszek [Fri, 24 Jan 2020 16:51:11 +0000 (16:51 +0000)]
Revert "runtime: don't hold worldsema across mark phase"

This reverts commit 7b294cdd8df0a9523010f6ffc80c59e64578f34b, CL 182657.

Reason for revert: This change may be causing latency problems
for applications which call ReadMemStats, because it may cause
all goroutines to stop until the GC completes.

https://golang.org/cl/215157 fixes this problem, but it's too
late in the cycle to land that.

Updates #19812.

Change-Id: Iaa26f4dec9b06b9db2a771a44e45f58d0aa8f26d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216358
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoRevert "runtime: release worldsema before Gosched in STW GC mode"
Michael Knyszek [Fri, 24 Jan 2020 16:50:53 +0000 (16:50 +0000)]
Revert "runtime: release worldsema before Gosched in STW GC mode"

This reverts commit 05511a5c0ae238325c10b0e4e44c3f66f928e4cf, CL 208379.

Reason for revert: So that we can cleanly revert
https://golang.org/cl/182657.

Change-Id: I4fdf4f864a093db7866b3306f0f8f856b9f4d684
Reviewed-on: https://go-review.googlesource.com/c/go/+/216357
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/link: ensure cgo cflags do not leak into dwarf tests
Carlos Amedee [Thu, 23 Jan 2020 21:05:29 +0000 (16:05 -0500)]
cmd/link: ensure cgo cflags do not leak into dwarf tests

Running the dwarf tests with CGO_CFLAGS set
with certain values would cause the test to fail. all.bash
would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10'
because the --macosx-version-min flag is incompatible with some dwarf
tests. The change guards against using an unintended flag in the unit test.

Updates #35459

Change-Id: Idc9b354aba44fdab424cb0081a4b3ea7a6d0f8e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/216177
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: update deltimer comments
Draven [Fri, 24 Jan 2020 10:56:15 +0000 (10:56 +0000)]
runtime: update deltimer comments

Change-Id: I5f4c21bf650b9825ebd98330ac9faa7371a562be
GitHub-Last-Rev: 4a2e9aabe91935001300619b6f58c67f05e9f3c7
GitHub-Pull-Request: golang/go#36728
Reviewed-on: https://go-review.googlesource.com/c/go/+/216223
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: speed up receive on empty closed channel"
Alexander Rakoczy [Thu, 23 Jan 2020 22:56:39 +0000 (22:56 +0000)]
Revert "runtime: speed up receive on empty closed channel"

This reverts CL 181543 (git e1446d9cee91af263af15efe8291644b590bb9ff)

Reason for revert: Caused a regression in the race detector.

Updates #32529
Fixes #36714

Change-Id: Ifefe6784f86ea72f414a89f131c239e9c9fd74eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/216158
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go: fix cgo test when min macOS version is set
Jay Conrod [Fri, 24 Jan 2020 16:25:52 +0000 (08:25 -0800)]
cmd/go: fix cgo test when min macOS version is set

Regression tests for #24161 use a macro to conditionally compile some
stub definitions. The macro tests that the minimum macOS version is
less than 10.12.

We get duplicate definitions when building this test with
CGO_CFLAGS=-mmacosx-version-min=10.x where 10.x < 10.12. With this
change, we use a different macro, __MAC_OS_X_VERSION_MAX_ALLOWED__,
which tests the SDK version instead of the minimum macOS version. This
checks whether these definitions are present in headers.

After this change, 'go tool dist test cgo_test' should pass with
CGO_FLAGS=-mmacosx-version-min=10.10.

Updates #35459

Change-Id: I88d63601c94b0369c73c38d216a2d41ba7d4e579
Reviewed-on: https://go-review.googlesource.com/c/go/+/216243
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agotext/template/parse: remove redundant return
Ariel Mashraki [Thu, 23 Jan 2020 21:00:29 +0000 (23:00 +0200)]
text/template/parse: remove redundant return

Change the `itemChar` clause to be like all other clauses
that don't return a different state function than the default.

Change-Id: I56c863a7d699c1264b24b42ef23138ec47eaacd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/216117
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/x509: mitigate CVE-2020-0601 verification bypass on Windows
Filippo Valsorda [Tue, 21 Jan 2020 19:45:15 +0000 (14:45 -0500)]
crypto/x509: mitigate CVE-2020-0601 verification bypass on Windows

An attacker can trick the Windows system verifier to use a poisoned set
of elliptic curve parameters for a trusted root, allowing it to generate
spoofed signatures. When this happens, the returned chain will present
the unmodified original root, so the actual signatures won't verify (as
they are invalid for the correct parameters). Simply double check them
as a safety measure and mitigation.

Windows users should still install the system security patch ASAP.

This is the same mitigation adopted by Chromium:

https://chromium-review.googlesource.com/c/chromium/src/+/1994434

Change-Id: I2c734f6fb2cb51d906c7fd77034318ffeeb3e146
Reviewed-on: https://go-review.googlesource.com/c/go/+/215905
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ryan Sleevi <sleevi@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocmd/link: ensure cgo cflags do not leak into tvOS test
Carlos Amedee [Wed, 22 Jan 2020 20:30:52 +0000 (15:30 -0500)]
cmd/link: ensure cgo cflags do not leak into tvOS test

Running the 'TestBuildForTvOS' test with CGO_CFLAGS set
with certain values would cause the test to fail. all.bash
would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10'
because the --macosx-version-min flag is incompatible with tvOS.
The change guards against using an unintended flag in the unit test.

Updates #35459

Change-Id: Ifc43f3ebfb23d37aabeaac2ea9efae5b877991bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/215957
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: document how Parse handles two-digit years
Kirill Tatchihin [Thu, 23 Jan 2020 16:14:40 +0000 (16:14 +0000)]
time: document how Parse handles two-digit years

Fixes #36549

Change-Id: Ia803330fc046d5807bbefd67acb419cb81640a13
GitHub-Last-Rev: bd354319083bf80c250e1915f2be6860d2f7d14b
GitHub-Pull-Request: golang/go#36584
Reviewed-on: https://go-review.googlesource.com/c/go/+/214980
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/go: add a control case to the mod_vendor_trimpath test
Bryan C. Mills [Thu, 23 Jan 2020 17:51:26 +0000 (12:51 -0500)]
cmd/go: add a control case to the mod_vendor_trimpath test

In reviewing CL 215940, it took me a while to find the control
condition for the test, which was located in build_cache_trimpath.txt.

We could consolidate the two tests, but since they check for
regressions of separate issues (with separate root-causes), I think it
makes sense to keep them separate.

However, I would like the control condition to be present in the same
source file, so that we'll be more likely to update both cases if the
behavior of one of them is changed.

Updates #36566

Change-Id: Ic588f1dfb7977dd78d1d5ef61b9841e22bad82e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/216018
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: make Script/test_regexps less flaky under load
Daniel Martí [Tue, 21 Jan 2020 10:21:17 +0000 (10:21 +0000)]
cmd/go: make Script/test_regexps less flaky under load

With the command below, I was able to reproduce failures within the
first 50 or so runs:

go test -c -o test && stress -p 32 ./test -test.run Script/test_regexp

When printing the full failure output, we'd see:

BenchmarkX
    BenchmarkX: x_test.go:13: LOG: X running N=1
BenchmarkX/Y
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=100
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=10000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=100000000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y          1000000000          0.000050 ns/op
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=30
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1207
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=120700
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=12070000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y          1000000000          0.000715 ns/op

In other words, the N values aren't required to be exact. It seems like
they are cut short if the machine is under stress. That's the exact
scenario we reproduce above, since I used -p=32 on my laptop with only 4
real CPU cores.

First, don't require each line to be present. Instead, use patterns
that span multiple lines, so that we can just match the first and last
N= lines.

Second, don't require the last N= lines to be exact; simply require
them to have a reasonably large number of digits.

Fixes #36664.

Change-Id: I7a9818f1a07099fa6482a26da2ac5cbea0f8ab30
Reviewed-on: https://go-review.googlesource.com/c/go/+/215578
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: unify trimpath logic for -mod=vendor, -mod=mod
Jay Conrod [Wed, 22 Jan 2020 23:46:11 +0000 (15:46 -0800)]
cmd/go: unify trimpath logic for -mod=vendor, -mod=mod

If a package has a module with a version, the package's directory is
replaced with the module path and version, followed by the package's
path within the module.

This is a follow up to CL 214945. We no longer check whether the
module has a directory (with -mod=vendor, it does not).

Updates #36566

Change-Id: I5bc952b13bc7b4659f58ee555bd6c6a087eb7792
Reviewed-on: https://go-review.googlesource.com/c/go/+/215940
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: add missing code for linux/riscv64
Joel Sing [Wed, 22 Jan 2020 16:42:07 +0000 (03:42 +1100)]
runtime: add missing code for linux/riscv64

Makes linux/riscv64 runtime buildable.

Updates #27532

Change-Id: I91bcadaaecb8ff3ffd70fcb437b2b6e4bbe11eda
Reviewed-on: https://go-review.googlesource.com/c/go/+/215839
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym
Joel Sing [Wed, 22 Jan 2020 16:31:49 +0000 (03:31 +1100)]
cmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym

While this instruction is not needed for the relocation (the lower immediate
can be patched directly into the JALR instruction), other code currently
depends on the jump sequence being 12 bytes (or three instructions) long.
Put the ADDI instruction back until these can be found and fixed.

Updates #27532

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

5 years agocmd/internal/obj/riscv: add missing instructions to the ternary expansion list
Joel Sing [Wed, 22 Jan 2020 16:33:54 +0000 (03:33 +1100)]
cmd/internal/obj/riscv: add missing instructions to the ternary expansion list

Updates #27532

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

5 years agocmd/dist: print error if GOROOT is inside a module
Jay Conrod [Wed, 22 Jan 2020 23:30:03 +0000 (15:30 -0800)]
cmd/dist: print error if GOROOT is inside a module

Fixes #36701

Change-Id: I22738235e7a7ee06bc5d748213aab523aad8cf12
Reviewed-on: https://go-review.googlesource.com/c/go/+/215939
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Marwan Sulaiman <marwan.sameer@gmail.com>
5 years agoRevert "net/http: support gzip, x-gzip Transfer-Encodings"
Filippo Valsorda [Wed, 22 Jan 2020 01:06:37 +0000 (01:06 +0000)]
Revert "net/http: support gzip, x-gzip Transfer-Encodings"

This reverts commit e6c12c3d0296251f1d5a96ebde811dbfd4a914fe.

Reason for revert: the assumption that a T-E of "gzip" implies
"chunked" seems incorrect. The RFC does state that one "MUST apply
chunked as the final transfer coding" but that should be interpreted to
mean that a "chunked" encoding must be listed as the last one, not that
one should be assumed to be there if not. This is confirmed by the
alternative option to chunking on the server side being to "terminate
the message by closing the connection".

The issue seems confirmed by the fact that the code in the body of
#29162 fails with the following error:

    net/http: HTTP/1.x transport connection broken: http: failed to gunzip body: unexpected EOF

This late in the cycle, revert rather than fix, also because we don't
apparently have tests for the correct behavior.

Change-Id: I920ec928754cd8e96a06fb7ff8a53316c0f959e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215757
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agoruntime: document special memmove requirements
Austin Clements [Mon, 6 Jan 2020 16:10:26 +0000 (11:10 -0500)]
runtime: document special memmove requirements

Unlike C's memmove, Go's memmove must be careful to do indivisible
writes of pointer values because it may be racing with the garbage
collector reading the heap.

We've had various bugs related to this over the years (#36101, #13160,
 #12552). Indeed, memmove is a great target for optimization and it's
easy to forget the special requirements of Go's memmove.

The CL documents these (currently unwritten!) requirements. We're also
adding a test that should hopefully keep everyone honest going
forward, though it's hard to be sure we're hitting all cases of
memmove.

Change-Id: I2f59f8d8d6fb42d2f10006b55d605b5efd8ddc24
Reviewed-on: https://go-review.googlesource.com/c/go/+/213418
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: don't skip checkTimers if we would clear deleted timers
Ian Lance Taylor [Wed, 22 Jan 2020 00:50:56 +0000 (16:50 -0800)]
runtime: don't skip checkTimers if we would clear deleted timers

The timers code used to have a problem: if code started and stopped a
lot of timers, as would happen with, for example, lots of calls to
context.WithTimeout, then it would steadily use memory holding timers
that had stopped but not been removed from the timer heap.
That problem was fixed by CL 214299, which would remove all deleted
timers whenever they got to be more than 1/4 of the total number of
timers on the heap.

The timers code had a different problem: if there were some idle P's,
the running P's would have lock contention trying to steal their timers.
That problem was fixed by CL 214185, which only acquired the timer lock
if the next timer was ready to run or there were some timers to adjust.

Unfortunately, CL 214185 partially undid 214299, in that we could now
accumulate an increasing number of deleted timers while there were no
timers ready to run. This CL restores the 214299 behavior, by checking
whether there are lots of deleted timers without acquiring the lock.

This is a performance issue to consider for the 1.14 release.

Change-Id: I13c980efdcc2a46eb84882750c39e3f7c5b2e7c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/215722
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/dist: mark cgo as disabled on linux/riscv64
Joel Sing [Wed, 22 Jan 2020 16:46:00 +0000 (03:46 +1100)]
cmd/dist: mark cgo as disabled on linux/riscv64

cgo is not currently supported on this platform.

Updates #27532 and #36641

Change-Id: I4b35f887e869ebc5c156dd754b1c79897a8c5800
Reviewed-on: https://go-review.googlesource.com/c/go/+/215838
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/dist: detect gohostarch on riscv64 hosts
Joel Sing [Wed, 22 Jan 2020 16:30:14 +0000 (03:30 +1100)]
cmd/dist: detect gohostarch on riscv64 hosts

Updates #27532

Change-Id: I66c194499bb7b831b569c66d0736fa7205eedd80
Reviewed-on: https://go-review.googlesource.com/c/go/+/215837
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/internal/obj/riscv: implement prologue and epilogue
Joel Sing [Sun, 3 Nov 2019 17:32:32 +0000 (04:32 +1100)]
cmd/internal/obj/riscv: implement prologue and epilogue

Based on riscv-go port.

Updates #27532

Change-Id: If552225552bf8d27c29b08de31146dd34986a3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/204630
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go: add -d flag to mod_get_test
Jay Conrod [Tue, 21 Jan 2020 22:50:36 +0000 (14:50 -0800)]
cmd/go: add -d flag to mod_get_test

'go get all' was run in this test without -d. This caused some std
packages to be reinstalled if the test is run in a slightly different
configuration than make.bash was run. run.bash would fail in some
situations because of this. Nothing in the cmd/go tests should modify
installed std or cmd packages.

Updates #35459

Change-Id: Idd259a27d55502923b7fc54f361a77f0ac11eea2
Reviewed-on: https://go-review.googlesource.com/c/go/+/215721
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/internal/obj/riscv: populate DWARF register mapping for riscv64
Joel Sing [Sat, 18 Jan 2020 15:19:06 +0000 (02:19 +1100)]
cmd/internal/obj/riscv: populate DWARF register mapping for riscv64

Updates #27532

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

5 years agocmd/internal/obj/riscv: correctly split immediates for FLW/FLD/FSW/FSD
Joel Sing [Thu, 16 Jan 2020 15:51:40 +0000 (02:51 +1100)]
cmd/internal/obj/riscv: correctly split immediates for FLW/FLD/FSW/FSD

The FLW/FLD/FSW/FSD instructions can have immediates that exceed 12-bits and
therefore cannot be encoded in the RISCV instruction. Handle these as we do
for other load/store instructions. Also add test coverage for all load/store
instructions with large immediates.

Fixes compilation issue reported by Carlos Eduardo de Paula.

Updates #27532

Change-Id: Ifa62f19493b3acaba5a90ac31d2df209a3afea81
Reviewed-on: https://go-review.googlesource.com/c/go/+/215037
Reviewed-by: Carlos Eduardo de Paula <me@carlosedp.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http/httputil: add docs about X-Forwarded-For in ReverseProxy
Kévin Dunglas [Tue, 21 Jan 2020 21:48:41 +0000 (21:48 +0000)]
net/http/httputil: add docs about X-Forwarded-For in ReverseProxy

ReverseProxy automatically sets the X-Forwarded-For header, if the request
already contains a X-Forwarded-For header, the value of the client IP is
appended to the existing header value.
This behavior isn't documented anywhere, and can lead to IP spoofing
security issues is the client is untrusted (the most common situation).
This PR documents this behavior.

For future versions, I proposed #36678 that implements a more secure
default behavior and adds support for other forwarded headers.

Change-Id: Ief14f5063caebfccb87714f54cffa927c714e5fd
GitHub-Last-Rev: fd0bd29a181861ffdb1106b42f59f9489999ccb3
GitHub-Pull-Request: golang/go#36672
Reviewed-on: https://go-review.googlesource.com/c/go/+/215617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: fix wrong offset when calling ppc64x nanotime syscall
Carlos Eduardo Seo [Fri, 17 Jan 2020 20:59:59 +0000 (17:59 -0300)]
runtime: fix wrong offset when calling ppc64x nanotime syscall

There is a wrong offset when getting the results of a clock_gettime
syscall. Although the syscall will never be called in native ppc64x,
QEMU doesn't implement VDSO, so it will return wrong values.

Fixes #36592

Change-Id: Icf838075228dcdd62cf2c1279aa983e5993d66ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/215397
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agotest: disable test for #36516 when cgo is not enabled
Tobias Klauser [Sun, 19 Jan 2020 19:05:15 +0000 (20:05 +0100)]
test: disable test for #36516 when cgo is not enabled

CL 214679 added a -race test which shouldn't be run when cgo is not
enabled.

Fixes the nocgo builder.

Change-Id: Iceddf802c4ef6c0de2c3a968e86342303d2d27d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/215477
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoreflect: correct riscv64 assembly
Joel Sing [Sun, 19 Jan 2020 15:00:44 +0000 (02:00 +1100)]
reflect: correct riscv64 assembly

R0 is not a thing in riscv64 assembly - use ZERO (rather than X0) since
the rest of this currently uses ABI names.

Updates #27532

Change-Id: I28fb68e9f80d05231a07c5921e7062777234e2c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: add support for linux/riscv64
Joel Sing [Sun, 3 Nov 2019 17:58:37 +0000 (04:58 +1100)]
runtime: add support for linux/riscv64

Based on riscv-go port.

Updates #27532

Change-Id: If522807a382130be3c8d40f4b4c1131d1de7c9e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/204632
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agonet: document *OpError.Err must not be nil
Yasser Abdolmaleki [Fri, 26 Jul 2019 03:44:06 +0000 (20:44 -0700)]
net: document *OpError.Err must not be nil

The point of *net.OpError is to add details to an underlying lower
level error. It makes no sense to have an OpError without an Err and
a nil *OpError.Err will cause *OpError.Error() method to panic.

Fixes #33007

Change-Id: If4fb2501e02dad110a095b73e18c47312ffa6015
Reviewed-on: https://go-review.googlesource.com/c/go/+/187677
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/compile: implement compiler for riscv64
Joel Sing [Sun, 3 Nov 2019 17:40:47 +0000 (04:40 +1100)]
cmd/compile: implement compiler for riscv64

Based on riscv-go port.

Updates #27532

Change-Id: Ia329daa243db63ff334053b8807ea96b97ce3acf
Reviewed-on: https://go-review.googlesource.com/c/go/+/204631
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoreflect: add support for riscv64
Joel Sing [Sun, 3 Nov 2019 18:09:14 +0000 (05:09 +1100)]
reflect: add support for riscv64

Based on riscv-go port.

Update #27532

Change-Id: I791924f71078fd8dfe9c2fc03a3f21a3bc673721
Reviewed-on: https://go-review.googlesource.com/c/go/+/204634
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agotesting: clarify that Cleanup is run after subtests complete.
Roger Peppe [Fri, 17 Jan 2020 09:06:13 +0000 (09:06 +0000)]
testing: clarify that Cleanup is run after subtests complete.

It's good to be explicit, as it's not necessarily obvious (and indeed
the behavior has changed recently with https://go-review.googlesource.com/c/go/+/214822)
without an associated doc comment change).

Change-Id: I99d6398bf15b404b1b1b196e712e926e363251e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/215217
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: change the "bogus line" to be 1
David Chase [Fri, 17 Jan 2020 17:03:55 +0000 (12:03 -0500)]
cmd/compile: change the "bogus line" to be 1

The previous value was "too bogus" and caused objdump to crash.
Updated infinite loop test results (only run if -args -f) in ssa/debug_test.go
Probably also fixes #36621 but that bug needs more info to tell for certain.

Fixes #36570

Change-Id: I51144641d25d559308a98d726d87806bd340cc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/215297
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: mark ... argument to checkptrArithmetic as not escaping
Keith Randall [Tue, 14 Jan 2020 17:50:43 +0000 (09:50 -0800)]
cmd/compile: mark ... argument to checkptrArithmetic as not escaping

Fixes #36516

Change-Id: Ibf4f86fb3a25fa30e0cd54e2dd2e12c60ee75ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/214679
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/go: trim paths from vendored packages with -trimpath
Jay Conrod [Wed, 15 Jan 2020 21:29:46 +0000 (16:29 -0500)]
cmd/go: trim paths from vendored packages with -trimpath

In CL 199821, we stopped setting the module directory for vendored
packages when -mod=vendor is used. This broke -trimpath, since we
replace the module directory with a string derived from the module
path and version. A comment in CL 202977 makes it clear that the
module directory should not be set.

With this change, -trimpath falls back to replacing the package
directory with the package path if the module directory is not set. We
also fall back to replacing the package directory if the module
version is not set to avoid adding a meaningless @ only for the main
module.

As a consequence of this change, file names in vendored packages will
not have module versions, so file names will be a little different
between -mod=mod and -mod=vendor.

Fixes #36566

Change-Id: I0e9cd76d36a2028a49d0b6697ea9a9b3140d7ff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/214945
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agotesting: don't run Cleanup functions until parallel subtests complete
Ian Lance Taylor [Tue, 14 Jan 2020 23:28:47 +0000 (15:28 -0800)]
testing: don't run Cleanup functions until parallel subtests complete

Fixes #31651

Change-Id: Idbab0c4355fcc58520e210126795223435cf0078
Reviewed-on: https://go-review.googlesource.com/c/go/+/214822
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: ignore power notification error seen on Windows Docker
Ian Lance Taylor [Wed, 15 Jan 2020 14:38:16 +0000 (06:38 -0800)]
runtime: ignore power notification error seen on Windows Docker

Fixes #36557

Change-Id: Ia8125f382d5e14e5612da811268a58971cc9ac08
Reviewed-on: https://go-review.googlesource.com/c/go/+/214917
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/compile: use a sync.Pool and string interning when printing types
Josh Bleecher Snyder [Tue, 14 Jan 2020 13:08:47 +0000 (05:08 -0800)]
cmd/compile: use a sync.Pool and string interning when printing types

CL 214239 improved type printing, but introduced performance regressions:
3-5% memory increase, 1-2% CPU time increase.

There were two primary sources of the memory regression:

* allocating a bytes.Buffer for every type to print
* always printing to that buffer, even when we could return a constant string

This change addresses both of those regressions.
The sync.Pool allows buffer re-use.
String interning prevents allocation for re-used strings.

It addresses some, but not all, of the CPU time regression.

Memory performance impact vs master:

name        old alloc/op      new alloc/op      delta
Template         37.6MB ± 0%       36.3MB ± 0%  -3.30%  (p=0.008 n=5+5)
Unicode          28.7MB ± 0%       28.3MB ± 0%  -1.55%  (p=0.008 n=5+5)
GoTypes           127MB ± 0%        122MB ± 0%  -4.38%  (p=0.008 n=5+5)
Compiler          584MB ± 0%        568MB ± 0%  -2.72%  (p=0.008 n=5+5)
SSA              1.99GB ± 0%       1.95GB ± 0%  -1.97%  (p=0.008 n=5+5)
Flate            23.5MB ± 0%       22.8MB ± 0%  -2.84%  (p=0.008 n=5+5)
GoParser         29.2MB ± 0%       28.0MB ± 0%  -4.17%  (p=0.008 n=5+5)
Reflect          81.9MB ± 0%       78.6MB ± 0%  -4.09%  (p=0.008 n=5+5)
Tar              35.3MB ± 0%       34.1MB ± 0%  -3.29%  (p=0.008 n=5+5)
XML              45.5MB ± 0%       44.3MB ± 0%  -2.61%  (p=0.008 n=5+5)
[Geo mean]       82.4MB            79.9MB       -3.09%

name        old allocs/op     new allocs/op     delta
Template           394k ± 0%         363k ± 0%  -7.73%  (p=0.008 n=5+5)
Unicode            340k ± 0%         329k ± 0%  -3.25%  (p=0.008 n=5+5)
GoTypes           1.41M ± 0%        1.28M ± 0%  -9.54%  (p=0.008 n=5+5)
Compiler          5.77M ± 0%        5.39M ± 0%  -6.58%  (p=0.008 n=5+5)
SSA               19.1M ± 0%        18.1M ± 0%  -5.13%  (p=0.008 n=5+5)
Flate              247k ± 0%         228k ± 0%  -7.50%  (p=0.008 n=5+5)
GoParser           325k ± 0%         295k ± 0%  -9.24%  (p=0.008 n=5+5)
Reflect           1.04M ± 0%        0.95M ± 0%  -8.48%  (p=0.008 n=5+5)
Tar                365k ± 0%         336k ± 0%  -7.93%  (p=0.008 n=5+5)
XML                449k ± 0%         417k ± 0%  -7.10%  (p=0.008 n=5+5)
[Geo mean]         882k              818k       -7.26%

Memory performance going from 52c4488471ed52085a29e173226b3cbd2bf22b20,
which is the commit preceding CL 214239, to this change:

name        old alloc/op      new alloc/op      delta
Template         36.5MB ± 0%       36.3MB ± 0%  -0.37%  (p=0.008 n=5+5)
Unicode          28.3MB ± 0%       28.3MB ± 0%  -0.06%  (p=0.008 n=5+5)
GoTypes           123MB ± 0%        122MB ± 0%  -0.64%  (p=0.008 n=5+5)
Compiler          571MB ± 0%        568MB ± 0%  -0.51%  (p=0.008 n=5+5)
SSA              1.96GB ± 0%       1.95GB ± 0%  -0.13%  (p=0.008 n=5+5)
Flate            22.8MB ± 0%       22.8MB ± 0%    ~     (p=0.421 n=5+5)
GoParser         28.1MB ± 0%       28.0MB ± 0%  -0.37%  (p=0.008 n=5+5)
Reflect          78.8MB ± 0%       78.6MB ± 0%  -0.32%  (p=0.008 n=5+5)
Tar              34.3MB ± 0%       34.1MB ± 0%  -0.35%  (p=0.008 n=5+5)
XML              44.3MB ± 0%       44.3MB ± 0%  +0.05%  (p=0.032 n=5+5)
[Geo mean]       80.1MB            79.9MB       -0.27%

name        old allocs/op     new allocs/op     delta
Template           372k ± 0%         363k ± 0%  -2.46%  (p=0.008 n=5+5)
Unicode            333k ± 0%         329k ± 0%  -0.97%  (p=0.008 n=5+5)
GoTypes           1.33M ± 0%        1.28M ± 0%  -3.71%  (p=0.008 n=5+5)
Compiler          5.53M ± 0%        5.39M ± 0%  -2.50%  (p=0.008 n=5+5)
SSA               18.3M ± 0%        18.1M ± 0%  -1.22%  (p=0.008 n=5+5)
Flate              234k ± 0%         228k ± 0%  -2.44%  (p=0.008 n=5+5)
GoParser           305k ± 0%         295k ± 0%  -3.23%  (p=0.008 n=5+5)
Reflect            980k ± 0%         949k ± 0%  -3.12%  (p=0.008 n=5+5)
Tar                345k ± 0%         336k ± 0%  -2.69%  (p=0.008 n=5+5)
XML                425k ± 0%         417k ± 0%  -1.72%  (p=0.008 n=5+5)
[Geo mean]         838k              818k       -2.41%

Remaining CPU time regression, that is,
the change from before CL 214239 to this change:

name        old time/op       new time/op       delta
Template          208ms ± 2%        209ms ± 1%    ~     (p=0.181 n=47+46)
Unicode          82.9ms ± 2%       81.9ms ± 2%  -1.25%  (p=0.000 n=50+48)
GoTypes           709ms ± 3%        714ms ± 3%  +0.77%  (p=0.003 n=48+49)
Compiler          3.31s ± 2%        3.32s ± 2%    ~     (p=0.271 n=48+48)
SSA               10.8s ± 1%        10.9s ± 1%  +0.61%  (p=0.000 n=46+47)
Flate             134ms ± 2%        134ms ± 1%  +0.41%  (p=0.002 n=48+46)
GoParser          166ms ± 2%        167ms ± 2%  +0.41%  (p=0.010 n=46+48)
Reflect           440ms ± 4%        444ms ± 4%  +1.05%  (p=0.002 n=50+49)
Tar               183ms ± 2%        184ms ± 2%    ~     (p=0.074 n=45+45)
XML               247ms ± 2%        248ms ± 2%  +0.67%  (p=0.001 n=49+48)
[Geo mean]        425ms             427ms       +0.34%

name        old user-time/op  new user-time/op  delta
Template          271ms ± 2%        271ms ± 2%    ~     (p=0.654 n=48+48)
Unicode           117ms ± 2%        116ms ± 3%    ~     (p=0.458 n=47+45)
GoTypes           952ms ± 3%        963ms ± 2%  +1.11%  (p=0.000 n=48+49)
Compiler          4.50s ± 5%        4.49s ± 7%    ~     (p=0.894 n=50+50)
SSA               15.0s ± 2%        15.1s ± 2%  +0.46%  (p=0.015 n=50+49)
Flate             166ms ± 2%        167ms ± 2%  +0.40%  (p=0.005 n=49+48)
GoParser          202ms ± 2%        203ms ± 2%  +0.60%  (p=0.002 n=49+47)
Reflect           583ms ± 3%        588ms ± 3%  +0.82%  (p=0.001 n=49+46)
Tar               223ms ± 2%        224ms ± 2%  +0.37%  (p=0.046 n=48+46)
XML               310ms ± 2%        311ms ± 2%  +0.46%  (p=0.009 n=50+49)
[Geo mean]        554ms             556ms       +0.36%

Change-Id: I85951a6538373ef4309a2cc366cc1ebaf1f4582d
Reviewed-on: https://go-review.googlesource.com/c/go/+/214818
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocrypto/tls: stop a timeout timer
Brad Fitzpatrick [Wed, 15 Jan 2020 19:29:33 +0000 (19:29 +0000)]
crypto/tls: stop a timeout timer

I noticed this leak while writing CL 214977.

Change-Id: I7566952b8e4bc58939d23435aea86576fc58ddca
Reviewed-on: https://go-review.googlesource.com/c/go/+/214978
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomath, math/big: add support for riscv64
Joel Sing [Sun, 3 Nov 2019 18:06:56 +0000 (05:06 +1100)]
math, math/big: add support for riscv64

Based on riscv-go port.

Updates #27532

Change-Id: Id8ae7d851c393ec3702e4176c363accb0a42587f
Reviewed-on: https://go-review.googlesource.com/c/go/+/204633
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: re-enable TestArenaCollision on darwin in race mode
Tobias Klauser [Thu, 9 Jan 2020 09:57:46 +0000 (10:57 +0100)]
runtime: re-enable TestArenaCollision on darwin in race mode

Go 1.14 will drop support for macOS 10.10, see #23011

This reverts CL 155097

Updates #26475
Updates #29340

Change-Id: I64d0275141407313b73068436ee81d13eacc4c76
Reviewed-on: https://go-review.googlesource.com/c/go/+/214058
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agospec: add missing space in EBNF
yah01 [Wed, 15 Jan 2020 01:34:43 +0000 (01:34 +0000)]
spec: add missing space in EBNF

Fixes #36520

Change-Id: I698ab235f82f7c81caa09318c954847cf3833153
GitHub-Last-Rev: 368a1dc7889c2370fba272bcb45d94822b60d7b9
GitHub-Pull-Request: golang/go#36559
Reviewed-on: https://go-review.googlesource.com/c/go/+/214821
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agostrings: update Join parameter name for clarity
Thomas Symborski [Mon, 23 Dec 2019 23:55:43 +0000 (23:55 +0000)]
strings: update Join parameter name for clarity

Change-Id: I83f806e76ef4d268b187bd273d78ceb41b7e8fa5
GitHub-Last-Rev: ee82eaae64536cecb631df328aafe2541f71d3f2
GitHub-Pull-Request: golang/go#36194
Reviewed-on: https://go-review.googlesource.com/c/go/+/211799
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc: fix up some HTML issues in go_spec.html
Rob Pike [Mon, 13 Jan 2020 05:03:12 +0000 (16:03 +1100)]
doc: fix up some HTML issues in go_spec.html

The HTML linter 'tidy' reports:

go_spec.html:2556: Warning: unescaped & which should be written as &amp;
go_spec.html:3293: Warning: unescaped & or unknown entity "&s1"
go_spec.html:3293: Warning: unescaped & or unknown entity "&a"
go_spec.html:3294: Warning: unescaped & or unknown entity "&s2"
go_spec.html:3294: Warning: unescaped & or unknown entity "&a"
go_spec.html:2045: Warning: trimming empty <p>
go_spec.html:4526: Warning: trimming empty <ul>
go_spec.html:4533: Warning: trimming empty <ul>
go_spec.html:4539: Warning: trimming empty <ul>

This CL fixes all but the <ul> ones, which I think should be fixed
but are defended by a comment.

Change-Id: I0ca88f5e80755024801877ab1298025ecf8f10c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/214457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agoruntime: keep P's first timer when in new atomically accessed field
Ian Lance Taylor [Mon, 13 Jan 2020 20:17:26 +0000 (12:17 -0800)]
runtime: keep P's first timer when in new atomically accessed field

This reduces lock contention when only a few P's are running and
checking for whether they need to run timers on the sleeping P's.
Without this change the running P's would get lock contention
while looking at the sleeping P's timers. With this change a single
atomic load suffices to determine whether there are any ready timers.

Change-Id: Ie843782bd56df49867a01ecf19c47498ec827452
Reviewed-on: https://go-review.googlesource.com/c/go/+/214185
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
5 years agoruntime: better approximate total cost of scavenging
Michael Anthony Knyszek [Mon, 13 Jan 2020 17:18:51 +0000 (17:18 +0000)]
runtime: better approximate total cost of scavenging

Currently, the scavenger is paced according to how long it takes to
scavenge one runtime page's worth of memory. However, this pacing
doesn't take into account the additional cost of actually using a
scavenged page. This operation, "sysUsed," is a counterpart to the
scavenging operation "sysUnused." On most systems this operation is a
no-op, but on some systems like Darwin and Windows we actually make a
syscall. Even on systems where it's a no-op, the cost is implicit: a
more expensive page fault when re-using the page.

On Darwin in particular the cost of "sysUnused" is fairly close to the
cost of "sysUsed", which skews the pacing to be too fast. A lot of
soon-to-be-allocated memory ends up scavenged, resulting in many more
expensive "sysUsed" operations, ultimately slowing down the application.

The way to fix this problem is to include the future cost of "sysUsed"
on a page in the scavenging cost. However, measuring the "sysUsed" cost
directly (like we do with "sysUnused") on most systems is infeasible
because we would have to measure the cost of the first access.

Instead, this change applies a multiplicative constant to the measured
scavenging time which is based on a per-system ratio of "sysUnused" to
"sysUsed" costs in the worst case (on systems where it's a no-op, we
measure the cost of the first access). This ultimately slows down the
scavenger to a more reasonable pace, limiting its impact on performance
but still retaining the memory footprint improvements from the previous
release.

Fixes #36507.

Change-Id: I050659cd8cdfa5a32f5cc0b56622716ea0fa5407
Reviewed-on: https://go-review.googlesource.com/c/go/+/214517
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoC: add missing name
Koya IWAMURA [Tue, 14 Jan 2020 06:57:49 +0000 (15:57 +0900)]
C: add missing name

Even though I contributed to golang/go[^1], the rule[^2] did not reflect my name in CONTRIBUTORS, so I added it.

[^1]: https://go-review.googlesource.com/c/go/+/164199
[^2]: https://github.com/golang/build/blob/e21a90b/cmd/updatecontrib/updatecontrib.go#L118

Change-Id: I5d6b5684d61ea5da679519a9e703d977470de175
Reviewed-on: https://go-review.googlesource.com/c/go/+/214617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoRevert "os: handle long path in RemoveAll for windows"
Ian Lance Taylor [Mon, 13 Jan 2020 23:34:53 +0000 (23:34 +0000)]
Revert "os: handle long path in RemoveAll for windows"

This reverts CL 214437.

Does not fix the issue, and the test was wrong so it did not detect that it did not fix the issue.

Updates #36375

Change-Id: I6a4112035a1e90f4fdafed6fdf4ec9dfc718b571
Reviewed-on: https://go-review.googlesource.com/c/go/+/214601
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: add a sentence about distant times to time.Time.Unix
Rob Pike [Thu, 9 Jan 2020 05:22:31 +0000 (16:22 +1100)]
time: add a sentence about distant times to time.Time.Unix

Since Durations only span 290 years, they are not good for
manipulating very remote times. I bounced off this problem recently
while doing some astronomical calculations and it took me a while to
realize I could get a 64-bit seconds value from time.Time.Unix and
subtract two of them to evaluate the interval.

I thought it worth adding a sentence to make this clear. It didn't
occur to me for quite a while that "Unix time" spans a huge range in
the Go library.

Change-Id: I76c75dc951dfd6bcf86e8b0be3cfec518a3ecdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/213977
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
5 years agospec: uniformly format empty interfaces as "interface{}"
Robert Griesemer [Mon, 13 Jan 2020 21:01:28 +0000 (13:01 -0800)]
spec: uniformly format empty interfaces as "interface{}"

Fixes #36526.

Change-Id: Ic51a287579f139422cc1a7b2fb82d6732114b031
Reviewed-on: https://go-review.googlesource.com/c/go/+/214597
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos: handle long path in RemoveAll for windows
Constantin Konstantinidis [Sat, 11 Jan 2020 18:53:20 +0000 (19:53 +0100)]
os: handle long path in RemoveAll for windows

Fixes #36375

Change-Id: I407a1db23868880b83e73bc136d274659483fb69
Reviewed-on: https://go-review.googlesource.com/c/go/+/214437
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/compile: print recursive types correctly
Keith Randall [Thu, 9 Jan 2020 22:58:18 +0000 (14:58 -0800)]
cmd/compile: print recursive types correctly

Change the type printer to take a map of types that we're currently
printing. When we happen upon a type that we're already in the middle
of printing, print a reference to it instead.

A reference to another type is built using the offset of the first
byte of that type's string representation in the result. To facilitate
that computation (and it's probably more efficient, regardless), we
print the type to a buffer as we go, and build the string at the end.

It would be nice to use string.Builder instead of bytes.Buffer, but
string.Builder wasn't around in Go 1.4, and we'd like to bootstrap
from that version.

Fixes #29312

Change-Id: I49d788c1fa20f770df7b2bae3b9979d990d54803
Reviewed-on: https://go-review.googlesource.com/c/go/+/214239
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agohtml: update URL in comment
fujimoto kyosuke [Sun, 12 Jan 2020 06:49:19 +0000 (06:49 +0000)]
html: update URL in comment

The comment contained a link that had a file name and ID that no longer existed, so change to the URL of the corresponding part of the latest page.

Change-Id: I74e0885aabf470facc39b84035f7a83fef9c6a8e
GitHub-Last-Rev: 5681c84d9f1029449da6860c65a1d9a128296e85
GitHub-Pull-Request: golang/go#36514
Reviewed-on: https://go-review.googlesource.com/c/go/+/214181
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 agoruntime: don't let P's timer heap get clogged with deleted timers
Ian Lance Taylor [Fri, 10 Jan 2020 07:03:25 +0000 (23:03 -0800)]
runtime: don't let P's timer heap get clogged with deleted timers

Whenever more than 1/4 of the timers on a P's heap are deleted,
remove them from the heap.

Change-Id: Iff63ed3d04e6f33ffc5c834f77f645c52c007e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/214299
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agocmd/go/internal/modload: fix an erroneous comment about the test repo
Bryan C. Mills [Fri, 10 Jan 2020 14:37:32 +0000 (09:37 -0500)]
cmd/go/internal/modload: fix an erroneous comment about the test repo

Updates #36489

Change-Id: I1ca215ba0a64a31d662134385b8be46bb4ba4434
Reviewed-on: https://go-review.googlesource.com/c/go/+/214282
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: add tests for checkptr
Matthew Dempsky [Thu, 9 Jan 2020 23:26:01 +0000 (15:26 -0800)]
runtime: add tests for checkptr

We had a few test cases to make sure checkptr didn't have certain
false positives, but none to test for any true positives. This CL
fixes that.

Updates #22218.

Change-Id: I24c02e469a4af43b1748829a9df325ce510f7cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/214238
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/compile: emit only '/' in DWARF file names
Jeremy Faller [Fri, 10 Jan 2020 16:36:44 +0000 (11:36 -0500)]
cmd/compile: emit only '/' in DWARF file names

Make file names consistent, using only forward slashes in the path.

Fixes #36495

Change-Id: I337119d6dff233ab9d4bfe757147ec25961ae021
Reviewed-on: https://go-review.googlesource.com/c/go/+/214286
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd: update golang.org/x/mod to v0.2.0 (latest)
Jay Conrod [Fri, 10 Jan 2020 18:05:54 +0000 (13:05 -0500)]
cmd: update golang.org/x/mod to v0.2.0 (latest)

This pulls in two new commits: a fix for a test broken on plan9 and a
correction to a comment.

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

5 years agoruntime: don't skip timer when adjustTimers sees a modified timer
Ian Lance Taylor [Fri, 10 Jan 2020 18:10:32 +0000 (10:10 -0800)]
runtime: don't skip timer when adjustTimers sees a modified timer

When adjustTimers sees a timerModifiedEarlier or timerModifiedLater,
it removes it from the heap, leaving a new timer at that position
in the heap. We were accidentally skipping that new timer in our loop.
In some unlikely cases this could cause adjustTimers to look at more
timers than necessary.

Change-Id: Ic71e54c175ab7d86a7fa46f1497aca71ed1c43cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/214338
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agosrc/go.mod: update x/crypto to drop broken poly1305 arm assembly
Filippo Valsorda [Thu, 9 Jan 2020 15:23:25 +0000 (10:23 -0500)]
src/go.mod: update x/crypto to drop broken poly1305 arm assembly

This imports CL 213880.

Fixes #35511

Change-Id: I55d18713bdac8fa556ba5a2aced922f80d1ac970
Reviewed-on: https://go-review.googlesource.com/c/go/+/214078
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocrypto/x509: this change modifies C.CopyPEMRoots to static function
bxq2011hust [Fri, 10 Jan 2020 07:03:21 +0000 (07:03 +0000)]
crypto/x509: this change modifies C.CopyPEMRoots to static function

Change-Id: Ic7997d1f747152afec78e8e439770166029f34ec
GitHub-Last-Rev: 6a07f25056c960dc8684cd6eac22cd3405a936c8
GitHub-Pull-Request: golang/go#36491
Reviewed-on: https://go-review.googlesource.com/c/go/+/214298
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 agomisc/cgo/test: re-enable darwin cgo tests in race mode
Tobias Klauser [Thu, 9 Jan 2020 09:48:14 +0000 (10:48 +0100)]
misc/cgo/test: re-enable darwin cgo tests in race mode

Go 1.14 will drop support for macOS 10.10, see #23011

This reverts CL 125304

Updates #26475
Updates #26513

Change-Id: Ia13eef30f22d67103f7ae45424124fbb116e1261
Reviewed-on: https://go-review.googlesource.com/c/go/+/214057
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>