]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 years agocmd/internal/obj/x86: unexport movtab
artemkaxboy [Fri, 23 Nov 2018 05:52:53 +0000 (12:52 +0700)]
cmd/internal/obj/x86: unexport movtab

Change-Id: Ia071f6914b3c155a88103f930af00028986ec8c7
Reviewed-on: https://go-review.googlesource.com/c/151019
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/compile: add an optimaztion rule for math/bits.ReverseBytes16 on arm64
erifan01 [Mon, 11 Feb 2019 06:37:49 +0000 (06:37 +0000)]
cmd/compile: add an optimaztion rule for math/bits.ReverseBytes16 on arm64

On amd64 ReverseBytes16 is lowered to a rotate instruction. However arm64 doesn't
have 16-bit rotate instruction, but has a REV16W instruction which can be used
for ReverseBytes16. This CL adds a rule to turn the patterns like (x<<8) | (x>>8)
(the type of x is uint16, and "|" can also be "^" or "+") to a REV16W instruction.

Code:
func reverseBytes16(i uint16) uint16 { return bits.ReverseBytes16(i) }

Before:
        0x0004 00004 (test.go:6)        MOVHU   "".i(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:262)        UBFX    $8, R0, $8, R1
        0x000c 00012 ($GOROOT/src/math/bits/bits.go:262)        ORR     R0<<8, R1, R0
        0x0010 00016 (test.go:6)        MOVH    R0, "".~r1+8(FP)
        0x0014 00020 (test.go:6)        RET     (R30)

After:
        0x0000 00000 (test.go:6)        MOVHU   "".i(FP), R0
        0x0004 00004 (test.go:6)        REV16W  R0, R0
        0x0008 00008 (test.go:6)        MOVH    R0, "".~r1+8(FP)
        0x000c 00012 (test.go:6)        RET     (R30)

Benchmarks:
name                old time/op       new time/op       delta
ReverseBytes-224    1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)
ReverseBytes16-224  1.500000ns +- 0%  1.000000ns +- 0%  -33.33%  (p=0.000 n=9+10)
ReverseBytes32-224  1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)
ReverseBytes64-224  1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)

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

6 years agocmd/compile: make KeepAlive work on stack object
Cherry Zhang [Thu, 28 Feb 2019 01:43:29 +0000 (20:43 -0500)]
cmd/compile: make KeepAlive work on stack object

Currently, runtime.KeepAlive applied on a stack object doesn't
actually keeps the stack object alive, and the heap object
referenced from it could be collected. This is because the
address of the stack object is rematerializeable, and we just
ignored KeepAlive on rematerializeable values. This CL fixes it.

Fixes #30476.

Change-Id: Ic1f75ee54ed94ea79bd46a8ddcd9e81d01556d1d
Reviewed-on: https://go-review.googlesource.com/c/164537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agobytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial
Ketan Parmar [Fri, 8 Feb 2019 06:28:23 +0000 (11:58 +0530)]
bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial

Change-Id: If700a150492181f68e23e90ef829ff9eaf7ca7b5
Reviewed-on: https://go-review.googlesource.com/c/161737
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agopath/filepath: do not call GetFinalPathNameByHandle from EvalSymlinks
Alex Brainman [Thu, 28 Feb 2019 09:20:40 +0000 (20:20 +1100)]
path/filepath: do not call GetFinalPathNameByHandle from EvalSymlinks

EvalSymlinks is using GetFinalPathNameByHandle to handle symlinks with
unusual targets like \??\Volume{ABCD}\. But since CL 164201, os.Readlink
handles path like that too.

So remove all that extra code that EvalSymlinks calls when os.Readlink
fails - it is not needed any more.

Now that windows EvalSymlinks implementation is similar to unix
implementation, we can remove all slashAfterFilePathError related code
too. So do that.

This also makes TestIssue29372 pass even when TMP directory refers to
symlinks with target like \??\Volume{ABCD}\. So remove TestIssue29372
code that helped it pass on windows-arm. TestIssue29372 should pass as
is now.

Fixes #29746

Change-Id: I568d142c89d3297bff8513069bceaa6be51fe7e4
Reviewed-on: https://go-review.googlesource.com/c/164202
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 agoos: make Readlink work with symlinks with target like \??\Volume{ABCD}\
Alex Brainman [Thu, 28 Feb 2019 09:21:32 +0000 (20:21 +1100)]
os: make Readlink work with symlinks with target like \??\Volume{ABCD}\

windows-arm TMP directory live inside such link (see
https://github.com/golang/go/issues/29746#issuecomment-456526811 for
details), so symlinks like that will be common at least on windows-arm.

This CL builds on current syscall.Readlink implementation. Main
difference between the two is how new code handles symlink targets,
like \??\Volume{ABCD}\.

New implementation uses Windows CreateFile API with
FILE_FLAG_OPEN_REPARSE_POINT flag to get \??\Volume{ABCD}\ file handle.
And then it uses Windows GetFinalPathNameByHandle with VOLUME_NAME_DOS
flag to convert that handle into standard Windows path.
FILE_FLAG_OPEN_REPARSE_POINT flag ensures that symlink is not followed
when CreateFile opens the file.

Fixes #30463

Change-Id: I33b18227ce36144caed694169ef2e429fd995fb4
Reviewed-on: https://go-review.googlesource.com/c/164201
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 agocmd/dist, cmd/link: allow passing default dynamic linker/loader
Tobias Klauser [Mon, 25 Feb 2019 10:32:00 +0000 (11:32 +0100)]
cmd/dist, cmd/link: allow passing default dynamic linker/loader

Add an environment variable to make.bash to allow setting the default
dynamic linker/loader. This fixes alpine builds to use
/lib/ld-musl-x86_64.so.1:

  $ readelf -l ../bin/go | grep 'interpreter:' | sed -e 's/^.*interpreter: \(.*\)[]]/\1/'
  /lib/ld-musl-x86_64.so.1

Also re-enable the internal linker tests that were previously disabled
for alpine (CL 41759, CL 41678).

Fixes #18243
Updates #19938

This resurrects CL 50070 authored by Jessie Frazelle.

Change-Id: I132b5282045a3d60c8568e3b002a7f075eac2d93
Reviewed-on: https://go-review.googlesource.com/c/163977
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 agomisc/android: adb push --sync testdata
Elias Naur [Thu, 28 Feb 2019 07:40:55 +0000 (08:40 +0100)]
misc/android: adb push --sync testdata

(A stripped down version of) $GOROOT is uploaded to the device
before running standar library tests, including many (all?)
testdata directories.

Use the --sync flag when pushing testdata directories to the device
in case it is already present.

Change-Id: If8104f9d15838c1be3623adcf831a7188303c376
Reviewed-on: https://go-review.googlesource.com/c/164338
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodebug/elf: perform stricter section header table checks in NewFile
Tobias Klauser [Thu, 14 Feb 2019 22:42:24 +0000 (23:42 +0100)]
debug/elf: perform stricter section header table checks in NewFile

If an ELF file has no section header table (shoff = 0), shnum must be
zero as well according to elf(5).

So far, when only shnum was zero but shoff was non-zero (i.e. in an
invalid ELF file) shstrndx wasn't properly checked and could result in
an 'index out of range' later on.

Fixes #10996

