Brad Fitzpatrick [Tue, 9 Jan 2018 18:08:43 +0000 (18:08 +0000)]
strings: prevent copyCheck from forcing Builder to escape and allocate
All credit and blame goes to Ian for this suggestion, copied from the
runtime.
Fixes #23382
Updates #7921
Change-Id: I3d5a9ee4ab730c87e0f3feff3e7fceff9bcf9e18
Reviewed-on: https://go-review.googlesource.com/86976 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Mon, 8 Jan 2018 16:59:29 +0000 (11:59 -0500)]
cmd/link: set runtime.GOROOT default during link
Suppose you build the Go toolchain in directory A,
move the whole thing to directory B, and then use
it from B to build a new program hello.exe, and then
run hello.exe, and hello.exe crashes with a stack
trace into the standard library.
Long ago, you'd have seen hello.exe print file names
in the A directory tree, even though the files had moved
to the B directory tree. About two years ago we changed
the compiler to write down these files with the name
"$GOROOT" (that literal string) instead of A, so that the
final link from B could replace "$GOROOT" with B,
so that hello.exe's crash would show the correct source
file paths in the stack trace. (golang.org/cl/18200)
Now suppose that you do the same thing but hello.exe
doesn't crash: it prints fmt.Println(runtime.GOROOT()).
And you run hello.exe after clearing $GOROOT from the
environment.
Long ago, you'd have seen hello.exe print A instead of B.
Before this CL, you'd still see hello.exe print A instead of B.
This case is the one instance where a moved toolchain
still divulges its origin. Not anymore. After this CL, hello.exe
will print B, because the linker sets runtime/internal/sys.DefaultGoroot
with the effective GOROOT from link time.
This makes the default result of runtime.GOROOT once again
match the file names recorded in the binary, after two years
of divergence.
With that cleared up, we can reintroduce GOROOT into the
link action ID and also reenable TestExecutableGOROOT/RelocatedExe.
When $GOROOT_FINAL is set during link, it is used
in preference to $GOROOT, as always, but it was easier
to explain the behavior above without introducing that
complication.
Fixes #22155.
Fixes #20284.
Fixes #22475.
Change-Id: Ifdaeb77fd4678fdb337cf59ee25b2cd873ec1016
Reviewed-on: https://go-review.googlesource.com/86835
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Tue, 9 Jan 2018 15:10:46 +0000 (10:10 -0500)]
cmd/link: apply -X options after loading symbols
The linker has been applying -X options before loading symbols,
meaning that when it sees -X y=z it creates a symbol named y
and initializes its string data to z. The symbol named y is marked
"DUPOK" so that when the actual packages are loaded, no error is
emitted when the real y is seen. The predefined y's data is used
instead of whatever the real y says.
If we define -X y=z and we never load y, then the predefined symbol
is dropped during dead code elimination, but not in shared library
builds. Shared library builds must include all symbols, so we have to
be more careful about not defining symbols that wouldn't have
appeared anyway.
To be more careful, save the -X settings until after all the symbols
are loaded from the packages, and then apply the string changes
to whatever symbols are known (but ignore the ones that were not
loaded at all). This ends up being simpler anyway, since it doesn't
depend on DUPOK magic.
Makes CL 86835 safe.
Fixes #23273.
Change-Id: Ib4c9b2d5eafa97c5a8114401dbec0134c76be54f
Reviewed-on: https://go-review.googlesource.com/86915
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
The first field, padded by spaces and followed by a tab,
is printed when the benchmark begins running.
The rest of the line is printed when the benchmark ends.
Tools and people can watch the timing of these prints
to see which benchmark is running.
To allow tools consuming json output to continue to be
able to see which benchmark is running, this CL adds a
special case to the usual "line at a time" behavior to flush
the benchmark name if it is observed separately from the
rest of the line.
Fixes #23352.
Change-Id: I7b6410698d78034eec18745d7f57b7d8e9575dbb
Reviewed-on: https://go-review.googlesource.com/86695
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Sat, 6 Jan 2018 03:03:58 +0000 (03:03 +0000)]
A+C: update late Go 1.10 contributors
Add Brad Burch (individual CLA)
Add Charles Fenwick Elliott (individual CLA)
Add Geoff Berry (corporate CLA for Qualcomm Data Center, Inc.)
Add Igor Vashyst (individual CLA)
Add Jiulong Wang (individual CLA)
Add Junya Hayashi (individual CLA)
Add Matthijs Kooijman (individual CLA)
Add Paul PISCUC (individual CLA)
Add Steve Gilbert (individual CLA)
Add Tad Fisher (individual CLA)
Add Yukihiro Nishinaka (individual CLA)
Updates #12042
Change-Id: Ib7a3c7a4d38d15530c2ea42fe8d359ae10c9a19e
Reviewed-on: https://go-review.googlesource.com/86478 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Giovanni Bajo [Mon, 13 Nov 2017 00:54:08 +0000 (01:54 +0100)]
crypto/x509: update iOS root certs.
Apple changed the format of its support page, so we need to
restructure the HTML parser. The HTML table is now parsed using
regular expressions, and certificates are then found in macOS
trust store by their fingerprint.
Brad Fitzpatrick [Sat, 6 Jan 2018 01:16:09 +0000 (01:16 +0000)]
doc/go1.10: remove ReverseProxy TODO
No longer needs to be done.
Updates #23009
Updates #21255
Change-Id: I78e9e29a923dc03dea89ff3a5bf60f2e0bd0c0aa
Reviewed-on: https://go-review.googlesource.com/86476 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 5 Jan 2018 21:35:51 +0000 (21:35 +0000)]
Revert "net/http/httputil: allow ReverseProxy to call ModifyResponse on failed requests"
This reverts commit https://golang.org/cl/54030
Reason for revert: to not paint ourselves into a corner.
See https://github.com/golang/go/issues/23009
Fixes #23009
Updates #21255
Change-Id: I68caab078839b9d2bf645a7bbed8405a5a30cd22
Reviewed-on: https://go-review.googlesource.com/86435 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 5 Jan 2018 21:31:57 +0000 (21:31 +0000)]
net/http: document cloning of Server.TLSConfig
Updates #22018
Change-Id: I8a85324e9d53dd4d279ed05cdb93f50d55cf767b
Reviewed-on: https://go-review.googlesource.com/86415 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Wed, 27 Dec 2017 22:07:01 +0000 (14:07 -0800)]
cmd/go: add support for build IDs with gccgo
This just adds support on ELF systems, which is OK for now since that
is all that gccgo works on.
For the archive file generated by the compiler we add a new file
_buildid.o that has a section .go.buildid containing the build ID.
Using a new file lets us set the SHF_EXCLUDE bit in the section header,
so the linker will discard the section. It would be nicer to use
`objcopy --add-section`, but objcopy doesn't support setting the
SHF_EXCLUDE bit.
For an executable we just use an ordinary GNU build ID. Doing this
required modifying cmd/internal/buildid to look for a GNU build ID,
and use it if there is no other Go-specific note.
This CL fixes a minor bug in gccgoTOolchain.link: it was using .Target
instead of .built, so it failed for a cached file.
This CL fixes a bug reading note segments: the notes are aligned as
reported by the PT_NOTE's alignment field.
Updates #22472
Change-Id: I4d9e9978ef060bafc5b9574d9af16d97c13f3102
Reviewed-on: https://go-review.googlesource.com/85555
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Russ Cox [Fri, 5 Jan 2018 21:06:47 +0000 (16:06 -0500)]
cmd/test2json: fix processing of --- BENCH: output
If a benchmark calls b.Log without failing (without b.Error/b.Fatal/b.FailNow)
then that turns into output very much like a test passing,
except it says BENCH instead of PASS.
Benchmarks failing say FAIL just like tests failing.
Russ Cox [Fri, 5 Jan 2018 18:20:08 +0000 (13:20 -0500)]
go/constant: make string addition compute actual string lazily
It is natural for tools to take a large string concatenation like
"1" + "1" + "1" + ... + "1"
and translate that into a sequence of go/constant calls:
x := constant.MakeString("1")
x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
...
If the underlying representation of a string constant is a Go string,
then this leads to O(N²) memory for the concatenation of N strings,
allocating memory for "1", "11", "111", "1111", and so on.
This makes go/types and in particular cmd/vet run out of memory
(or at least use far too much) on machine-generated string concatenations,
such as those generated by go-bindata.
This CL allows code like the above to operate efficiently, by delaying
the evaluation of the actual string constant value until it is needed.
Now the representation of a string constant is either a string or an
explicit addition expression. The addition expression is turned into
a string the first time it is requested and then cached for future use.
This slows down the use of single strings, but analyses are likely not
dominated by that use anyway. It speeds up string concatenations,
especially large ones, significantly.
Fixes #23348 (originally reported as cmd/vet failures in comments on #23222).
This makes constant.Values of Kind String no longer meaningful for ==, which
required fixes in go/types. While there, also fix go/types handling of constant.Values
of Kind Int (for uint64), Float, and Complex.
Russ Cox [Thu, 4 Jan 2018 22:22:29 +0000 (17:22 -0500)]
cmd/go: skip long tests in -short mode
I marked every test that takes more than 0.5 seconds on my machine
as something to run only when not in -short mode, or in -short mode
on the beefy linux/amd64, windows/amd64, and darwin/amd64 builders.
I also shortened a few needlessly-expensive tests where possible.
Cuts the time for go test -short cmd/go from 45s to 15s on my machine.
Should help even more on some of our builders and slower user machines.
Fixes #23287.
Change-Id: I0e36003ef947b0ebe4224a1373731f9fa9216843
Reviewed-on: https://go-review.googlesource.com/86252
Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 5 Jan 2018 17:03:51 +0000 (17:03 +0000)]
net/http: document internal error errServerClosedIdle more
Updates #19943
Change-Id: Iea249be51a7af3264bee9ee2b28dbd91043275fc
Reviewed-on: https://go-review.googlesource.com/86375 Reviewed-by: Ian Lance Taylor <iant@golang.org>
http2: don't check WriteHeader status if we've already sent the header
https://golang.org/cl/86255
Fixes #23010
Change-Id: I4f3dd63acb52d5a34a0350aaf847a7a376d6968f
Reviewed-on: https://go-review.googlesource.com/86275 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Thu, 4 Jan 2018 23:36:16 +0000 (23:36 +0000)]
net/http: document CONNECT more
Fixes #22554
Change-Id: I624f2883489a46d7162c11f489c2f0a0ec5a836f
Reviewed-on: https://go-review.googlesource.com/86277 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Thu, 4 Jan 2018 23:06:31 +0000 (23:06 +0000)]
net/http: soften wording around when the Transport reuses connections
The docs were too specific. Make it vaguer. There are conditions for
which the Transport will try to reuse a connection anyway, even if the
Response Body isn't read to EOF or closed, but we don't need to get
into all the details in the docs.
Fixes #22954
Change-Id: I3b8ae32aeb1a61b396d0026e129552afbfecceec
Reviewed-on: https://go-review.googlesource.com/86276 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Thu, 4 Jan 2018 20:09:21 +0000 (15:09 -0500)]
cmd/go: fix build failure in -x test
CL 84735 strengthened the -x test to make sure commands succeed,
using set -e, but the gcc flag tests can fail. Change them to say || true.
Fixes #23337.
Change-Id: I01e4017cb36ceb147b56935c2636de52ce7bdfdb
Reviewed-on: https://go-review.googlesource.com/86239 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Burch [Thu, 4 Jan 2018 06:42:10 +0000 (00:42 -0600)]
crypto/tls: optional "certificate_status" with OCSP
Follows the wording in RFC4366 more precisely which allows a server
to optionally return a "certificate_status" when responding to a
client hello containing "status_request" extension.
fixes #8549
Change-Id: Ib02dc9f972da185b25554568fe6f8bc411d9c0b7
Reviewed-on: https://go-review.googlesource.com/86115 Reviewed-by: Adam Langley <agl@golang.org>
Robert Griesemer [Wed, 3 Jan 2018 18:33:11 +0000 (10:33 -0800)]
spec: consistently use "element" rather than "value" for map entry values
The spec refers to a map's key and element types; thus the respective
values are "keys" and "elements". Also, a map value is the value of
the entire map.
Similar fix for channels, where appropriate.
Fixes #23254.
Change-Id: I6f03ea6d86586c7b0b3e84f0c2e9446b8109fa53
Reviewed-on: https://go-review.googlesource.com/85999 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Russ Cox [Thu, 4 Jan 2018 18:25:31 +0000 (13:25 -0500)]
cmd/test2json: fix test log output containing test output
If test case framing appears in ordinary test output,
then test2json can get confused. If the fake framing is being
saved with t.Logf/t.Errorf/etc then we can already
distinguish it from real framing, and the code did.
It just forgot to write that framing as output (1-line fix).
If the fake framing is being generated by printing directly
to stdout/stderr, then test2json will simply get confused.
There's not a lot to do at that point (maybe it's even a feature).
Fixes #23036.
Change-Id: I29449c7ace304172b89d8babe23de507c0500455
Reviewed-on: https://go-review.googlesource.com/86238
Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Thu, 4 Jan 2018 18:07:44 +0000 (13:07 -0500)]
cmd/go: fix coverage rebuild corner case
If you have a package p1 with an xtest (package p1_test)
that imports p2, where p2 itself imports p1, then when
trying to do coverage for p1 we need to make sure to
recompile p2. The problem was that the overall package
import graph looked like:
main -> p1_test -> p2 -> p1
Since we were recompiling p1 with coverage, we correctly
figured out that because p2 depends on a package being
recompiled due to coverage, p2 also needs to be split (forked) to
insert the dependency on the modified p1. But then we used
the same logic to split p1_test and main, with the effect that
the changes to p2 and p1_test and main were lost, since the
caller was still holding on to the original main, not the split version.
Change the code to treat main and p1_test as "already split"
and just update them in place.
Fixes #23314.
Change-Id: If7edeca6e39cdaeb5b9380d00b0c7d8c5891f086
Reviewed-on: https://go-review.googlesource.com/86237
Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Austin Clements [Thu, 4 Jan 2018 15:43:29 +0000 (10:43 -0500)]
runtime: avoid race on allp in findrunnable
findrunnable loops over allp to check run queues *after* it has
dropped its own P. This is unsafe because allp can change when nothing
is blocking safe-points. Hence, procresize could change allp
concurrently with findrunnable's loop. Beyond generally violating Go's
memory model, in the best case this could findrunnable to observe a
nil P pointer if allp has been grown but the new slots not yet
initialized. In the worst case, the reads of allp could tear, causing
findrunnable to read a word that isn't even a valid *P pointer.
Fix this by taking a snapshot of the allp slice header (but not the
backing store) before findrunnable drops its P and iterating over this
snapshot. The actual contents of allp are immutable up to len(allp),
so this fixes the race.
Agniva De Sarker [Thu, 4 Jan 2018 09:37:03 +0000 (15:07 +0530)]
cmd/go: add -v option in the usage section for get
Updates #23332
Change-Id: I964d36ed751ef1844ab6c40f61047297ff1443a3
Reviewed-on: https://go-review.googlesource.com/85797 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Wed, 3 Jan 2018 18:24:29 +0000 (10:24 -0800)]
time: revert CL 78735 (was: space padding using underscore)
CL 78735 description:
time: add space padding layout strings(using underscore) for not only day but others
As mentioned in #22802, only day component of layout string has space
padding(represented by one underscore before its placeholder). This
commit expands the rule for month, hour, minute and second.
Updates #22802 (maybe fixes it)
Revert this CL because it breaks currently working formats that happen
to use underscores.
Fixes #23259
Change-Id: I64acaaca9b5b74785ee0f0be7910574e87daa649
Reviewed-on: https://go-review.googlesource.com/85998
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Ian Lance Taylor [Wed, 3 Jan 2018 18:09:35 +0000 (10:09 -0800)]
net: report connect error as coming from "connect"
We retrieve an error using getsockopt with SO_ERROR. We were reporting
the error as coming from "getsockopt", but really it is coming from
"connect". It is not getsockopt that failed.
Fixes #19302
Change-Id: I510ab76e4b04c70cd9dfdfc46d9a410bf653d017
Reviewed-on: https://go-review.googlesource.com/85997
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Commit c2c07c7989 (CL 49331) changed the linker and runtime to always
use 2MB stacks on 64-bit Windows. This is the corresponding change to
make 32-bit Windows always use large (1MB) stacks because it's
difficult to detect when Windows applications will call into arbitrary
C code that may expect a large stack.
This is done as a separate change because it's possible this will
cause too much address space pressure for a 32-bit address space. On
the other hand, cgo binaries on Windows already use 1MB stacks and
there haven't been complaints.
Daniel Theophanes [Thu, 21 Dec 2017 17:31:39 +0000 (09:31 -0800)]
database/sql: fix nil pointer use within withLock
During the refactor in 1126d1483f0397648905fcd4590ae45352cabd69 I
introduced a logical error within one withLock function that used
the result of the call before checking for the error. Change
the order so that the error is checked before the result is used.
None of the other withLock uses have similar issues.
Fixes #23208
Change-Id: I6c5dcf262e36bad4369c850f1e0131066360a82e
Reviewed-on: https://go-review.googlesource.com/85175
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Caleb Spare <cespare@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Cherry Zhang [Tue, 2 Jan 2018 20:20:19 +0000 (15:20 -0500)]
cmd/compile: disable "redundant zeroextensions" optimization for Select on AMD64
A Select Op could produce a value with upper 32 bits NOT zeroed,
for example, Div32 is lowered to (Select0 (DIVL x y)).
In theory, we could look into the argument of a Select to decide
whether the upper bits are zeroed. As it is late in release cycle,
just disable this optimization for Select for now.
Caio Marcelo de Oliveira Filho [Tue, 2 Jan 2018 01:17:14 +0000 (17:17 -0800)]
net/http: relax the matching of strace output in test
Modify the regex in TestLinuxSendfile to not match the parameters of
the syscall, just its name and the opening parenthesis. This is enough
to recognize that the syscall was invoked.
This fixes the TestLinuxSendfile test when running in Clear Linux,
where strace always execute with -yy implied, having output with extra
information in the parameters:
Brian Kessler [Sat, 30 Dec 2017 08:27:28 +0000 (01:27 -0700)]
math: correct result for Pow(x, ±.5)
Fixes #23224
The previous Pow code had an optimization for
powers equal to ±0.5 that used Sqrt for
increased accuracy/speed. This caused special
cases involving powers of ±0.5 to disagree with
the Pow spec. This change places the Sqrt optimization
after all of the special case handling.
Change-Id: I6bf757f6248256b29cc21725a84e27705d855369
Reviewed-on: https://go-review.googlesource.com/85660 Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Tim Cooper [Mon, 1 Jan 2018 16:11:58 +0000 (12:11 -0400)]
reflect: explicitly state that Type values can be used as map keys
Fixes #6535
Change-Id: I34974c0050424c96d19ad69bf4522bb69cde2fd5
Reviewed-on: https://go-review.googlesource.com/85815 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 29 Dec 2017 01:15:23 +0000 (01:15 +0000)]
os: document that StartProcess's argv starts with the binary name
Fixes #23277
Change-Id: Idbe09913c95dc951b9b195eb7ff1e75d2bb4d63d
Reviewed-on: https://go-review.googlesource.com/85675 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Jeff Johnson [Fri, 22 Dec 2017 16:30:39 +0000 (08:30 -0800)]
net: revert CL 82975
this solution as it stands doesn't work with
non-english device names (golang/go#23191 (which has a fix))
and names some devices differently (golang/go#23153) probably due to the
fact that this test previously only ran on Server 2008.
Re-opens golang/go#20073
Change-Id: I5c36774ddd85ac07620b4015372d564acbb169ad
Reviewed-on: https://go-review.googlesource.com/85315 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Hana Kim [Tue, 12 Dec 2017 23:20:06 +0000 (18:20 -0500)]
cmd/trace: init goroutine info entries with GoCreate event
golang.org/cl/81315 attempted to distinguish system goroutines
by examining the function name in the goroutine stack. It assumes that
the information would be available when GoSysBlock or GoInSyscall
events are processed, but it turned out the stack information is
set too late (when the goroutine gets a chance to run).
This change initializes the goroutine information entry when
processing GoCreate event which should be one of the very first
events for the every goroutine in trace.
Than McIntosh [Wed, 20 Dec 2017 14:54:13 +0000 (09:54 -0500)]
cmd/compile: second attempt at fix for issue 23179
My previous fix for issue 23179 was incomplete; it turns out that if
an unnamed parameter is below a specific size threshold, it gets
register-promoted away by the compiler (hence not encountered during
some parts of DWARF inline info processing), but if it is sufficiently
large, it is allocated to the stack as a named variable and treated as
a regular parameter by DWARF generation. Interestingly, something in
the ppc64le build of k8s causes an unnamed parameter to be retained
(where on amd64 it is deleted), meaning that this wasn't caught in my
amd64 testing.
The fix is to insure that "_" params are treated in the same way that
"~r%d" return temps are when matching up post-optimization inlined
routine params with pre-inlining declarations. I've also updated the
test case to include a "_" parameter with a very large size, which
also triggers the bug on amd64.
elpinal [Sat, 16 Dec 2017 06:04:05 +0000 (15:04 +0900)]
cmd/doc: suppress the error message for *package.ident embedded in struct type
The current implementation prints a log, "invalid program: unexpected
type for embedded field", when the form *package.ident is embedded in
a struct declaration.
Note that since valid qualified identifiers must be exported, the result
for a valid program does not change.
Change-Id: If8b9d7056c56b6a6c5482eb749168a63c65ef685
Reviewed-on: https://go-review.googlesource.com/84436 Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Than McIntosh [Tue, 19 Dec 2017 17:08:32 +0000 (12:08 -0500)]
cmd/compile: fix corner case in DWARF inline info generation
The helper routine for returning pre-inlining parameter declarations
wasn't properly handling the case where you have more than one
parameter named "_" in a function signature; this triggered a map
collision later on when the function was inlined and DWARF was
generated for the inlined routine instance.
Than McIntosh [Mon, 18 Dec 2017 18:58:41 +0000 (13:58 -0500)]
cmd/internal/link: disable selected DWARF tests on Solaris
Disable the three linker DWARF tests that invoke the compiler in
non-debug mode on Solaris, since this seems to trigger a split stack
overflow. These can be turned back on once the issue in question is
resolved.
David Chase [Thu, 14 Dec 2017 18:41:13 +0000 (13:41 -0500)]
cmd/compile: clean up debug_test.go
Exercise of preparing a how-to document motivated me to
clean up some of the stupider wonkier bits. Since this
does not run for test -short, expect no change for trybots,
did pass testing with OSX gdb and a refreshed copy of Delve.
David Chase [Fri, 15 Dec 2017 20:56:51 +0000 (15:56 -0500)]
cmd/link: make inlining+locationlist test depend on GOARCH
Location lists are only supported on x86 and amd64, so the
test expecting them failed everywhere else. Make that test
skip unless GOARCH is x86 or amd64.
Matthijs Kooijman [Wed, 13 Dec 2017 15:45:09 +0000 (16:45 +0100)]
os: mention the influence of umask in docs
Change-Id: Ia05fac3298334d6b44267ce02bffcd7bf8a54c72
Reviewed-on: https://go-review.googlesource.com/83775 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 15 Dec 2017 16:34:39 +0000 (16:34 +0000)]
cmd/dist: let misc/cgo/testshared test timeout be scaled by slow builder
The default test timeout is 10 minutes if unspecified.
The misc/cgo/testshared test didn't use t.timeout(sec), which respects
GO_TEST_TIMEOUT_SCALE, so all builders got the default 10 minute
timeout. arm5 needs more, though, so specify 10 minutes explicitly,
which will then get scaled accordingly on slower builders.
Than McIntosh [Mon, 11 Dec 2017 20:53:31 +0000 (15:53 -0500)]
cmd/compile: fixes for bad DWARF abstract origin references
Change the compiler's DWARF inline info generation to be more careful
about producing consistent instances of abstract function DIEs. The
new strategy is to insure that the only params/variables created in an
abstract subprogram DIE are those corresponding to declarations in the
original pre-inlining version of the code. If a concrete subprogram
winds up with other vars as part of the compilation process (return
temps, for example, or scalars generated by splitting a structure into
pieces) these are emitted as regular param/variable DIEs instead of
concrete DIEs.
The linker dwarf test now has a couple of new testpoints that include
checks to make sure that all abstract DIE references are
sane/resolvable; this will help catch similar problems in the future.
Austin Clements [Thu, 14 Dec 2017 20:32:12 +0000 (15:32 -0500)]
runtime: symbolize morestack caller in throwsplit panic
This attempts to symbolize the PC of morestack's caller when there's a
stack split at a bad time. The stack trace starts at the *caller* of
the function that attempted to grow the stack, so this is useful if it
isn't obvious what's being called at that point, such as in #21431.
Hana Kim [Thu, 14 Dec 2017 21:11:03 +0000 (16:11 -0500)]
doc/debugging_with_gdb: update -gcflags usage
After go1.10, compiler/linker option flags apply only to the packages
listed directly on the command line unless the matching pattern is
specified. For debugging, we want to apply the flags to all packages.
Change-Id: Ic69eee1491b1080fc140592f200c59a6e03d87ac
Reviewed-on: https://go-review.googlesource.com/84135 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Fri, 15 Dec 2017 01:49:04 +0000 (01:49 +0000)]
cmd/dist: increase default cmd/go test timeout
cmd/go has grown slow, even in short mode, and it's now regularly
failing on a number of builders where it's taking over the previous 3
minute timeout. for now, give it more time.
Change-Id: If565baf71c2770880b2e2139b47e03433951331f
Reviewed-on: https://go-review.googlesource.com/84235 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Russ Cox [Wed, 13 Dec 2017 19:45:50 +0000 (14:45 -0500)]
cmd/vet: limit printf check to known Printf-like functions
The name-based heuristics fail too often to be on during "go test",
but we really want the printf vet check in "go test", so change to
a list of exactly which standard library functions are print-like.
For a later release we'd like to bring back checking for user-defined
wrappers, but in a completely precise way. Not for Go 1.10, though.
The new, more precise list includes t.Skipf, which caught some
mistakes in standard library tests.
Fixes #22936.
Change-Id: I110448e3f6b75afd4327cf87b6abb4cc2021fd0d
Reviewed-on: https://go-review.googlesource.com/83838
Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Wed, 13 Dec 2017 19:39:40 +0000 (14:39 -0500)]
cmd/go: vet support for upcoming cmd/vet fixes
Two minor changes to allow fixes in cmd/vet's printf checking.
1. Pass package import path in vet config, so that vet knows
whether it is, for example, vetting "fmt".
2. Add new, but undocumented and for now unsupported
flag -vettool to control which vet binary is invoked during go vet.
This lets the cmd/vet tests build and test a throwaway vet.exe
using cmd/go to ensure type checking information, all without
installing a potentially buggy cmd/vet.
For #22936.
Change-Id: I18df7c796ebc711361c847c63eb3ee17fb041ff7
Reviewed-on: https://go-review.googlesource.com/83837
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mike Samuel [Sun, 19 Nov 2017 21:37:07 +0000 (06:37 +0900)]
html/template: add srcset content type
Srcset is largely the same as a URL, but is escaped in URL contexts.
Inside a srcset attribute, URLs have their commas percent-escaped to
avoid having the URL be interpreted as multiple URLs. Srcset is placed
in a srcset attribute literally.
Brad Fitzpatrick [Wed, 13 Dec 2017 21:18:28 +0000 (21:18 +0000)]
doc/go1.10: note that netbsd/arm is definitely broken
Remove the ambiguity, know that we know it's actually broken,
per https://github.com/golang/go/issues/23073#issuecomment-351045421
Updates #23073
Change-Id: I9b904da2f4c7105a0727d2a9056aaa6895d3dadc
Reviewed-on: https://go-review.googlesource.com/83856 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Wèi Cōngruì [Thu, 14 Dec 2017 02:54:11 +0000 (10:54 +0800)]
os: don't wait for Close if the File was returned by NewFile
os.NewFile doesn't put the fd into non-blocking mode.
In most cases, an *os.File returned by os.NewFile is in blocking mode.
Updates #7970
Updates #21856
Updates #23111
Change-Id: Iab08432e41f7ac1b5e25aaa8855d478adb7f98ed
Reviewed-on: https://go-review.googlesource.com/83995 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Thu, 14 Dec 2017 01:29:28 +0000 (17:29 -0800)]
cmd/cgo: don't define intgo in export prologue
The export prologue goes into the _cgo_export.h file, where it may be
be #include'd by a .swig file. As SWIG defines its own type "intgo",
the definition of "intgo" in the export prologue could conflict.
Since we don't need to define "intgo" in the _cgo_export.h file, don't.
Defining "intgo" in _cgo_export.h was new for this release, so this
should not break any existing code.
No test case as I can't quite bring myself to write a test that
combines SWIG and cgo.
Change-Id: I8073e8300a1860cecd5994b9ad07dd35a4298c89
Reviewed-on: https://go-review.googlesource.com/83936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Russ Cox [Thu, 14 Dec 2017 00:47:32 +0000 (19:47 -0500)]
cmd/go: apply same per-package flags to compile and link of test
If package strings has a particular set of gcflags, then the strings_test
pseudo-package built as part of the test binary started inheriting the
same flags in CL 81496, to fix #22831.
Now the package main and final test binary link built as part of the
strings test binary also inherit the same flags, to fix #22994.
I am slightly uneasy about reusing package strings's flags for
package main, but the alternative would be to introduce some
kind of special case, which I'd be even more uneasy about.
This interpretation preserves the Go 1.9 behavior of existing
commands like:
go test -c -ldflags=-X=mypkg.debugString=foo mypkg
Fixes #22994.
Change-Id: I9ab83bf1a9a6adae530a7715b907e709fd6c1b5d
Reviewed-on: https://go-review.googlesource.com/83879
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Nathaniel Caza [Tue, 14 Feb 2017 03:15:40 +0000 (21:15 -0600)]
crypto/x509: load all trusted certs on darwin (cgo)
The current implementation ignores certs wherein the
Subject does not match the Issuer. An example of where
this causes issue is an enterprise environment with
intermediate CAs. In this case, the issuer is separate
(and may be loaded) but the intermediate is ignored.
A TLS handshake that does not include the intermediate
cert would then fail with an untrusted error in Go.
On other platforms (darwin-nocgo included), all trusted
certs are loaded and accepted reguardless of
Subject/Issuer names.
This change removes the Subject/Issuer name-matching
restriction of certificates when trustAsRoot is set,
allowing all trusted certs to be loaded on darwin (cgo).