1
0
mirror of https://github.com/golang/go synced 2024-09-29 06:24:29 -06:00
Commit Graph

42425 Commits

Author SHA1 Message Date
Dmitri Shuralyov
bf26847240 doc: 2020 is the Year of the Gopher
Starting with 2014 (golang.org/cl/46660043), we have enjoyed 6
consecutive years of the gopher. Now, the slice¹ of gophers is
ready to make its way into the next decade, as 2020 is the new
Year of the Gopher.

¹ https://en.wikipedia.org/w/index.php?title=List_of_English_terms_of_venery,_by_animal&oldid=932675028#G

Change-Id: I5f9598dbedb373bd13021964193fa9e44c67693e
Reviewed-on: https://go-review.googlesource.com/c/go/+/213017
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-02 17:36:29 +00:00
Tobias Klauser
bbd25d26c0 internal/poll: use correct fcntl implementations
Use the libc fcntl (via syscall.fcntl) on aix and solaris like it is
already done for darwin.

For the syscall-based fcntl implementation use FcntlSyscall from
internal/syscall/unix in order to get fcntl64 on 32-bit Linux
systems.

On aix, fcntl with F_DUPFD_CLOEXEC is not supported. Thus, defined
F_DUPFD_CLOEXEC = 0 in the syscall package and check its value before
calling fcntl(fd, syscall.F_DUPFD_CLOEXEC, 0).

On js/wasm, fcntl is not supported thus let its implementation return
ENOSYS directly.

Updates #36211

Change-Id: I96a2ea79e5c4eed2fefd94d0aefd72c940825682
Reviewed-on: https://go-review.googlesource.com/c/go/+/212278
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-31 12:11:24 +00:00
Tobias Klauser
aa175a196d internal/syscall/unix: use libc based fcntl for IsNonblock on aix and solaris
On aix and solaris (like on darwin) use libc fcntl to implement
IsNonblock instead of Syscall(SYS_FCNTL, ...) which isn't supported.

Change-Id: I989b02aa0c90b7e2dae025572867dda277fef8be
Reviewed-on: https://go-review.googlesource.com/c/go/+/212600
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-30 20:44:00 +00:00
Josh Bleecher Snyder
53dede938b cmd/compile: fix typo in comment
Change-Id: I25fbd63f10ea9892589ad44cc45761926aff0648
Reviewed-on: https://go-review.googlesource.com/c/go/+/212841
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-30 19:26:27 +00:00
Tobias Klauser
4b4370066f syscall: use fcntl64 on 32-bit GNU/Linux systems
Use fcntl64Syscall in forkAndExecInChild1 to get fcntl64 on 32-bit Linux
systems.

Updates #36211

Change-Id: Id0e34359256beace970e72102fdace7a987ff2b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/212598
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-30 09:34:53 +00:00
Michael Anthony Knyszek
dcd3b2c173 runtime: check whether scavAddr is in inUse on scavengeOne fast path
This change makes it so that we check whether scavAddr is actually
mapped before trying to look at the summary for the fast path, since we
may segfault if that that part of the summary is not mapped in.
Previously this wasn't a problem because we would conservatively map
all memory for the summaries between the lowest mapped heap address and
the highest one.

This change also adds a test for this case.

Change-Id: I2b1d89b5e044dce81745964dfaba829f4becdc57
Reviewed-on: https://go-review.googlesource.com/c/go/+/212637
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-12-27 14:52:12 +00:00
Ian Lance Taylor
4f75717954 io: show ErrUnexpectedEOF in ExampleReadAtLeast
Fixes #36245

Change-Id: I10ce50b0cc28b15f4e7be85b8f12cf9d0e4fac96
Reviewed-on: https://go-review.googlesource.com/c/go/+/212404
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-12-27 06:01:32 +00:00
Ian Lance Taylor
2d6f8cc2cd doc/go1.14: mention increased number of EINTR errors
Updates #36281

Change-Id: I3c4487caaf47566212dc62322b2e884e695ea7f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/212657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-27 03:36:24 +00:00
Michael Anthony Knyszek
cd1b9c1d5a runtime: disable pageAlloc tests on OpenBSD in short mode
This change disables pageAlloc tests on OpenBSD in short mode because
pageAlloc holds relatively large virtual memory reservations and we make
two during the pageAlloc tests. The runtime may also be carrying one
such reservation making the virtual memory requirement for testing the
Go runtime three times as much as just running a Go binary.