Change-Id: Ic248d2d77099b0036458e2a844b086a5f463c844
Reviewed-on: https://go-review.googlesource.com/c/162857
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 agomisc/android: evaluate symlinks before comparing GOROOT and GOPATH
Elias Naur [Fri, 1 Mar 2019 00:03:20 +0000 (01:03 +0100)]
misc/android: evaluate symlinks before comparing GOROOT and GOPATH

Should fix Android builders on Darwin hosts.

Change-Id: I1554849bdf2ad2440529af7f93566fa6f11d5407
Reviewed-on: https://go-review.googlesource.com/c/164697
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoRevert "cmd/compile: rewrite f(g()) for multi-value g() during typecheck"
Matthew Dempsky [Fri, 1 Mar 2019 05:49:48 +0000 (05:49 +0000)]
Revert "cmd/compile: rewrite f(g()) for multi-value g() during typecheck"

This reverts commit d96b7fbf98bfac4861cda1b5c17a002ce8d62aa5.

Reason for revert: broke noopt and longtest builders.

Change-Id: Ifaec64d817c4336cb255a2e9db00526b7bc5606a
Reviewed-on: https://go-review.googlesource.com/c/164757
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go/internal/cache: disable builds if GOCACHE is not an absolute path
Baokun Lee [Thu, 28 Feb 2019 08:40:11 +0000 (16:40 +0800)]
cmd/go/internal/cache: disable builds if GOCACHE is not an absolute path

If GOCACHE is set but is not an absolute path, we cannot build.
And GOCACHE=off also returns the error message "build cache is
disabled by GOCACHE=off".

Fixes #30447

Change-Id: I24f64bc886599ca0acd757acada4714aebe4d3ae
Reviewed-on: https://go-review.googlesource.com/c/164200
Run-TryBot: Baokun Lee <nototon@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/link: remove unused flag -D (FlagDataAddr)
Alex Tokarev [Fri, 23 Nov 2018 06:45:51 +0000 (13:45 +0700)]
cmd/link: remove unused flag -D (FlagDataAddr)

FlagDataAddr is a vestige from git commit 0cafb9e (2008;
no Gerrit CL number).

It was never used but unfortunately setting it would
cause a spurious warning:

  warning: -D<value> is ignored because of -R0x1000

yet if -R was unset e.g. -R=0, the linker would crash
with a divide by zero runtime panic.

Fixes #28921

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

6 years agomisc/ios: evaluate symlinks before comparing GOROOT and GOPATH
Elias Naur [Fri, 1 Mar 2019 00:15:24 +0000 (01:15 +0100)]
misc/ios: evaluate symlinks before comparing GOROOT and GOPATH

CL 163726 added workarounds to keep the iOS builders happy in
a symlinked temporary dir.

The workarounds also made the tests more realistic and improved
performance. Keep them but also handle symlinks better in the
exec wrapper.

Change-Id: Iaa2c03a1a3fb3aa5aaf62d79d52b63d5d8f11db5
Reviewed-on: https://go-review.googlesource.com/c/164698
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/compile: rewrite f(g()) for multi-value g() during typecheck
Matthew Dempsky [Wed, 12 Dec 2018 19:15:37 +0000 (11:15 -0800)]
cmd/compile: rewrite f(g()) for multi-value g() during typecheck

This CL moves order.go's copyRet logic for rewriting f(g()) into t1,
t2, ... = g(); f(t1, t2, ...) earlier into typecheck. This allows the
rest of the compiler to stop worrying about multi-value functions
appearing outside of OAS2FUNC nodes.

This changes compiler behavior in a few observable ways:

1. Typechecking error messages for builtin functions now use general
case error messages rather than unnecessarily differing ones.

2. Because f(g()) is rewritten before inlining, saved inline bodies
now see the rewritten form too. This could be addressed, but doesn't
seem worthwhile.

3. Most notably, this simplifies escape analysis and fixes a memory
corruption issue in esc.go. See #29197 for details.

Fixes #15992.
Fixes #29197.

Change-Id: I86a70668301efeec8fbd11fe2d242e359a3ad0af
Reviewed-on: https://go-review.googlesource.com/c/153841
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agofmtsort: sort interfaces deterministically
lukechampine [Thu, 28 Feb 2019 19:03:18 +0000 (19:03 +0000)]
fmtsort: sort interfaces deterministically

Previously, the result of sorting a map[interface{}] containing
multiple concrete types was non-deterministic. To ensure consistent
results, sort first by type name, then by concrete value.

Fixes #30398

Change-Id: I10fd4b6a74eefbc87136853af6b2e689bc76ae9d
GitHub-Last-Rev: 1b07f0c275716e1b2834f74f9c67f897bae82882
GitHub-Pull-Request: golang/go#30406
Reviewed-on: https://go-review.googlesource.com/c/163745
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: fix false positives in isGoConst
Matthew Dempsky [Thu, 28 Feb 2019 01:12:23 +0000 (17:12 -0800)]
cmd/compile: fix false positives in isGoConst

isGoConst could spuriously return true for variables that shadow a
constant declaration with the same name.

Because even named constants are always represented by OLITERAL nodes,
the easy fix is to just ignore ONAME nodes in isGoConst. We can
similarly ignore ONONAME nodes.

Confirmed that k8s.io/kubernetes/test/e2e/storage builds again with
this fix.

Fixes #30430.

Change-Id: I899400d749982d341dc248a7cd5a18277c2795ec
Reviewed-on: https://go-review.googlesource.com/c/164319
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoimage/png: delete unused statement
cia-rana [Wed, 27 Feb 2019 16:04:58 +0000 (01:04 +0900)]
image/png: delete unused statement

Change-Id: I91378d5d5ecc1fc6741127a3924c631904da736b
Reviewed-on: https://go-review.googlesource.com/c/164199
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agofmt: fix %d and other non-string verbs on errors
Damien Neil [Thu, 28 Feb 2019 17:10:36 +0000 (09:10 -0800)]
fmt: fix %d and other non-string verbs on errors

When formatting an error with a non-string formatting verb such as %d,
use the default formatting behavior rather than treating this as a bad
verb.

For example, this should print 42, not %!d(main.E=42):

  var E int
  func (E) Error() string { return "error" }
  fmt.Printf("%d", E(42))

Fixes #30472

Change-Id: I62fd309c8ee9839a69052b0ec7f1808449dcee8e
Reviewed-on: https://go-review.googlesource.com/c/164557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: simplify zero ext operations on wasm
Richard Musiol [Thu, 28 Feb 2019 14:20:59 +0000 (15:20 +0100)]
cmd/compile: simplify zero ext operations on wasm

On wasm every integer is stored with 64 bits. We can do zero
extension by simply zeroing the upper bits.

Change-Id: I02c54a38b3b2b7654fff96055edab1b92d48ff32
Reviewed-on: https://go-review.googlesource.com/c/164461
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agointernal/cpu: change s390x API to match x/sys/cpu
Michael Munday [Thu, 28 Feb 2019 09:40:51 +0000 (04:40 -0500)]
internal/cpu: change s390x API to match x/sys/cpu

This CL changes the internal/cpu API to more closely match the
public version in x/sys/cpu (added in CL 163003). This will make it
easier to update the dependencies of vendored code. The most prominent
renaming is from VE1 to VXE for the vector-enhancements facility 1.
VXE is the mnemonic used for this facility in the HWCAP vector.

