1
0
mirror of https://github.com/golang/go synced 2024-11-17 09:44:48 -07:00
Commit Graph

40658 Commits

Author SHA1 Message Date
Tyler Bui-Palsulich
27eaffc053 cmd/go: document GO{NO}SUMDB in 'go help environment' and 'go help modules'
GOSUMDB and GONOSUMDB are described in detail by
'go help module-auth'. So, this change mentions the two
variables and says to see 'go help module-auth'.

This also adds GONOPROXY to 'go help environment'.

Fixes #32292 and updates #32056.

Change-Id: I2eae0f906a3fbfcb88ad5c8fb4870917d0d7bbcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/179219
Reviewed-by: Russ Cox <rsc@golang.org>
2019-06-04 20:57:36 +00:00
Keith Randall
fff4f599fe cmd/compile,runtime: allocate defer records on the stack
When a defer is executed at most once in a function body,
we can allocate the defer record for it on the stack instead
of on the heap.

This should make defers like this (which are very common) faster.

This optimization applies to 363 out of the 370 static defer sites
in the cmd/go binary.

name     old time/op  new time/op  delta
Defer-4  52.2ns ± 5%  36.2ns ± 3%  -30.70%  (p=0.000 n=10+10)

Fixes #6980
Update #14939

Change-Id: I697109dd7aeef9e97a9eeba2ef65ff53d3ee1004
Reviewed-on: https://go-review.googlesource.com/c/go/+/171758
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-06-04 17:35:20 +00:00
Agniva De Sarker
8343a0934d doc: fix missing anchor links in contribute.html
Some <h3>s were missing ids due to which the anchor links
weren't getting generated.

Fixes #32415

Change-Id: Ica21425c1a7c49735231c1de96b6c77dd594ce64
Reviewed-on: https://go-review.googlesource.com/c/go/+/180397
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-04 15:30:33 +00:00
Andrew Gerrand
5e2af2b0d2 errors: fix package example
The example in example_test.go requires that the whole file be
displayed; the addition of ExampleAs meant that only the body of the
package example function was shown, rather than the surrounding context.

This change moves ExampleAs to the file wrap_test.go file, restoring the
package example to its former glory.

Update #31716

Change-Id: Id0ea77bc06023b239a63c1d6a7c8b3c1dae91ce9
Reviewed-on: https://go-review.googlesource.com/c/go/+/179737
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Jean de Klerk <deklerk@google.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-03 22:09:05 +00:00
LE Manh Cuong
0c75eb824c runtime: fix sigpipe do not check SIGPIPE was ignored
Fixes #32386

Change-Id: I29ad4113b02264336eebe7865895f07ef386f450
Reviewed-on: https://go-review.googlesource.com/c/go/+/180177
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-03 20:07:50 +00:00
Ben Shi
cbdf9ade56 runtime: save/restore callee saved registers in arm64's sigtramp
ARM64's R19-R29 and F8-F15 are callee saved registers, which
should be saved in the beginning of sigtramp, and restored at
the end.

fixes #31827

Change-Id: I622e03f1a13fec969d3a11b6a303a8a492e02bcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/177045
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-06-03 19:02:11 +00:00
Keith Randall
38c129b4f0 runtime: get map of args of unstarted goroutines like we do for defers
Normally, reflect.makeFuncStub records the context value at a known
point in the stack frame, so that the runtime can get the argument map
for reflect.makeFuncStub from that known location.

This doesn't work for defers or goroutines that haven't started yet,
because they haven't allocated a frame or run an instruction yet. The
argument map must be extracted from the context value. We already do
this for defers (the non-nil ctxt arg to getArgInfo), we just need to
do it for unstarted goroutines as well.

When we traceback a goroutine, remember the context value from
g.sched.  Use it for the first frame we find.

(We never need it for deeper frames, because we normally don't stop at
 the start of reflect.makeFuncStub, as it is nosplit. With this CL we
 could allow makeFuncStub to no longer be nosplit.)

Fixes #25897

Change-Id: I427abf332a741a80728cdc0b8412aa8f37e7c418
Reviewed-on: https://go-review.googlesource.com/c/go/+/180258
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-06-03 18:50:30 +00:00
Bryan C. Mills
2ce643d3b6 cmd/go: document GO111MODULE=auto behavior for Go 1.13
Fixes #31857