This causes problems for folks who just want to build and test Go
(all.bash) on OpenBSD but either don't have machines with at least 4ish
GiB of RAM (per-process virtual memory limits are capped at some
constant factor times the amount of physical memory) or their
per-process virtual memory limits are low for other reasons.

Fixes #36210.

Change-Id: I8d89cfde448d4cd2fefff4ad6ffed90de63dd527
Reviewed-on: https://go-review.googlesource.com/c/go/+/212177
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-26 21:16:03 +00:00
Tobias Klauser
075c20cea8 internal/poll: use fcntl64 on 32-bit GNU/Linux systems
Use FcntlSyscall from internal/syscall/unix to get fcntl64 on 32-bit
Linux systems.

Updates #36211

Change-Id: If48a6e09606ca9f7f6e22f3e8dc9a25fb3ccaf65
Reviewed-on: https://go-review.googlesource.com/c/go/+/212537
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-26 13:53:31 +00:00
Ariel Mashraki
c170b14c2c doc/go1.14: change hash/maphash package link
Package name and documentation link were wrong.

Change-Id: I274906afc3cf7a3d88e3da76549cd6ab008fd0c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/212538
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-24 16:13:37 +00:00
Isfan Azhabil
2e320a240d net: fix typo in dns client unix test
Fix a typo DNS name, it should be [onion.vegetables.com](http://onion.vegetables.com/)

Change-Id: I4122a2305b8f5e774a834651e70c75b54e9386bd
GitHub-Last-Rev: 9907897944
GitHub-Pull-Request: golang/go#36270
Reviewed-on: https://go-review.googlesource.com/c/go/+/212410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-24 16:07:08 +00:00
Joel Sing
48ed1e6113 cmd/internal/obj/riscv: handle AGETCALLERPC
Updates #27532

Change-Id: Ib3e44ec524ed20bbfbbaf40df22cec335460f3ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/204629
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-12-24 04:59:06 +00:00
Joel Sing
24f08103d2 cmd/internal/obj/riscv: handle FEQ/FNEG/SEQZ/SNEZ
Based on riscv-go port.

Updates #27532

Change-Id: I5e7f45955e1dfdb9d09cc6a4e6f3ce81216d411d
Reviewed-on: https://go-review.googlesource.com/c/go/+/204628
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-12-24 03:50:29 +00:00
Joel Sing
7cab55dfd3 cmd/internal/obj/riscv: handle call, jmp and branch
Also provide REG_LR to more clearly define the link register.

Based on the riscv-go port.

Updates #27532

Change-Id: I0805f373682f93b3918a01c21d4ef34eb3817c75
Reviewed-on: https://go-review.googlesource.com/c/go/+/204627
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-24 03:42:15 +00:00
Ian Lance Taylor
372efbbf31 internal/syscall/unix: use fcntl64 on 32-bit GNU/Linux systems
Patch up runtime testing to use the libc fcntl function on Darwin,
which is what we should be doing anyhow. This is similar to how
we handle fcntl on AIX and Solaris.

Fixes #36211

Change-Id: I47ad87e11df043ce21496a0d59523dad28960f76
Reviewed-on: https://go-review.googlesource.com/c/go/+/212299
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-23 23:29:48 +00:00
Alberto Donizetti
26f8b7074b testing: document that benchmark logs are dumped to stdout
The doc for testing.T and testing.B said that both test and benchmark
logs are printed to stderr, but in reality that wasn't the case.

CL 24311 fixed the doc for T, this change fixes it for B.

Fixes #36257

Change-Id: I0ff77ff44608f60320a1565b371c81e96039e71c
Reviewed-on: https://go-review.googlesource.com/c/go/+/212457
Reviewed-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-23 20:42:35 +00:00
Austin Clements
4d5bb9c609 doc/go1.14: more runtime/compiler release notes
This is based on reading through every commit message to runtime and
cmd/{compile,link,internal,asm} since Go 1.13.

Change-Id: I253b1a70ed265f15180fa20c191ceeafa6612ac4
Reviewed-on: https://go-review.googlesource.com/c/go/+/211977
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-12-20 23:07:52 +00:00
Ian Lance Taylor
b234fdb5cd misc/cgo/test: tweak to pass with GCC 10
The test for issue 8945 was marked to only run on gccgo, but there was
no reason for that. It broke for gccgo using GCC 10, because GCC 10
defaults to -fno-common. Make the test run on gc, and split it into
test.go and testx.go to make it work with GCC 10.

The test for issue 9026 used two identical structs which GCC 10 turns
into the same type. The point of the test is not that the structs are
identical, but that they are handled in a particular order. So make
them different.

Updates #8945
Updates #9026

Change-Id: I000fb02f88f346cfbbe5dbefedd944a2c64e8d8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/211217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-12-20 20:12:18 +00:00
Dan Scales
21713f41d1 runtime: make sure BP is saved in nanotime1/walltime1, else frame pointer may not be preserved
nanotime1 and walltime1 do not preserve BP on linux amd64. Previously, this
did not cause a problem, because nanotime/walltime do preserve the BP. But now
with mid-stack inlining, nanotime/walltime are usually inlined, so BP is not
preserved. So, the BP is now wrong in any function after a call to
nanotime()/walltime() on amd64. That means the frame pointer on the stack can
be wrong for any further function call made after the nanotime() call (notably
runtime.main and various GC functions). [386 doesn't use framepointer.]

Fix is to set a frame size of 8 for nanotime1 and walltime1, which means the
standard prolog/epilog that saves/restore BP in the stack frame is added.

I noticed this while investigating issue 16638 (use frame pointers for
runtime.Callers). This change would needed for progress on that issue (which
doesn't have a high priority). Verified that this fix works/is useful for issue
16638.

Change-Id: I19e19ef2c1a517d737a34928baae034f2eb0b2c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/212079
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-20 19:01:41 +00:00
Bryan C. Mills
3f51350c70 cmd/go/internal/modfetch/codehost: replace a dubious call to semver.Max
The documentation for RecentTag indicates that it returns an actual
tag, not a canonicalized prefix+version blob equivalent to a tag,
so the canonicalization due to semver.Max seems like a bug here.

Fortunately, RecentTag is not currently ever actually used as a tag,
so the removal of metadata does not result in a user-facing bug.
Nonetheless, it may be a subtle source of confusion for maintainers
in the future.

Updates #32700

Change-Id: I525423c1c0c7ec7c36c09e53b180034474f74e5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/212202
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-20 15:34:39 +00:00
Bryan C. Mills
8257528591 cmd/go: diagnose missing replacement directories
I noticed the missing diagnostic when writing a regression test for #33795.

Change-Id: Ic3249436a6109d71f9ff720b7096f9b872f6a94b
Reviewed-on: https://go-review.googlesource.com/c/go/+/212201
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-20 15:33:31 +00:00
Bryan C. Mills
751aea8f19 cmd/go: avoid erroneous canonicalization when trying to resolve imports using replacements
Updates #32700
Fixes #33795

Change-Id: I16897a0a2f3aa2f0b0bf8cf8252f3f39eef2e7ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/212200
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-20 15:24:05 +00:00
Bryan C. Mills
5c6f42773c cmd/go: relax validation for replacements for gopkg.in paths
The 'go' command normally requires the 'go.mod' files for replacement
modules to have a major version compatible with the module they are
replacing.

However, prior to CL 206761, the 'go' command erroneously allowed
unversioned paths (which imply major version 0 or 1) to replace
'gopkg.in' paths with any major-version suffix.

An analysis of proxy.golang.org suggests that these replacements,
while uncommon, are not unheard-of. Rather than breaking the modules
that rely on them, we will continue to allow the erroneous replacement
paths for this particular pairing.

Updates #34254

Change-Id: Icb4e745981803edaa96060f17a8720a058219ab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/212105
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-19 22:16:18 +00:00
Jay Conrod
0f834bb77e cmd/go: in 'go list -m', print effective go.mod file
When the -modfile flag is in use (either explicitly or from GOFLAGS),
'go list -m' will now print the effective go.mod file for the main
module in the GoMod field in -f or -json output.

Fixes #36220
Updates #34506

Change-Id: I89c2ee40f20e07854bb37c6e4e13eeea0cce7b0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/212100
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-19 19:52:21 +00:00
Bryan C. Mills
a197c7bbf2 cmd/go/internal/clean: make 'go clean -testcache' a no-op if the cache directory is gone
Fixes #29100

Change-Id: I195191aad825266ab55d38addef9d662cfc72dff
Reviewed-on: https://go-review.googlesource.com/c/go/+/212099
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-19 17:22:29 +00:00
Daniel Martí
5481a97ab0 text/template: indirect interfaces before slicing
The recently added slice function used indirectInterface, but then
forgot to actually call reflect.Value.Slice on its result. Calling the
Slice method on the original Value without indirectInterface would
result in a panic, if our slice was indeed behind an interface.

Fix that, and add test cases for all three built-in functions that work
with slices.

Fixes #36199.

Change-Id: I9a18f4f604a3b29967eefeb573f8960000936b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/211877
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-12-19 13:52:09 +00:00
Ian Lance Taylor
ba66797392 reflect: record PkgPath of StructOf arguments
Fixes #36190
Fixes #36191

Change-Id: I1213ef37b6595af63dbe202a8ade65741caf1356
Reviewed-on: https://go-review.googlesource.com/c/go/+/212001
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-19 05:39:31 +00:00
Cherry Zhang
dcdee153cd runtime: use innermost frame's func name for async preemption check
We don't asynchronously preempt if we are in the runtime. We do
this by checking the function name. However, it failed to take
inlining into account. If a runtime function gets inlined into
a non-runtime function, it can be preempted, and bad things can
happen. One instance of this is dounlockOSThread inlined into
UnlockOSThread which is in turn inlined into a non-runtime
function.

Fix this by using the innermost frame's function name.

Change-Id: Ifa036ce1320700aaaefd829b4bee0d04d05c395d
Reviewed-on: https://go-review.googlesource.com/c/go/+/211978
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-12-18 21:02:58 +00:00
Austin Clements
87a546776b doc/go1.14: release notes for runtime and compiler
Change-Id: I9519659983de23f43ff0e05cffd336d8bc351400
Reviewed-on: https://go-review.googlesource.com/c/go/+/211758
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2019-12-18 19:09:23 +00:00
Gert Cuykens
d7b4428c1f cmd/doc: flag usage() inconsistency
Inconsistency between cmd/doc/main.go and cmd/go/internal/doc/doc.go

Fixes #34976

Change-Id: I429200f9305d473edb4505216bb4840ba92af818
Reviewed-on: https://go-review.googlesource.com/c/go/+/201857
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-18 17:57:19 +00:00
Bryan C. Mills
0377f06168 doc/go1.14: document changes to -mod=readonly and go.mod file maintenance
Fixes #36169

Change-Id: Ib9a53fdb0112635b53be38d6818834dd1775e70c
Reviewed-on: https://go-review.googlesource.com/c/go/+/211698
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-17 20:57:06 +00:00
Michael Matloob
4b21702fdc src/go/doc: in Examples, check for len of params.List, not nilness
This makes the check the same as the one in the tests vet check.
It's safer to check the number of arguments rather than for a nil
slice.

Change-Id: I8e04e9c612573f334770c1c4245238649656c6e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/211598
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-17 17:51:29 +00:00
Bryan C. Mills
a5bfd9da1d go/build: rename WorkingDir to Dir
Fixes #36168

Change-Id: If2b7368671e83657a3a74dd030e66e7c68bf2361
Reviewed-on: https://go-review.googlesource.com/c/go/+/211657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-17 14:59:30 +00:00
Oliver Powell
ba4593ac47 text/template: remove an incorrect comment and clarify docs for AddParseTree
The comment "If the name is the name of this template, overwrite this template."
is incorrect and should be "is not" instead. This comment is no longer
required once the docs are updated to mention this behaviour instead.

Fixes #34695

Change-Id: I773495b2194d7bb7619b13c1a28cbc76e8f69aac
Reviewed-on: https://go-review.googlesource.com/c/go/+/199139
Reviewed-by: Rob Pike <r@golang.org>
2019-12-17 11:10:58 +00:00
Ian Lance Taylor
001fe7f33f time: further clarifications to the (*Timer).Stop docs
Fixes #35627

Change-Id: I0c5fed46a69a9663e46a9414468ec610063ea05a
Reviewed-on: https://go-review.googlesource.com/c/go/+/207849
Reviewed-by: Rob Pike <r@golang.org>
2019-12-17 00:18:33 +00:00
Dmitri Shuralyov
f7f9866f34 doc: remove Go Security Policy page (moved to x/website)
This page has moved to the x/website repo in CL 211300 (commit
golang/website@3c8b7f99ca).
Remove the old copy in this repo since it's no longer used.

Updates #29206

Change-Id: I8b3396d9e42d1e7262a8cde9577962d33b215836
Reviewed-on: https://go-review.googlesource.com/c/go/+/211301
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-12-16 20:38:31 +00:00
Alexander Rakoczy
ae2bf169f6 api: promote next to go1.14
Change-Id: I14b1a21a8639b3241326e74ab6152673d5d71243
Reviewed-on: https://go-review.googlesource.com/c/go/+/211517
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-12-16 20:22:12 +00:00
Jason A. Donenfeld
056a3d1c6f runtime: do not use PowerRegisterSuspendResumeNotification on systems with "program time" timer
Systems where PowerRegisterSuspendResumeNotification returns ERROR_
FILE_NOT_FOUND are also systems where nanotime() is on "program time"
rather than "real time".  The chain for this is:

powrprof.dll!PowerRegisterSuspendResumeNotification ->
  umpdc.dll!PdcPortOpen ->
    ntdll.dll!ZwAlpcConnectPort("\\PdcPort") ->
      syscall -> ntoskrnl.exe!AlpcpConnectPort

Opening \\.\PdcPort fails with STATUS_OBJECT_NAME_NOT_FOUND when pdc.sys
hasn't been initialized. Pdc.sys also provides the various hooks for
sleep resumption events, which means if it's not loaded, then our "real
time" timer is actually on "program time". Finally STATUS_OBJECT_NAME_
NOT_FOUND is passed through RtlNtStatusToDosError, which returns ERROR_
FILE_NOT_FOUND. Therefore, in the case where the function returns ERROR_
FILE_NOT_FOUND, we don't mind, since the timer we're using will
correspond fine with the lack of sleep resumption notifications. This
applies, for example, to Docker users.

Fixes #35447
Fixes #35482

Change-Id: I9e1ce5bbc54b9da55ff7a3918b5da28112647eee
Reviewed-on: https://go-review.googlesource.com/c/go/+/208317
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-16 17:37:20 +00:00
Michael Matloob
499dc1c5d5 go/doc: ignore example functions with arguments
An Example function with arguments is not a valid example to be
run with go test. Don't return those functions from Examples. This
means that some functions that were previously showing up in
Examples will no longer show up. But those functions were not being
tested properly so the fact that they were showing up is misleading.

This fixes an issue where a confusing compiler error was showing
up when running go test on a file with an invalid example. While
that issue could have been fixed by returning an error, this is
more consistent with the behavior of go/doc.Examples, and the tests
checker in vet will catch this issue.

Fixes #35284

Change-Id: I2101a7d19f38522ef9c2e50967f9cfb30d28c730
Reviewed-on: https://go-review.googlesource.com/c/go/+/211357
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-16 17:34:59 +00:00
Fazlul Shahriar
a3dc6da6d6 os/exec: ignore hungup error while copying stdin on Plan 9
Fixes #35753

Change-Id: I38674c59c601785eb25b778dc25efdb92231dd9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/208223
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-15 15:34:17 +00:00
Alberto Donizetti
7d30af8e17 spec: reword claim about the grammar being regular
Since the word "regular" has a precise meaning in the context of
formal languages, the Introduction sentence claiming that Go's grammar
is "compact and regular" may mislead readers.

Reword it using Rob's suggestion.

Fixes #36037

Change-Id: I00c1a5714bdab8878d9a77b36d67dae67d63da0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/211277
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-12-13 20:41:04 +00:00
Jay Conrod
ad12ee3006 doc: fix missing closing tag in module documentation
Updates #33637

Change-Id: If262d1501cf73b404361f832a2e3e17aaa0db78b
Reviewed-on: https://go-review.googlesource.com/c/go/+/211299
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-12-13 17:30:07 +00:00
Cherry Zhang
1475b97090 runtime: fix off-by-1 error on address ranges
When growing the address ranges, the new length is the old length + 1.

Fixes #36113.

Change-Id: I1b425f78e473cfa3cbdfe6113e166663f41fc9f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/211157
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-12-13 17:18:15 +00:00
Filippo Valsorda
0497f911ac doc: remove expiration from PGP key in security.html
The key had expired earlier this year. Simply resigned it with no
expiration, so it maintains the same fingerprint.

Removed the encouragement to use PGP above the fold. We trust the
security of our mail system, so it's really only there for people that
want it.

Also removed the individual keys, as they were never used, and both Adam
and I have access to the security@golang.org key anyway.

Change-Id: Icc5ad6dfb4f0b52128a59a080b7f270b20d3c520
Reviewed-on: https://go-review.googlesource.com/c/go/+/211177
Reviewed-by: Katie Hockman <katie@golang.org>
2019-12-13 04:05:48 +00:00
Dan Scales
22d28a24c8 runtime: force segv for nil defer function to be in deferreturn()
If the defer function pointer is nil, force the seg fault to happen in deferreturn
rather than in jmpdefer. jmpdefer is used fairly infrequently now because most
functions have open-coded defers.

The open-coded defer implementation calls gentraceback() with a callback when
looking for the first open-coded defer frame. gentraceback() throws an error if it
is called with a callback on an LR architecture and jmpdefer is on the stack,
because the stack trace can be incorrect in that case - see issue #8153. So, we
want to make sure that we don't have a seg fault in jmpdefer.

Fixes #36050

Change-Id: Ie25e6f015d8eb170b40248dedeb26a37b7f9b38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/210978
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-12 19:23:45 +00:00
Brad Fitzpatrick
100bf440b9 net/http: fix some awkward wording in Request.WithContext docs
Change-Id: Ib37db42c7f1fd6aa55f70fd2d65d56bb2ae6d26a
Reviewed-on: https://go-review.googlesource.com/c/go/+/211098
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-12 17:47:19 +00:00
Bryan C. Mills
c39cd41e5e cmd/go: restore default vet analyzers for targets in GOROOT
This fixes a regression introduced in CL 209498,
found while investigating #32471.

Also fix $WORK replacement in cmd/go/internal/work.(*Builder).Showcmd
when b.WorkDir includes a backslash and appears in a quoted string.
That fix is needed in order to write a precise test that passes under Windows,
since Windows directories nearly always include backslashes.

Updates #35837

Change-Id: I5fddc5435d5d283a3e598989209d873b59b0a39c
Reviewed-on: https://go-review.googlesource.com/c/go/+/210937
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-12 13:32:03 +00:00
Bryan C. Mills
a15b5d3092 cmd/go: allow arguments to 'go test' and 'go vet' to duplicate or override flags from GOFLAGS
This is a minimal fix for Go 1.14, but this parsing logic is much too
complex and seems like it will cause more trouble going forward.

I intend to mail a followup change to refactor this logic for 1.15.

Updates #32471

Change-Id: I00ed07dcf3a23c9cd4ffa8cf764921fb5c18bcd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/210940
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-11 22:01:13 +00:00
Michael Anthony Knyszek
1b1fbb3192 runtime: use inUse ranges to map in summary memory only as needed
Prior to this change, if the heap was very discontiguous (such as in
TestArenaCollision) it's possible we could map a large amount of memory
as R/W and commit it. We would use only the start and end to track what
should be mapped, and we would extend that mapping as needed to
accomodate a potentially fragmented address space.

After this change, we only map exactly the part of the summary arrays
that we need by using the inUse ranges from the previous change. This
reduces the GCSys footprint of TestArenaCollision from 300 MiB to 18
MiB.

Because summaries are no longer mapped contiguously, this means the
scavenger can no longer iterate directly. This change also updates the
scavenger to borrow ranges out of inUse and iterate over only the
parts of the heap which are actually currently in use. This is both an
optimization and necessary for correctness.

Fixes #35514.

Change-Id: I96bf0c73ed0d2d89a00202ece7b9d089a53bac90
Reviewed-on: https://go-review.googlesource.com/c/go/+/207758
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-12-11 19:51:34 +00:00