Change-Id: I922d6c8bb287900a4bd7af70567e22eac567b5c1
Reviewed-on: https://go-review.googlesource.com/c/164437
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd: update vendored golang.org/x/sys/unix
Benny Siegert [Thu, 28 Feb 2019 12:58:11 +0000 (13:58 +0100)]
cmd: update vendored golang.org/x/sys/unix

This pulls in CL 164497.

Fixes #24771

Change-Id: I88f2062e2c42363591dcb9e592a7a8381268ddeb
Reviewed-on: https://go-review.googlesource.com/c/164460
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agosyscall: use 64-bit alignment on netbsd-arm
Benny Siegert [Thu, 28 Feb 2019 10:54:22 +0000 (11:54 +0100)]
syscall: use 64-bit alignment on netbsd-arm

netbsd-arm needs the same override to the alignment function as
openbsd-arm. This fixes the TestPassFD failure.

Update golang/go#24771

Change-Id: Ib124fc776f6e2e3b3932784365c2bd3944523a52
Reviewed-on: https://go-review.googlesource.com/c/164458
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: delay parsing the testmain template
Daniel Martí [Sun, 30 Dec 2018 18:03:02 +0000 (19:03 +0100)]
cmd/go: delay parsing the testmain template

The template is over a hundred lines and full of pipelines, and
text/template isn't optimised to parse quickly, so it's no wonder that
delaying the parsing to the first template use makes 'go env' much
faster.

Like in the previous patches to get rid of global regexp.MustCompile
vars, use the newly introduced lazytemplate package. Close to two full
milliseconds are shaved off of 'go env' runs.

name         old time/op    new time/op    delta
ExecGoEnv-8    4.27ms ± 0%    2.63ms ± 1%  -38.43%  (p=0.002 n=6+6)

Updates #29382.

Change-Id: I4e2569e51ddf2afe1b46eb1a9e9e5845f7a3b0bd
Reviewed-on: https://go-review.googlesource.com/c/155962
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agotime: move the explanation of u/micro to the ParseDuration example
Rob Pike [Wed, 27 Feb 2019 03:01:55 +0000 (14:01 +1100)]
time: move the explanation of u/micro to the ParseDuration example

Fix a few missing capitalizations in drive-by.

Change-Id: I7353c12f3ccddefc0f26a98590caf9e446129558
Reviewed-on: https://go-review.googlesource.com/c/163918
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agointernal/lazytemplate: add a lazy template wrapper
Daniel Martí [Wed, 27 Feb 2019 22:02:51 +0000 (22:02 +0000)]
internal/lazytemplate: add a lazy template wrapper

Similar to internal/lazyregexp, this will allow removing unnecessary
work from init functions with trivial refactors, thanks to sync.Once.

Copy the structure. The only major difference is that a template also
carries a name.

For #29382.

Change-Id: I65d096dc2e2072b310bf59a814cd62669856b5b5
Reviewed-on: https://go-review.googlesource.com/c/164337
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoarchive/tar, syscall: add statUnix for aix/ppc64
Clément Chigot [Thu, 21 Feb 2019 10:27:41 +0000 (11:27 +0100)]
archive/tar, syscall: add statUnix for aix/ppc64

This commit add statUnix function for aix/ppc64. It also adds Unix
and Nano methods for AIX time structure.

Change-Id: I9fd62d34a47e87cd46f2f936cb736da0bdff7959
Reviewed-on: https://go-review.googlesource.com/c/163957
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/link: set correct sizes for XCOFF outer symbols
Clément Chigot [Wed, 20 Feb 2019 14:54:11 +0000 (15:54 +0100)]
cmd/link: set correct sizes for XCOFF outer symbols

This commit fixes the size of outer symbols like type.*.
Outer symbols cannot have a nil size on AIX or they will be
removed by ld as long as all their sub-symbols.

Change-Id: I68ff3ce5a3a034e3c3eb23431aba31245073cf20
Reviewed-on: https://go-review.googlesource.com/c/163999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/link: improve XCOFF symbol table
Clément Chigot [Wed, 20 Feb 2019 14:48:22 +0000 (15:48 +0100)]
cmd/link: improve XCOFF symbol table

This commit improves symbol table for XCOFF format.
It adds symbol alignment, TLS symbols and move the whole symbol table at
the end of the FILE. As relocations in the future external linking will
need symbols' index, we cannot write the symbol table when it's
generated.

Change-Id: I5dcae85b95e538b65f1a128faf56d4e2aa15baf1
Reviewed-on: https://go-review.googlesource.com/c/163998
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc/go1.12: new go line in go.mod can break builds with Go 1.11 - 1.11.3
Ian Lance Taylor [Wed, 27 Feb 2019 22:13:55 +0000 (14:13 -0800)]
doc/go1.12: new go line in go.mod can break builds with Go 1.11 - 1.11.3

Fixes #30446

Change-Id: If069f72fa9735f839df92f3ede3bf7b6d7a695a5
Reviewed-on: https://go-review.googlesource.com/c/164317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoregexp: add ReplaceAllStringFunc example
Valentin Vidic [Wed, 27 Feb 2019 20:20:58 +0000 (20:20 +0000)]
regexp: add ReplaceAllStringFunc example

Change-Id: I016312f3ecf3dfcbf0eaf24e31b6842d80abb029
GitHub-Last-Rev: 360047c9006dba643429c006f89d813d927999b3
GitHub-Pull-Request: golang/go#30445
Reviewed-on: https://go-review.googlesource.com/c/164257
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/link: fix -a with external linker
Clément Chigot [Wed, 23 Jan 2019 08:01:37 +0000 (09:01 +0100)]
cmd/link: fix -a with external linker

This commit fixes a panic when -a was used with external linkmode.

Fixes #29807

Change-Id: I8cd42775f2953cec620cbc9ab345421c2694c9a2
Reviewed-on: https://go-review.googlesource.com/c/158998
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocrypto/x509: remove the redundant type declaration
ZZMarquis [Wed, 27 Feb 2019 19:26:13 +0000 (19:26 +0000)]
crypto/x509: remove the redundant type declaration

Change-Id: I50668a4c943ecab91b2b33370f6cfb3784afafd1
GitHub-Last-Rev: c8223adfc8b7d3fc712089bb9cb03d6832ab558b
GitHub-Pull-Request: golang/go#29654
Reviewed-on: https://go-review.googlesource.com/c/157338
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 years agocmd/go: avoid compiling most regexes at init
Daniel Martí [Sun, 30 Dec 2018 17:46:22 +0000 (18:46 +0100)]
cmd/go: avoid compiling most regexes at init

These regexes are all related to commands like get and build, so they're
unnecessary for simpler commands like env. In particular, we need env to
be fast, since libraries like go/packages call it early and often. Some
external Go tools are interactive, so milliseconds matter.

lazyregexp eagerly compiles the patterns when running from within a test
binary, so there's no longer any need to do that as part of non-test
binaries.

Picking up the low-hanging fruit spotted by 'perf record' shaves off
well over a full millisecond off the benchmark on my laptop:

name         old time/op    new time/op    delta
ExecGoEnv-8    4.92ms ± 1%    3.81ms ± 0%  -22.52%  (p=0.004 n=6+5)