Change-Id: Ic4afe1262d863112db97794edc1ade20f6926d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/180197
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-06-03 17:02:01 +00:00
Andrew Gerrand
98100c56da cmd/cover: fix counting of blocks split by goto statements
When adding coverage counters to a block, the block's statement list is
mutated. CL 77150 removed the part where the mutated list is assigned
back to its parent node; this was confusing ast.Walk, which would then
lose its place and stop walking the current block, dropping counters in
the process.

This change has addCounters make a copy of the list before mutating
it, so that the original list doesn't change under Walk's feet.

Fix #32200

Change-Id: Ia3b67d8cee860ceb7caf8748cb7a80ff9c6276e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/179581
Reviewed-by: Rob Pike <r@golang.org>
2019-06-03 01:37:58 +00:00
Hajime Hoshi
ce656af9b5 syscall/js: fix comments
As js.TypedArray no longer exists, the comment should be updated.

Change-Id: Idd1087c8007afc90307fdd965f28d3be8d8cd73e
Reviewed-on: https://go-review.googlesource.com/c/go/+/180097
Reviewed-by: Richard Musiol <neelance@gmail.com>
2019-06-02 19:28:21 +00:00
frennkie
ee46250e06 net: fix the doc string on parseIPv6
Change-Id: Ie9fef7767f3263ef7daed8415ab2f59c5377a3cb
GitHub-Last-Rev: a4d13b7452
GitHub-Pull-Request: golang/go#32385
Reviewed-on: https://go-review.googlesource.com/c/go/+/180037
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-06-02 13:28:00 +00:00
Jay Conrod
6f7542e4cb cmd/go: ignore build tags when 'go get' modifies build list
In module mode, 'go get' should not consider build constraints when
loading packages in order to modify the module graph. With this
change, 'go get' considers all build tags to be true except for
"ignore" and malformed build constraint expressions.

When 'go get' builds packages, it still applies build constraints for
the target platform.

Fixes #32345

Change-Id: I6dceae6f10a5185870537de730b36292271ad124
Reviewed-on: https://go-review.googlesource.com/c/go/+/179898
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-05-31 23:00:43 +00:00
Keith Randall
64c134f90f cmd/compile: don't move nil checks across a VarDef
We need to make sure that there's no possible faulting
instruction between a VarDef and that variable being
fully initialized. If there was, then anything scanning
the stack during the handling of that fault will see
a live but uninitialized variable on the stack.

If we have:

  NilCheck p
  VarDef x
  x = *p

We can't rewrite that to

  VarDef x
  NilCheck p
  x = *p

Particularly, even though *p faults on p==nil, we still
have to do the explicit nil check before the VarDef.

Fixes #32288

Change-Id: Ib8b88e6a5af3bf6f238ff5491ac86f53f3cf9fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/179239
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2019-05-31 21:52:17 +00:00
Cherry Zhang
c10db03cbe cmd/compile: make sure build works when intrinsics are disabled
Some runtime functions, like getcallerpc/sp, don't have Go or
assembly implementations and have to be intrinsified. Make sure
they are, even if intrinsics are disabled.

This makes "go build -gcflags=all=-d=ssa/intrinsics/off hello.go"
work.

Change-Id: I77caaed7715d3ca7ffef68a3cdc9357f095c6b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/179897
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-31 21:27:59 +00:00
Bryan C. Mills
48a53d6eaf cmd/go/internal/modfetch: use the resolved version to search for tags in (*codeRepo).convert
Previously, we used the passed-in statVers as the basis for tag search,
but it is not always valid.
Instead, use info.Name, which (by precondition) must be valid.

Updates #32161
Updates #27171

Change-Id: Iaecb5043bdf2fefd26fbe3f8e3714b07d22f580f
Reviewed-on: https://go-review.googlesource.com/c/go/+/179857
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-05-31 21:14:52 +00:00
Cherry Zhang
f61fa116ea test: add a test for gccgo bug #32347
The gccgo compiler crashes with int-to-string conversion with
large integer constant operand. CL 179777 is the fix. This CL
adds a test.