This CL required adding a few more methods to the lazy regexp wrapper.

Updates #29382.

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

6 years agocrypto/x509: improve error when PKCS1, PKCS8, EC keys are mixed up
Arash Bina [Thu, 7 Feb 2019 02:41:55 +0000 (21:41 -0500)]
crypto/x509: improve error when PKCS1, PKCS8, EC keys are mixed up

Improve error messages if ParsePKCS8PrivateKey/ParseECPrivateKey
/ParsePKCS1PrivateKey or ParsePKIXPublicKey/ParsePKCS1PublicKey
are called erroneously instead of one another.

Fixes #30094

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

6 years agofmt: add frame info to Errorf and support %w
Marcel van Lohuizen [Fri, 22 Feb 2019 23:29:15 +0000 (00:29 +0100)]
fmt: add frame info to Errorf and support %w

Partly implements proposal Issue #29934.

Change-Id: Ibcf12f383158dcfbc313ab29c417a710571d1acb
Reviewed-on: https://go-review.googlesource.com/c/163559
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
6 years agoerrors: add Unwrap, Is, and As
Marcel van Lohuizen [Fri, 22 Feb 2019 23:09:40 +0000 (00:09 +0100)]
errors: add Unwrap, Is, and As

Unwrap, Is and As are as defined in proposal
Issue #29934.

Also add Opaque for enforcing an error cannot
be unwrapped.

Change-Id: I4f3feaa42e3ee7477b588164ac622ba4d5e77cad
Reviewed-on: https://go-review.googlesource.com/c/163558
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
6 years agoerrors: add Frame and Formatter/Printer interfaces
Marcel van Lohuizen [Fri, 22 Feb 2019 22:41:38 +0000 (23:41 +0100)]
errors: add Frame and Formatter/Printer interfaces

errors.New now implements Formatter and includes Frame
information that is reported when detail is requested.

Partly implements proposal Issue #29934.

Change-Id: Id76888d246d7d862595b5e92d517b9c03f23a7a6
Reviewed-on: https://go-review.googlesource.com/c/163557
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
6 years agomath/big: better initial guess for nat.sqrt
Juraj Sukop [Wed, 27 Feb 2019 17:43:46 +0000 (17:43 +0000)]
math/big: better initial guess for nat.sqrt

The proposed change introduces a better initial guess which is closer to the final value and therefore converges in fewer steps. Consider for example sqrt(8): previously the guess was 8, whereas now it is 4 (and the result is 2). All this change does is it computes the division by two more accurately while it keeps the guess ≥ √x.

Change-Id: I917248d734a7b0488d14a647a063f674e56c4e30
GitHub-Last-Rev: c06d9d4876c8e7d6739f0e4b687e370fe1e9aad7
GitHub-Pull-Request: golang/go#28981
Reviewed-on: https://go-review.googlesource.com/c/163866
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agointernal/reflectlite: lite version of reflect package
Marcel van Lohuizen [Fri, 8 Feb 2019 16:48:17 +0000 (17:48 +0100)]
internal/reflectlite: lite version of reflect package

to be used by errors package for checking assignability
and setting error values in As.

Updates #29934.

Change-Id: I8c1d02a2c6efa0919d54b286cfe8b4edc26da059
Reviewed-on: https://go-review.googlesource.com/c/161759
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agoencoding/json: remove use of DeepEqual for testing errors
Marcel van Lohuizen [Fri, 8 Feb 2019 16:52:08 +0000 (17:52 +0100)]
encoding/json: remove use of DeepEqual for testing errors

Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: Ib430c9ddbe588dd1dd51314c408c74c07285e1ff
Reviewed-on: https://go-review.googlesource.com/c/162179
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
6 years agonet/http: remove use of DeepEqual for testing errors
Marcel van Lohuizen [Fri, 8 Feb 2019 16:50:36 +0000 (17:50 +0100)]
net/http: remove use of DeepEqual for testing errors

Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: I4ef076e262109a9d6f5b18846129df2535611d71
Reviewed-on: https://go-review.googlesource.com/c/162178
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agostrconv: remove use of DeepEqual for testing errors
Marcel van Lohuizen [Fri, 8 Feb 2019 16:50:07 +0000 (17:50 +0100)]
strconv: remove use of DeepEqual for testing errors

Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: I0372883288f974998138f95f6c7c79a60f922a3e
Reviewed-on: https://go-review.googlesource.com/c/162177
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
6 years agocmd/dist: execute cgo_stdio and cgo_life as host tests
Bryan C. Mills [Wed, 27 Feb 2019 18:02:04 +0000 (13:02 -0500)]
cmd/dist: execute cgo_stdio and cgo_life as host tests

Now that these tests are written in Go, they must be run in host mode
in order to be able to exec `go run` as a subprocess.

Updates #30228

Change-Id: Ibedf86a8e18ae1b6f583c1bbdcb99d19c8e01744
Reviewed-on: https://go-review.googlesource.com/c/164137
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agotime: reject tzdata with no zones
Josh Bleecher Snyder [Fri, 28 Dec 2018 00:23:29 +0000 (14:23 -1000)]
time: reject tzdata with no zones

Fixes #29437

Change-Id: Ice0a03a543e564d66651bfdfce5cd32ebaa35926
Reviewed-on: https://go-review.googlesource.com/c/155746
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: add types.SoleComponent, use in convFuncName
Josh Bleecher Snyder [Wed, 7 Nov 2018 00:27:58 +0000 (16:27 -0800)]
cmd/compile: add types.SoleComponent, use in convFuncName

The specialized conversion functions care only
about a type's layout in memory, so e.g.
[1]string is equivalent to string.

Add types.SoleComponent to assist with such use cases,
and use it for the specialized conversion functions.

Increases the number of convTstring calls by ~1%.

Change-Id: I09a392909f2037387b30642781e65f707a048af5
Reviewed-on: https://go-review.googlesource.com/c/148577
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: speed up ifaceeq for direct ifaces
Josh Bleecher Snyder [Sun, 2 Dec 2018 18:15:35 +0000 (10:15 -0800)]
runtime: speed up ifaceeq for direct ifaces

name                    old time/op  new time/op  delta
EfaceCmpDiff-8           421ns ± 3%   299ns ± 3%  -28.93%  (p=0.000 n=92+94)
EfaceCmpDiffIndirect-8   497ns ± 4%   496ns ± 3%     ~     (p=0.840 n=98+92)

Change-Id: Id1a8c779413ba35ab0f58d055870b6a0714b51b7
Reviewed-on: https://go-review.googlesource.com/c/152163
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/dist: fix variable name
Elias Naur [Wed, 27 Feb 2019 17:53:14 +0000 (18:53 +0100)]
cmd/dist: fix variable name

Noticed by Bryan after CL 163618 went in.

Change-Id: Ia33c80dca60321f6a8329097ff55118e5d2634ab
Reviewed-on: https://go-review.googlesource.com/c/164042
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomisc: add go.mod file
Bryan C. Mills [Thu, 21 Feb 2019 20:39:34 +0000 (15:39 -0500)]
misc: add go.mod file

Updates #30228
Updates #30241

Change-Id: I7ee839f4d2840873f7e37b3aff93fe534c6b52e6
Reviewed-on: https://go-review.googlesource.com/c/163207
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/link: do not close over the loop variable in testDWARF
Bryan C. Mills [Wed, 27 Feb 2019 17:25:59 +0000 (12:25 -0500)]
cmd/link: do not close over the loop variable in testDWARF

Fixes #30429
Updates #16520
Updates #20733

Change-Id: Iae41f06c09aaaed500936f5496d90cefbe8293e4
Reviewed-on: https://go-review.googlesource.com/c/164119
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/dist: execute misc/cgo/testso{,var} as regular tests, not host tests
Bryan C. Mills [Wed, 27 Feb 2019 17:14:59 +0000 (12:14 -0500)]
cmd/dist: execute misc/cgo/testso{,var} as regular tests, not host tests

These tests use runtime.GOOS and runtime.GOARCH to determine whether
to run, so must be built and run using the destination's — not the
host's — GOOS and GOARCH.

Updates #30228

Change-Id: I6774dacd01c68b395fca8ca61f70d5879270af8a
Reviewed-on: https://go-review.googlesource.com/c/164117
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agomisc/cgo/test: skip TestCrossPackageTests on Android
Bryan C. Mills [Wed, 27 Feb 2019 15:46:18 +0000 (10:46 -0500)]
misc/cgo/test: skip TestCrossPackageTests on Android