Updates #32347.

Change-Id: Id1d9dbbcdd3addca4636f1b9c5fdbc450cc48c1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/179797
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-31 19:57:27 +00:00
Than McIntosh
4c05525f0e cmd/link: revise test case to work on pre-10.14 macos
Rework this recently introduced test case to insure that it works with
older versions of the OS. It was using a new framework library not
available on pre-10.14 to trigger the weak symbol reference; switch to
using a new symbol from an existing library. Tested on MacOS 10.14 and
10.11.

Updates #32233.

Change-Id: I1fe2a9255fca46cb7cdf33ff7fed67bba86fdc22
Reviewed-on: https://go-review.googlesource.com/c/go/+/179837
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-05-31 19:51:40 +00:00
LE Manh Cuong
9e31b1775a cmd/go: use the rev to resolve tags for pseudo-versions in mod init
Fixes #32161
Updates #31251

Change-Id: I22760836b48cd734b90bc43aacb23e23e38c0f4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/178497
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-05-31 19:46:50 +00:00
Andrew Gerrand
2165452a37 strconv: document handling of NaN and ±Inf
In addition to the example that was added in 203b80ab, mention these
special cases in the doc comment. This change also adjusts the example
to include "+Inf", as it was not otherwise mentioned that the plus
symbol may be present.

Fix #30990

Change-Id: I97d66f4aff6a17a6ccc0ee2e7f32e39ae91ae454
Reviewed-on: https://go-review.googlesource.com/c/go/+/179738
Reviewed-by: Alex Miasoedov <msoedov@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-31 11:26:23 +00:00
Ian Lance Taylor
d53f380e62 misc/cgo/errors: limit number of parallel executions
Fixes #32328

Change-Id: Iee71ecb247f2c439804c2ff03a6ed7b7f5a8b562
Reviewed-on: https://go-review.googlesource.com/c/go/+/179603
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-31 00:51:48 +00:00
Ian Lance Taylor
9e2299207a misc/cgo/errors: remove debugging println
Change-Id: I0c7da31e94307f939e1a2f023e00d5b24bac0ea6
Reviewed-on: https://go-review.googlesource.com/c/go/+/179604
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-30 22:55:48 +00:00
Ian Lance Taylor
3cee55057f os: deflake TestNewFileNonBlock
Fixes #32325