This test currently fails in the Android builders, with the message
pkg_test.go:64: go test -short: exec: "go": executable file not found in $PATH
(https://build.golang.org/log/39ec0da5bfb7793359e199cc8e358ca5a8257840)

I was not able to test this change, because I can't get 'gomote
create' to return an instance of anything Android. However, I will
watch the build dashboard after submitting to verify that the fix
works.

Updates #30228

Android appears to lack a 'go' command in the.

Change-Id: Ieacac7f50d19e2cfef2f5d60e79a159e55b5cfa8
Reviewed-on: https://go-review.googlesource.com/c/164097
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
6 years agocmd/go: expand tests for standard-library vendoring in GOPATH mode
Bryan C. Mills [Wed, 20 Feb 2019 18:52:23 +0000 (13:52 -0500)]
cmd/go: expand tests for standard-library vendoring in GOPATH mode

This should help to catch any regressions in the course of implementing #26924.

Updates #26924

Change-Id: Ide28a9aa0235867e0ce72f855fbed51c50e2c2f2
Reviewed-on: https://go-review.googlesource.com/c/163520
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agodoc: add 1.10.8 and 1.11.5 to the releases list
Alberto Donizetti [Wed, 27 Feb 2019 16:25:28 +0000 (17:25 +0100)]
doc: add 1.10.8 and 1.11.5 to the releases list

Fixes #30431

Change-Id: I379e78a1c385942a19e1a10b91d732f9a73899e6
Reviewed-on: https://go-review.googlesource.com/c/164041
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: add benchmark that execs 'go env GOARCH'
Daniel Martí [Sun, 30 Dec 2018 17:43:13 +0000 (18:43 +0100)]
cmd/go: add benchmark that execs 'go env GOARCH'

'go env' is used for many quick operations, such as in go/packages to
query GOARCH and GOMOD. It often is a bottleneck; for example,
go/packages doesn't know whether or not to use Go modules until it has
queried GOMOD.

As such, this go command should be fast. Right now it's slower than it
should be. This commit adds a simple benchmark with os/exec, since we're
particularly interested in the cost of cmd/go's large init function.

Updates #29382.

Change-Id: Ifee6fb9997b9b89565fbfc2739a00c86117b1d37
Reviewed-on: https://go-review.googlesource.com/c/155961
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/compile: optimize math/bits Len32 intrinsic on arm64
erifan01 [Wed, 2 Jan 2019 09:14:26 +0000 (09:14 +0000)]
cmd/compile: optimize math/bits Len32 intrinsic on arm64

Arm64 has a 32-bit CLZ instruction CLZW, which can be used for intrinsic Len32.
Function LeadingZeros32 calls Len32, with this change, the assembly code of
LeadingZeros32 becomes more concise.

Go code:

func f32(x uint32) { z = bits.LeadingZeros32(x) }

Before:

"".f32 STEXT size=32 args=0x8 locals=0x0 leaf
        0x0000 00000 (test.go:7)        TEXT    "".f32(SB), LEAF|NOFRAME|ABIInternal, $0-8
        0x0004 00004 (test.go:7)        MOVWU   "".x(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:30) CLZ     R0, R0
        0x000c 00012 ($GOROOT/src/math/bits/bits.go:30) SUB     $32, R0, R0
        0x0010 00016 (test.go:7)        MOVD    R0, "".z(SB)
        0x001c 00028 (test.go:7)        RET     (R30)

After:

"".f32 STEXT size=32 args=0x8 locals=0x0 leaf
        0x0000 00000 (test.go:7)        TEXT    "".f32(SB), LEAF|NOFRAME|ABIInternal, $0-8
        0x0004 00004 (test.go:7)        MOVWU   "".x(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:30) CLZW    R0, R0
        0x000c 00012 (test.go:7)        MOVD    R0, "".z(SB)
        0x0018 00024 (test.go:7)        RET     (R30)

Benchmarks:
name              old time/op  new time/op  delta
LeadingZeros-8    2.53ns ± 0%  2.55ns ± 0%   +0.67%  (p=0.000 n=10+10)
LeadingZeros8-8   3.56ns ± 0%  3.56ns ± 0%     ~     (all equal)
LeadingZeros16-8  3.55ns ± 0%  3.56ns ± 0%     ~     (p=0.465 n=10+10)
LeadingZeros32-8  3.55ns ± 0%  2.96ns ± 0%  -16.71%  (p=0.000 n=10+7)
LeadingZeros64-8  2.53ns ± 0%  2.54ns ± 0%     ~     (p=0.059 n=8+10)

Change-Id: Ie5666bb82909e341060e02ffd4e86c0e5d67e90a
Reviewed-on: https://go-review.googlesource.com/c/157000
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agointernal/lazyregexp: add a lazy Regexp package
Daniel Martí [Wed, 27 Feb 2019 12:09:22 +0000 (13:09 +0100)]
internal/lazyregexp: add a lazy Regexp package

This was implemented as part of go/doc, but it's going to be useful in
other packages. In particular, many packages under cmd/go like web and
vcs make somewhat heavy use of global regexes, which add a non-trivial
amount of init work to the cmd/go program.

A lazy wrapper around regexp.Regexp will make it trivial to get rid of
the extra cost with a trivial refactor, so make it possible for other
packages in the repository to make use of it. While naming the package,
give the members better names, such as lazyregexp.New and
lazyregexp.Regexp.

We're also considering adding some form of a lazy API to the public
regexp package, so this internal package will allow us to get some
initial experience across std and cmd.

For #29382.

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

6 years agocmd/go: fix -Wl,--whole-archive for aix/ppc64
Clément Chigot [Wed, 27 Feb 2019 12:49:17 +0000 (13:49 +0100)]
cmd/go: fix -Wl,--whole-archive for aix/ppc64

--whole-archive doesn't exist on AIX. It was already removed most of
the time but was still added with c-archive or c-shared buildmodes.

Change-Id: Ia7360638509d4a4d91674b0281ed4b112508a2c9
Reviewed-on: https://go-review.googlesource.com/c/164037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoRevert "net: add missing error check in test"
Mikio Hara [Wed, 27 Feb 2019 11:56:43 +0000 (20:56 +0900)]
Revert "net: add missing error check in test"

This reverts commit ec521467e33eee0a62ed426ca0c66b865baedfc7.

Reson for revert: The test cases using slowDst4 and slowDst6 are
fragile. We need to find out a better approach to the trick on the IP
routeability.

Change-Id: I544453886e809d1c7b339673d8f1d5bdef357147
Reviewed-on: https://go-review.googlesource.com/c/163919
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agosyscall/js: add a note about a bug in TypedArray
Agniva De Sarker [Wed, 26 Dec 2018 06:39:49 +0000 (12:09 +0530)]
syscall/js: add a note about a bug in TypedArray

Fixes #29355

Change-Id: I4018d420c8d413b2681744af18ffb65da03ac504
Reviewed-on: https://go-review.googlesource.com/c/155778
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
6 years agomath/cmplx: avoid panic in Pow(x, NaN())
Bryan C. Mills [Tue, 5 Feb 2019 15:22:32 +0000 (10:22 -0500)]
math/cmplx: avoid panic in Pow(x, NaN())

Fixes #30088

Change-Id: I08cec17feddc86bd08532e6b135807e3c8f4c1b2
Reviewed-on: https://go-review.googlesource.com/c/161197
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agosyscall: add missing Setrlimit and Termios on aix/ppc64
Clément Chigot [Thu, 21 Feb 2019 10:17:12 +0000 (11:17 +0100)]
syscall: add missing Setrlimit and Termios on aix/ppc64

This commits adds a missing syscall and a missing structure in syscall
package.

Change-Id: I9d630454c56337267f7bbb023e601246e14fc929
Reviewed-on: https://go-review.googlesource.com/c/163978
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: suppress typecheck errors in a type switch case with broken type
Gergely Brautigam [Fri, 18 Jan 2019 20:43:56 +0000 (21:43 +0100)]
cmd/compile: suppress typecheck errors in a type switch case with broken type

If a type switch case expression has failed typechecking, the case body is
likely to also fail with confusing or spurious errors. Suppress
typechecking the case body when this happens.

Fixes #28926

Change-Id: Idfdb9d5627994f2fd90154af1659e9a92bf692c4
Reviewed-on: https://go-review.googlesource.com/c/158617
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agodebug/pe: prevent slice out of bounds access in (*File).ImportedSymbols
Tobias Klauser [Fri, 15 Feb 2019 13:59:36 +0000 (14:59 +0100)]
debug/pe: prevent slice out of bounds access in (*File).ImportedSymbols

Fixes #30253

Change-Id: I0c3d67649ea379b67f3575c1219fe05a04f056ae
Reviewed-on: https://go-review.googlesource.com/c/162859
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 agodebug/pe: omit panic in (*File).ImportedSymbols on empty optional headers
Tobias Klauser [Fri, 15 Feb 2019 11:15:11 +0000 (12:15 +0100)]
debug/pe: omit panic in (*File).ImportedSymbols on empty optional headers

If a PE file with invalid optional header size (neither
sizeofOptionalHeader32 nor sizeofOptionalHeader64) is passed to NewFile,
the File.OptionalHeader will be nil which leads to a panic in
(*File).ImportedSymbols().

Fixes #30250

Change-Id: Ie97306de4a0e2dcfdc7b1b599891f574aa63adca
Reviewed-on: https://go-review.googlesource.com/c/162858
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 agocrypto/tls: enable TLS 1.3 by default
Filippo Valsorda [Wed, 20 Feb 2019 18:50:08 +0000 (13:50 -0500)]
crypto/tls: enable TLS 1.3 by default

Updates #30055

Change-Id: I3e79dd7592673c5d76568b0bcded6c391c3be6b3
Reviewed-on: https://go-review.googlesource.com/c/163081
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agoRevert "crypto/tls: disable RSA-PSS in TLS 1.2"
Filippo Valsorda [Wed, 20 Feb 2019 18:40:31 +0000 (13:40 -0500)]
Revert "crypto/tls: disable RSA-PSS in TLS 1.2"

In Go 1.13 we will enable RSA-PSS in TLS 1.2 at the same time as we make
TLS 1.3 enabled by default.

This reverts commit 7ccd3583eddcd79679fb29cfc83a6e6fb6973f1e.

Updates #30055

Change-Id: I6f2ddf7652d1172a6b29f4e335ff3a71a89974bc
Reviewed-on: https://go-review.googlesource.com/c/163080
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agocmd/asm: improve DATA size operand validation
Josh Bleecher Snyder [Sat, 16 Feb 2019 00:28:05 +0000 (16:28 -0800)]
cmd/asm: improve DATA size operand validation

Prior to this change, DATA instructions accepted
the values 1, 2, 4, and 8 as sizes.
The acceptable sizes were further restricted
to 4 and 8 for float constants.

This was both too restrictive and not restrictive enough:
string constants may reasonably have any length,
and address constants should really only accept pointer-length sizes.

Fixes #30269

Change-Id: I06e44ecdf5909eca7b19553861aec1fa39655c2b
Reviewed-on: https://go-review.googlesource.com/c/163747
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/go: preserve more env vars for TestScript child processes
Ian Lance Taylor [Wed, 27 Feb 2019 00:50:31 +0000 (16:50 -0800)]
cmd/go: preserve more env vars for TestScript child processes

These are required when testing gccgo.

Change-Id: I6a81d7f4d48292c32a8b3b15ef44d859ab3aa26e
Reviewed-on: https://go-review.googlesource.com/c/163861
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet: add missing error check in test
Leon Klingele [Wed, 30 Jan 2019 17:38:18 +0000 (17:38 +0000)]
net: add missing error check in test

Change-Id: Id2e57bc8e18e062f60c6ac8a58dc15e049352088
GitHub-Last-Rev: 6d33b809cf8a3b5412333b1c3cc237000be8101d
GitHub-Pull-Request: golang/go#30016
Reviewed-on: https://go-review.googlesource.com/c/160440
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
6 years agonet: use EUI-48/EUI-64 reserved address blocks for documentation
Mikio Hara [Thu, 21 Feb 2019 20:41:20 +0000 (05:41 +0900)]
net: use EUI-48/EUI-64 reserved address blocks for documentation

Updates #15228.

Change-Id: I1b73defccb4c933d71c408aa31d32af9d1bc4ab8
Reviewed-on: https://go-review.googlesource.com/c/163357
Reviewed-by: Matt Layher <mdlayher@gmail.com>
6 years agotime: rewrite ExampleDuration_Nanoseconds to be more idiomatic.
Rob Pike [Wed, 27 Feb 2019 00:41:48 +0000 (11:41 +1100)]
time: rewrite ExampleDuration_Nanoseconds to be more idiomatic.

Fix the punctuation and use the proper units for microseconds,
while explaining the incorrect but common variant 'us'.

Change-Id: I9e96694ef27ab4761efccd8616ac7b6700f60d39
Reviewed-on: https://go-review.googlesource.com/c/163917
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: unify duplicate const detection logic
Matthew Dempsky [Tue, 4 Dec 2018 23:11:03 +0000 (15:11 -0800)]
cmd/compile: unify duplicate const detection logic

Consistent logic for handling both duplicate map keys and case values,
and eliminates ad hoc value hashing code.

Also makes cmd/compile consistent with go/types's handling of
duplicate constants (see #28085), which is at least an improvement
over the status quo even if we settle on something different for the
spec.

As a side effect, this also suppresses cmd/compile's warnings about
duplicate nils in (non-interface expression) switch statements, which
was technically never allowed by the spec anyway.

Updates #28085.
Updates #28378.

Change-Id: I176a251e770c3c5bc11c2bf8d1d862db8f252a17
Reviewed-on: https://go-review.googlesource.com/c/152544
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/compile/internal/ssa: fix bad CL rebase
Matthew Dempsky [Tue, 26 Feb 2019 23:52:59 +0000 (15:52 -0800)]
cmd/compile/internal/ssa: fix bad CL rebase

CL 142497 renamed "statictmp_N" to ".stmp_N", but missed an instance
that was added by CL 151498 (submitted between the window that CL
142497 was reviewed/tested and later rebased/merged).

Change-Id: I597ee59dfa40821c7af2881b47e06f84a8140ec8
Reviewed-on: https://go-review.googlesource.com/c/163877
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomath/big: handle alias of cofactor inputs in GCD
Brian Kessler [Wed, 13 Feb 2019 20:18:17 +0000 (13:18 -0700)]
math/big: handle alias of cofactor inputs in GCD

If the variables passed in to the cofactor arguments of GCD (x, y)
aliased the input arguments (a, b), the previous implementation would
result in incorrect results for y.  This change reorganizes the calculation
so that the only case that need to be handled is when y aliases b, which
can be handled with a simple check.

Tests were added for all of the alias cases for input arguments and and
and irrelevant test case for a previous binary GCD calculation was dropped.

Fixes #30217

Change-Id: Ibe6137f09b3e1ae3c29e3c97aba85b67f33dc169
Reviewed-on: https://go-review.googlesource.com/c/162517
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/ast: break out after first variable in ExampleCommentMap
go101 [Fri, 22 Feb 2019 02:11:55 +0000 (02:11 +0000)]
go/ast: break out after first variable in ExampleCommentMap

The current ExampleCommentMap might panic if there are more satisfied
comments in the parsed program.

Change-Id: Ibe6943470aa0cfb450dae9fc07c1199acaabef73
GitHub-Last-Rev: c79e98c2868179ea47618b296ce28c5eebc0b99d
GitHub-Pull-Request: golang/go#28587
Reviewed-on: https://go-review.googlesource.com/c/147359
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoregexp: limit the capacity of slices of bytes returned by FindX
Francesc Campoy [Mon, 11 Feb 2019 14:33:12 +0000 (16:33 +0200)]
regexp: limit the capacity of slices of bytes returned by FindX

This change limits the capacity of the slices of bytes returned by:

- Find
- FindAll
- FindAllSubmatch

to be the same as their length.

Fixes #30169

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

6 years agogo/types: add gccgo sizes information
Ian Lance Taylor [Tue, 22 Jan 2019 15:40:19 +0000 (07:40 -0800)]
go/types: add gccgo sizes information

This will need to be updated from time to time as new targets are
added to gccgo. But that is better than always returning nil.

Change-Id: I04b8c4d0f8efa38e2a148eb2e38b16b09f0351c3
Reviewed-on: https://go-review.googlesource.com/c/158844
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocontainer/heap: avoid memory leak in example
WhisperRain [Tue, 26 Feb 2019 23:01:53 +0000 (23:01 +0000)]
container/heap: avoid memory leak in example

Set element in slice to nil avoiding memory leak.

Change-Id: I9dbef9a0466407011e326725d3a0b681cd815389
GitHub-Last-Rev: 1bae5d375876a7f146eb04c2a5ba88d079264eb3
GitHub-Pull-Request: golang/go#30386
Reviewed-on: https://go-review.googlesource.com/c/163601
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/link: use SeekPC in testDWARF
Ian Lance Taylor [Fri, 7 Dec 2018 23:00:49 +0000 (15:00 -0800)]
cmd/link: use SeekPC in testDWARF

This makes the tests slightly faster, though the bulk of the time is
still spent building the test programs.

Also run some tests in parallel.

Updates #26470

Change-Id: Ia5ec2b99831d69c426b43dbab80613aa03e705f5
Reviewed-on: https://go-review.googlesource.com/c/153258
Reviewed-by: Austin Clements <austin@google.com>
6 years agonet: remove unixgram test sockets
Ian Lance Taylor [Thu, 21 Feb 2019 00:34:48 +0000 (16:34 -0800)]
net: remove unixgram test sockets

Updates https://gcc.gnu.org/PR89406

Change-Id: Iccf2760e42e9caa90720b96e74a805a9c0d48f35
Reviewed-on: https://go-review.googlesource.com/c/163277
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agoos: clarify that mode argument is only used if file is created
Ian Lance Taylor [Tue, 26 Feb 2019 14:31:21 +0000 (06:31 -0800)]
os: clarify that mode argument is only used if file is created

Fixes #30400

Change-Id: Icbd1dda29562afa80c8e37657133a6fe48070ac0
Reviewed-on: https://go-review.googlesource.com/c/163744
Reviewed-by: Rob Pike <r@golang.org>
6 years agonet: explain why we ignore the first line of Plan 9 interface-status files
Leon Klingele [Fri, 22 Feb 2019 15:51:40 +0000 (15:51 +0000)]
net: explain why we ignore the first line of Plan 9 interface-status files

Change-Id: Ia0847790a597c35ebb572db6fc1b7534ecf8f006
GitHub-Last-Rev: 03f039d0abbce0e2a2bf15201948e46354950a22
GitHub-Pull-Request: golang/go#30022
Reviewed-on: https://go-review.googlesource.com/c/160446
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agobytes: clean up a test
Leon Klingele [Sun, 3 Feb 2019 16:07:39 +0000 (16:07 +0000)]
bytes: clean up a test

Change-Id: Iaa0e1721996b582bba9509c083755e1f125abb6b
GitHub-Last-Rev: c9b13ec0cdc2b22aafa54706dc6df6113a11712b
GitHub-Pull-Request: golang/go#29996
Reviewed-on: https://go-review.googlesource.com/c/160420
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agotime: read 64-bit data if available
Ian Lance Taylor [Wed, 6 Feb 2019 06:52:03 +0000 (22:52 -0800)]
time: read 64-bit data if available

Also store 64-bit data in lib/time/zoneinfo.zip.

The comments argue that we don't need the 64-bit data until 2037 or
2106, but that turns out not to be the case. We also need them for
dates before December 13, 1901, which is time.Unix(-0x80000000, 0).

Fixes #30099

Change-Id: Ib8c9efb29b7b3c08531ae69912c588209d6320e9
Reviewed-on: https://go-review.googlesource.com/c/161202
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: don't generate newobject call for 0-sized types
Iskander Sharipov [Fri, 28 Dec 2018 18:40:04 +0000 (21:40 +0300)]
cmd/compile: don't generate newobject call for 0-sized types

Emit &runtime.zerobase instead of a call to newobject for
allocations of zero sized objects in walk.go.

Fixes #29446

Change-Id: I11b67981d55009726a17c2e582c12ce0c258682e
Reviewed-on: https://go-review.googlesource.com/c/155840
Run-TryBot: Iskander Sharipov <quasilyte@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agofmt: fix an error in documentation for fmt
Bryan Heden [Thu, 14 Feb 2019 02:35:00 +0000 (02:35 +0000)]
fmt: fix an error in documentation for fmt

Original Printf("%d", hi) obviously doesn't produce
%!d(string=hi) unless somewhere before this code
block you have hi := "hi" somewhere, also this change
maintains consistency with the rest of it

Change-Id: I40d8cca623176dcad66374ba74e3a1f8f975ac9e
GitHub-Last-Rev: 242e9ee6afba7ab22ed2967b0ba01ef18db01ca9
GitHub-Pull-Request: golang/go#30223
Reviewed-on: https://go-review.googlesource.com/c/162541
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http: add godoc for Dir.Open function
Dmitry Mottl [Fri, 22 Feb 2019 16:50:54 +0000 (16:50 +0000)]
net/http: add godoc for Dir.Open function

This commit adds godoc for Dir.Open function.

Change-Id: Ibc3b22f38660a082802e1f868c5cf9d880fc2801
GitHub-Last-Rev: 774cfd7d8cc61989179956e47d51451135b6c203
GitHub-Pull-Request: golang/go#30353
Reviewed-on: https://go-review.googlesource.com/c/163437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agotest: add test case that caused a gccgo compiler crash
Ian Lance Taylor [Thu, 14 Feb 2019 05:45:58 +0000 (21:45 -0800)]
test: add test case that caused a gccgo compiler crash

Change-Id: Icdc980e0dcb5639c49aba5f4f252f33bd207e4fa
Reviewed-on: https://go-review.googlesource.com/c/162617
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocompress/gzip: clarify that Multistream gzip requires a ByteReader
Jeremy Jay [Mon, 18 Feb 2019 03:33:28 +0000 (03:33 +0000)]
compress/gzip: clarify that Multistream gzip requires a ByteReader

Change-Id: Ib24778f3172c011e6a39ee65dce8764f3cc911ea
GitHub-Last-Rev: 9c617c1e60ac48db67e26e64ce240d3845c0e6ac
GitHub-Pull-Request: golang/go#30284
Reviewed-on: https://go-review.googlesource.com/c/162999
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoall: fix typos as reported by 'misspell'
Leon Klingele [Fri, 22 Feb 2019 15:53:52 +0000 (15:53 +0000)]
all: fix typos as reported by 'misspell'

Change-Id: I904b8655f21743189814bccf24073b6fbb9fc56d
GitHub-Last-Rev: b032c14394c949f9ad7b18d019a3979d38d4e1fb
GitHub-Pull-Request: golang/go#29997
Reviewed-on: https://go-review.googlesource.com/c/160421
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoio: align style of test comments in multi_test.go
Derek Phan [Sun, 13 Jan 2019 06:07:33 +0000 (06:07 +0000)]
io: align style of test comments in multi_test.go

Change-Id: Ic93a084311de46461ed3b30f4ac2fe11311e74d7
GitHub-Last-Rev: 32fbd63b10d0fa489406333ff6f8b6708974a73c
GitHub-Pull-Request: golang/go#29705
Reviewed-on: https://go-review.googlesource.com/c/157642
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
6 years agocmd/compile: avoid collisions between statictmps and user vars
Alessandro Arzilli [Tue, 16 Oct 2018 14:11:59 +0000 (16:11 +0200)]
cmd/compile: avoid collisions between statictmps and user vars

Avoid name collisions between autogenerated statictmp variables and
user defined global variables.

Fixes #25113

Change-Id: I023eb42a5c2bd2f5352b046d33363faed87084dc
Reviewed-on: https://go-review.googlesource.com/c/142497
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/link: delete stale deadcode reference
Austin Clements [Sat, 3 Nov 2018 21:23:30 +0000 (17:23 -0400)]
cmd/link: delete stale deadcode reference

Back when the linker did code generation after dead code elimination,
it had to know that references to runtime.read_tls_fallback could be
generated at code generation time (and never appear before that). Now
that code generation is done by the compiler, the references to
runtime.read_tls_fallback are obvious in the relocations, so the
linker no longer needs special knowledge of this symbol.

Change-Id: I9813a8478e85a6a13470b2d0528db53fd33fcfdf
Reviewed-on: https://go-review.googlesource.com/c/154601
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agobytes: hoist error creation out of function
Marcel van Lohuizen [Fri, 8 Feb 2019 16:57:46 +0000 (17:57 +0100)]
bytes: hoist error creation out of function

generating frame information in errors will cause this
function to no longer be inlined.

Updates #29934.

Change-Id: I1d7bc11707f1872d7315f627bfb9a12afa41e358
Reviewed-on: https://go-review.googlesource.com/c/161760
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: use hw.ncpuonline sysctl in getncpu on openbsd
Tobias Klauser [Fri, 8 Feb 2019 08:25:05 +0000 (09:25 +0100)]
runtime: use hw.ncpuonline sysctl in getncpu on openbsd

The number of CPUs reported by the hw.ncpu sysctl is twice as high as
the actual number of CPUs running on OpenBSD 6.4. with hyperthreading
disabled (hw.smt=0). Try hw.cpuonline first and fall back to hw.ncpu
in case it fails (which is the case on older OpenBSD before 6.4).

Fixes #30127

Change-Id: Id091234b8038cc9f7c40519d039fc1a05437c40d
Reviewed-on: https://go-review.googlesource.com/c/161757
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agonet/http: clean the path of the stripped URL by StripPrefix
Ggicci [Mon, 11 Feb 2019 10:00:02 +0000 (18:00 +0800)]
net/http: clean the path of the stripped URL by StripPrefix

The path of the new stripped URL should also be cleaned. Since an empty path
may cause unexpected errors in some HTTP handlers, e.g. http.ServeFile.

Fixes #30165

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

6 years agocrypto/tls: fix typo
Yasser Abdolmaleki [Mon, 11 Feb 2019 01:55:27 +0000 (17:55 -0800)]
crypto/tls: fix typo

Change-Id: If9332bae87449c94fc14710133614fcd84d2815c
Reviewed-on: https://go-review.googlesource.com/c/161726
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 years agosyscall: add empty line before marker comments in zsyscall_darwin_*.go
Tobias Klauser [Tue, 18 Dec 2018 14:59:47 +0000 (15:59 +0100)]
syscall: add empty line before marker comments in zsyscall_darwin_*.go

This was spotted during the review of the corresponding CL 154179 for
x/sys/unix. Let's change it in syscall as well to be consistent.

Change-Id: I33f25db1f6ba941b694c2aa276336448cc2b9b51
Reviewed-on: https://go-review.googlesource.com/c/154719
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/src: fix typo in pos.go
Tooru Takahashi [Fri, 11 Jan 2019 14:08:37 +0000 (14:08 +0000)]
cmd/internal/src: fix typo in pos.go

Change-Id: I31ac8845e72c3027c9a463b1f691f4d2b7913ec0
GitHub-Last-Rev: a6b185cc41d649141e6034b77bcfe53525498ea6
GitHub-Pull-Request: golang/go#29682
Reviewed-on: https://go-review.googlesource.com/c/157518
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>