Change-Id: Ic06938c36a25ef1a6623e35e128b73729d02d955
Reviewed-on: https://go-review.googlesource.com/c/go/+/179698
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-30 22:39:04 +00:00
Brad Fitzpatrick
ba66d89d78 net/http: prevent Transport from spamming stderr on server 408 reply
HTTP 408 responses now exist and are seen in the wild (e.g. from
Google's GFE), so make Go's HTTP client not spam about them when seen.
They're normal (now).

Fixes #32310

Change-Id: I558eb4654960c74cf20db1902ccaae13d03310f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/179457
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-05-30 22:29:29 +00:00
Greg Thelen
103b5b6692 syscall: use Ctty before fd shuffle
On unix if exec.Command() is given both ExtraFiles and Ctty, and the
Ctty file descriptor overlaps the range of FDs intended for the child,
then cmd.Start() the ioctl(fd,TIOCSCTTY) call fails with an
"inappropriate ioctl for device" error.

When child file descriptors overlap the new child's ctty the ctty will
be closed in the fd shuffle before the TIOCSCTTY.  Thus TIOCSCTTY is
used on one of the ExtraFiles rather than the intended Ctty file.  Thus
the error.

exec.Command() callers can workaround this by ensuring the Ctty fd is
larger than any ExtraFiles destined for the child.

Fix this by doing the ctty ioctl before the fd shuffle.

Test for this issue by modifying TestTerminalSignal to use more
ExtraFiles.  The test fails on linux and freebsd without this change's
syscall/*.go changes.  Other platforms (e.g. darwin, aix, solaris) have
the same fd shuffle logic, so the same fix is applied to them.  However,
I was only able to test on linux (32 and 64 bit) and freebsd (64 bit).

Manual runs of the test in https://golang.org/issue/29458 start passing
with this patch:
  Before:
    % /tmp/src/go/bin/go run t
    successfully ran child process with ParentExtraFileFdNum=5, ChildExtraFileFd=6, ParentPtyFd=7

    panic: failed to run child process with ParentExtraFileFdNum=10, ChildExtraFileFd=11, ParentPtyFd=11: fork/exec /bin/true: inappropriate ioctl for device

  After:
    % /tmp/src/go/bin/go run t
    successfully ran child process with ParentExtraFileFdNum=5, ChildExtraFileFd=6, ParentPtyFd=7

    successfully ran child process with ParentExtraFileFdNum=10, ChildExtraFileFd=11, ParentPtyFd=11

Fixes #29458
Change-Id: I99513de7b6073c7eb855f1eeb4d1f9dc0454ef8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/178919
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-30 22:02:03 +00:00
Jay Conrod
a53b465572 cmd/go: clarify documentation for 'go get -u'
Also: add a comment in internal/get.newUpgrader as a follow-up to
CL 177677.

Updates #26902

Change-Id: Ibce2807ecb44fa21697ca04a51c44ddca0f661d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/176902
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-30 21:42:16 +00:00
Jay Conrod
545cd82734 cmd/go: remove support for the 'go get -m' flag
Fixes #32038

Change-Id: Ib4981f76572405363f404ee5038a45cb1752a2ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/177879
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-05-30 20:12:03 +00:00
Than McIntosh
8ca524ab20 cmd/link: new test case for Darwin/DWARF
Test case for issue 32233.

Updates #32233.

Change-Id: I0e3b4a46832f39de4ef36d8fd8c6070bf9b1a019
Reviewed-on: https://go-review.googlesource.com/c/go/+/178726
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-30 19:12:55 +00:00
Constantin Konstantinidis
7e05e97445 cmd/go: fix error message for go mod in GOPATH mode
Checks if modules are enabled in GOPATH mode for go mod [graph, verify].
Added tests for GO111MODULE=[auto, off].

Fixes: #31237

Change-Id: I91efccfa10d0b2385ec2af1ea133deaa8234ba37
Reviewed-on: https://go-review.googlesource.com/c/go/+/174697
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-05-30 19:02:47 +00:00
Johan Brandhorst
220552f662 net/http: enable WASM fetch where supported
The existing check was introduced to allow tests to pass
on WASM without an environment where the fetch RoundTripper
could run. However, the check now prohibits the use of the
Fetch RoundTripper in all WASM tests, even where the
RoundTripper could run. The new change should only disable
the RoundTripper when used in an environment without fetch.

Fixes #32289

Change-Id: I30d2e0dbcb0e64d4b1a46b583f7e984c2a57d5e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/179118
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-30 17:59:57 +00:00
Daniel Martí
16796afc35 cmd/go: add two more uses of lazyregexp
A couple of regexp.MustCompile globals have made their way in since we
introduced this package for cmd/go.

Convert the declarations. It's just two of them, so the cmd/go exec
benchmark isn't affected noticeably.

Change-Id: Ibd0615c99b6a049124a952c59978fd714c1b9615
Reviewed-on: https://go-review.googlesource.com/c/go/+/179358
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-30 15:38:43 +00:00
Aman Gupta
2ae793ed48 cmd/link/internal/ld: ensure mach-o debug symbols are visible to App Store
Passing test that shows Apple's symbols utility can now read
DWARF data in go.o, after the fix in CL174538

Updates #31022 #22716 #31459

Change-Id: I56c3517ad6d0a9f39537182f63cef56bb198aa83
Reviewed-on: https://go-review.googlesource.com/c/go/+/170451
Reviewed-by: Than McIntosh <thanm@google.com>
2019-05-30 12:01:18 +00:00
Aman Gupta
a0c96a9261 cmd/link/internal/ld: improve messages for testDWARF failures
Change-Id: I60af7a6477d1b25c43b311246ae4a79bf691460e
Reviewed-on: https://go-review.googlesource.com/c/go/+/171819
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-30 12:00:59 +00:00
Tobias Klauser
056d360f0f vendor: update golang.org/x/sys for aix/ppc64 fix
This pulls in CL 179317 which fixes the build on aix/ppc64.

Change-Id: I7d90950800627904503db97cfb0bc670a45b701e
Reviewed-on: https://go-review.googlesource.com/c/go/+/179357
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-30 10:48:44 +00:00
Matthew Dempsky
cd24849e8b cmd/compile: fix fmt_test.go after CL 170062
Updates #22326.

Change-Id: Ia9173b6eb29b2a4f90f4ba39bf53b6e9b7a6d6bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/179398
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-29 22:00:19 +00:00
Matthew Dempsky
913d290402 cmd/compile: sort OAS2* declarations
Change-Id: Idd3acf5f808705c608cd4e5877bc93e1626d9a58
Reviewed-on: https://go-review.googlesource.com/c/go/+/179238
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-05-29 21:31:37 +00:00
Matthew Dempsky
5d0d87ae16 cmd/compile: fix package initialization ordering
This CL rewrites cmd/compile's package-level initialization ordering
algorithm to be compliant with the Go spec. See documentation in
initorder.go for details.

Incidentally, this CL also improves fidelity of initialization loop
diagnostics by including referenced functions in the emitted output
like go/types does.

Fixes #22326.

Change-Id: I7c9ac47ff563df4d4f700cf6195387a0f372cc7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/170062
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-05-29 20:29:04 +00:00
Jason A. Donenfeld
e883d000f4 cmd/link: do not generate NT 4 compatibility binaries
Incredibly, the subsystem version numbers in the PE header influence how
win32k handles various syscalls. The first time a win32k syscall is
invoked and the kernel upgrades the thread object to a tagTHREADINFO
with all of the lovely undocumented UI members and such, it sets the
dwExpWinVer member (offset 624 in Windows 10 build 1809) to the result
of RtlGetExpWinVer(PsGetProcessSectionBaseAddress(proc)).
RtlGetExpWinVer, also undocumented, then calls into the undocumented
RtlImageNtHeader function, which returns a fortunately documented
IMAGE_NT_HEADERS structure. It uses the subsystem members in there to
set the dwExpWinVer member of our newly minted tagTHREADINFO object.
Later, functions like SendInput consult this to vary their behaviors and
return values. In fact, littered through out win32k are checks like `if
(gsti->dwExpWinVer >= 0x501) { ... }`.

I don't think Go ever supported NT 4.0. These days the minimum version
is Windows 7, which is 6.1. So, let's set the version numbers in the PE
header at that, which should give us the behavior that MSDN advertises
for various functions, as opposed to bizarre archeological remnants.

Interestingly, I suspect that most people never noticed the brokenness,
because most people trying to do serious Win32 UI stuff wind up linking
in cgo, if not for actually using C, then just to have a larger system
stack so that the stack doesn't get corrupted by various UI functions.
When MingW is used, the PE header gets a later version. But recently
there's been a bug report of some people trying to do more modest UI
manipulation using SendInput in a setting where this cgo hack probably
isn't required, so they ran into the weird historical compatibility
stuff.

Fixes #31685

Change-Id: I54461ce820f6e9df349e37be5ecc5a44c04a3e26
Reviewed-on: https://go-review.googlesource.com/c/go/+/178977
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-29 13:27:00 +00:00
Russ Cox
e12efecfa7 cmd/go: update docs for GOPROXY default
The default is now "https://proxy.golang.org,direct" not just "https://proxy.golang.org"
(as of CL 178720).

Change-Id: I47e67602e994332b988ed1b75fa57319f3876cc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/178725
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-05-29 13:24:55 +00:00
Keith Randall
200176edd1 cmd/compile: add GCNode to VarDef in tests
Change-Id: I0f79d317ae7ac46c7e824bd382a4f51d53adaaa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/179257
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2019-05-29 01:10:13 +00:00
Brad Fitzpatrick
fa02af4238 src/vendor: update golang.org/x/sys to remove x/sys/unix dep
Fixes #32102

Change-Id: I3022104035a12bf31a7cd214aede58c024effc1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/179180
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-05-28 19:23:53 +00:00
Brad Fitzpatrick
770746af1c net/http: quiet some log spam in tests
One of these tests creates a bunch of connections concurrently, then
discovers it doesn't need them all, which then makes the server log
that the client went away midway through the TLS handshake. Perhaps
the server should recognize that as a case not worthy of logging
about, but this is a safer way to eliminate the stderr spam during go
test for now.

The other test's client gives up on its connection and closes it,
similarly confusing the server.

Change-Id: I49ce442c9a63fc437e58ca79f044aa76e8c317b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/179179
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-05-28 18:17:57 +00:00
Josh Bleecher Snyder
ddb5d0db37 cmd/compile: process blocks containing only dead values in fuseIf
The code in #29218 resulted in an If block containing only its control.
That block was then converted by fuseIf into a plain block;
as a result, that control value was dead.
However, the control value was still present in b.Values.
This prevented further fusing of that block.

This change beefs up the check in fuseIf to allow fusing
blocks that contain only dead values (if any).
In the case of #29218, this enables enough extra
fusing that the control value could be eliminated,
allowing all values in turn to be eliminated.

This change also fuses 34 new blocks during make.bash.

It is not clear that this fixes every variant of #29218,
but it is a reasonable standalone change.
And code like #29218 is rare and fundamentally buggy,
so we can handle new instances if/when they actually occur.

Fixes #29218

Negligible toolspeed impact.

name        old time/op       new time/op       delta
Template          213ms ± 3%        213ms ± 2%    ~     (p=0.914 n=97+88)
Unicode          89.8ms ± 2%       89.6ms ± 2%  -0.22%  (p=0.045 n=93+95)
GoTypes           712ms ± 3%        709ms ± 2%  -0.35%  (p=0.023 n=95+95)
Compiler          3.24s ± 2%        3.23s ± 2%  -0.30%  (p=0.020 n=98+97)
SSA               10.0s ± 1%        10.0s ± 1%    ~     (p=0.382 n=98+99)
Flate             135ms ± 3%        135ms ± 2%    ~     (p=0.983 n=98+98)
GoParser          158ms ± 2%        158ms ± 2%    ~     (p=0.170 n=99+99)
Reflect           447ms ± 3%        447ms ± 2%    ~     (p=0.538 n=98+89)
Tar               189ms ± 2%        189ms ± 3%    ~     (p=0.874 n=95+96)
XML               251ms ± 2%        251ms ± 2%    ~     (p=0.434 n=94+96)
[Geo mean]        427ms             426ms       -0.15%

name        old user-time/op  new user-time/op  delta
Template          264ms ± 2%        265ms ± 2%    ~     (p=0.075 n=96+90)
Unicode           119ms ± 6%        119ms ± 7%    ~     (p=0.864 n=99+98)
GoTypes           926ms ± 2%        924ms ± 2%    ~     (p=0.071 n=94+94)
Compiler          4.38s ± 2%        4.37s ± 2%  -0.34%  (p=0.001 n=98+97)
SSA               13.4s ± 1%        13.4s ± 1%    ~     (p=0.693 n=90+93)
Flate             162ms ± 3%        161ms ± 2%    ~     (p=0.163 n=99+99)
GoParser          186ms ± 2%        186ms ± 3%    ~     (p=0.130 n=96+100)
Reflect           572ms ± 3%        572ms ± 2%    ~     (p=0.608 n=97+97)
Tar               239ms ± 2%        239ms ± 3%    ~     (p=0.999 n=93+91)
XML               302ms ± 2%        302ms ± 2%    ~     (p=0.627 n=91+97)
[Geo mean]        540ms             540ms       -0.08%

file    before    after     Δ       %       
asm     4862704   4858608   -4096   -0.084% 
compile 24001568  24001680  +112    +0.000% 
total   132520780 132516796 -3984   -0.003% 

file                       before    after     Δ       %       
cmd/compile/internal/gc.a  8887638   8887596   -42     -0.000% 
cmd/compile/internal/ssa.a 29995056  29998986  +3930   +0.013% 
cmd/internal/obj/wasm.a    209444    203652    -5792   -2.765% 
total                      129471798 129469894 -1904   -0.001% 

Change-Id: I2d18f9278e68b9766058ae8ca621e844f9d89dd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/177140
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2019-05-28 17:13:46 +00:00
Dmitri Shuralyov
bd61fc3da3 testing/internal/testdeps: delete didSetLogger variable
It was added in CL 83956 but never used.

Updates #23129

Change-Id: I70b50e974a56620069a77658386722af314cc857
Reviewed-on: https://go-review.googlesource.com/c/go/+/179138
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-28 16:07:50 +00:00
Maxim Eryomenko
0f897f916a bytes: remove obsolete comment
Change-Id: Iec4348eb674c8c64497c82e5d7cd656736cfcebd
GitHub-Last-Rev: 462c323960
GitHub-Pull-Request: golang/go#32225
Reviewed-on: https://go-review.googlesource.com/c/go/+/178797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-28 02:52:39 +00:00
Brad Fitzpatrick
3970667d95 net/http: fix TestTransportServerClosingUnexpectedly flake
Fixes #32119

Change-Id: I8cf2e2e69737e2485568af91ab75149f3cf66781
Reviewed-on: https://go-review.googlesource.com/c/go/+/178918
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-28 00:54:10 +00:00
Rob Pike
f736de04aa cmd/doc: always print package clause except for commands
There was an implicit heuristic before about when to print the
package clause or omit it, but it was undocumented and confusing.
Get rid of it and print it always unless asking for the package
docs for a command, which are more of a usage message than a
programming question. This simplifies the processing.

There are several paths to the output, so to put the fix in one
place we place a wrapper before the output buffer than adds the
clause when Write is first called.

The tests don't verify this behavior, but they didn't before either.
Unsure what the right approach is but this will do for now.

Fixes #31457

Change-Id: Ia6a9e740d556f45265c55f06b5306621c7a40ea9
Reviewed-on: https://go-review.googlesource.com/c/go/+/177797
Reviewed-by: Russ Cox <rsc@golang.org>
2019-05-28 00:28:05 +00:00
Ian Lance Taylor
1531192272 runtime: remove VDSO fallback test and benchmarks
These tests assume that it is OK to switch between time implementations,
but the clock_gettime call uses CLOCK_MONOTONIC and the fallback call,
gettimeofday, uses CLOCK_REALTIME. Disabling the clock_gettime call means
that calls to nanotime will start returning very different values.
This breaks the new timer code, which assumes that nanotime will return
a consistently increasing value.

This test is not very useful in any case as it doesn't check the results.

Removing this file also removes BenchmarkTimeNow, which is a duplicate
of BenchmarkNow in the time package.

Updates #27707
Fixes #32109

Change-Id: I6a884af07f75822d724193c5eed94742f524f07d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174679
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-27 17:58:39 +00:00
Agniva De Sarker
d97bd5d07a cmd/doc: display a proper error when no packages are found
Fixes #32044

Change-Id: Ia220dbbe4d6851befe28dd2d4b8a1a7bc2757460
Reviewed-on: https://go-review.googlesource.com/c/go/+/178878
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-05-25 22:38:01 +00:00
Than McIntosh
a3863fc18a cmd/link: fix incorrect constant for macho-o load command
The constant defined in macho.go for LC_LOAD_WEAK_DYLIB was
not correct, was 0x18 should have been 0x80000018. Switch
to the correct definition.

Fixes #32233.

Change-Id: I9fb660a3cfd5e8c451a64947258f7ead76d98c79
Reviewed-on: https://go-review.googlesource.com/c/go/+/178723
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2019-05-25 12:54:34 +00:00
Russ Cox
385b2e0cac cmd/go: respect default proxy setting, add direct fallback
Getenv("GOPROXY") says what the environment variable is
(including looking in the go env file), but it doesn't include
the default setting. This code needs to use cfg.GOPROXY
to get the actual default. Fix and test that.

Also, we forgot to include the fallback to direct for when
the proxy serves a 404. Add and test that too.

Also add HTTP fetch information to -x build flag output.
(It does not belong in the -v output, despite the GOPATH go get
command doing this.)

Change-Id: Ieab7ef13cda3e1ad041dbe04921af206e2232c9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/178720
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2019-05-24 21:34:53 +00:00