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

41239 Commits

Author SHA1 Message Date
David Finkel
0ca4f6be35 runtime/pprof: Mention goroutine label heritability
Document goroutine label inheritance. Goroutine labels are copied upon
goroutine creation and there is a test enforcing this, but it was not
mentioned in the docstrings for `Do` or `SetGoroutineLabels`.

Add notes to both of those functions' docstrings so it's clear that one
does not need to set labels as soon as a new goroutine is spawned if
they want to propagate tags.

Updates #32223
Updates #23458

Change-Id: Idfa33031af0104b884b03ca855ac82b98500c8b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/189317
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-07 14:40:17 +00:00
Jay Conrod
e37a1b1ca6 cmd/go: improve error message for missing import starting with cmd/
In modload.Import, confirm that the import path does not start with
"cmd/" before calling QueryPackage, which returns a less helpful
error.

In load.loadPackageData, don't wrap errors with "unknown import path".
The wrapped error should always include the import path, and it's also
repeated in the PackageError wrapper.

Fixes #31031

Change-Id: I071efa22e3842c62831d096f888a8006811fe724
Reviewed-on: https://go-review.googlesource.com/c/go/+/189157
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-08-06 23:05:55 +00:00
Marcel van Lohuizen
0ed86cda67 doc: mention Unicode update in release notes
Fixes #33472

Change-Id: Iab69e69589f2e017f4cf9770858884b1a570c89e
Reviewed-on: https://go-review.googlesource.com/c/go/+/188799
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-08-06 19:12:41 +00:00
Jay Conrod
46f99ce7ea cmd/go: look for __go_buildinfo section when looking for Mach-O version
This mirrors the ELF fix in CL 188957. TestScript/version failed on
darwin after that change.

Fixes #31861

Change-Id: I4ce953ebec8dd5fa47e26d373c59d7e290b75a34
Reviewed-on: https://go-review.googlesource.com/c/go/+/189159
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-06 18:00:31 +00:00
Bharath Thiruveedula
8e82624e69 net: fix the docs in IPNet.String
Fixes #33433
Change-Id: Idb3961685a3cfd13ba26155a1d64fc24cc418fdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/189117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-06 15:09:26 +00:00
Jonathan Amsterdam
546ea78efa errors: improve doc
Explain wrapping and how to use Is and As in the package doc.

Explain "chain" in Is and As.

Updates #33364.

Change-Id: Ic06362106dbd129e33dd47e63176ee5355492086
Reviewed-on: https://go-review.googlesource.com/c/go/+/188737
Reviewed-by: Rob Pike <r@golang.org>
2019-08-06 11:13:05 +00:00
Jonathan Amsterdam
a4c825156d doc/go1.13.html: describe error-value additions
A brief description at the top the Standard Library section of the
changes to support error wrapping.

Fixes #33365.

Change-Id: Id5a3b2fe148d9bfb949f2cfc9e5d8a1613a0e219
Reviewed-on: https://go-review.googlesource.com/c/go/+/188798
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-05 23:12:39 +00:00
Keith Randall
d1338ec30e syscall: include complete prototype of system calls
The prototypes were truncated because they were on multiple lines
of the source file.

Copied from the STD lines for these functions in
https://svn.freebsd.org/base/stable/12/sys/kern/syscalls.master

Change-Id: I618a5444f1353aabee2758c06f86ad726185d19c
Reviewed-on: https://go-review.googlesource.com/c/go/+/188077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-08-05 19:01:06 +00:00
Bryan C. Mills
6e11d81b4d cmd/go: adjust expected error message in TestScript/mod_invalid_version
CL 188817 improved the error message for a nonexistent version in a dependency.
This CL locks in that improvement in a regression test.

Fixes #33474

Change-Id: I6246b4995adee966f24eaebe491d35830aea8370
Reviewed-on: https://go-review.googlesource.com/c/go/+/188977
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-08-05 16:54:43 +00:00
Mark Glines
6c74db4024 cmd/go: look for .go.buildinfo section when looking for ELF version
Based on original fix from Mark Glines in golang.org/cl/186737

Fixes #31861

Change-Id: Ibd583a3aa8f8b8eefade998aa2ac757b55140937
Reviewed-on: https://go-review.googlesource.com/c/go/+/188957
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-05 16:26:27 +00:00
Shivani Singhal
09c9d3a58a net/http: fix typo in Response.Body's doc
Fixes #33453.

Change-Id: If0aa48f953633690884ddcff033b3be6d1d66443
Reviewed-on: https://go-review.googlesource.com/c/go/+/188541
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-08-05 05:44:06 +00:00
Agniva De Sarker
a2f5d644d3 doc/go1.13: add release notes for GOWASM environment variable
Change-Id: I103a21ae0be8feb9447fa277483b7c2a8b5807e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/188540
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2019-08-03 08:47:32 +00:00
Ian Lance Taylor
fc821667dd os: change Readdirnames doc to follow that of Readdir
The two methods act the same, so make their documentation similar so
that people don't think they act differently.

Change-Id: If224692ef50870faf855d789380a614d1e724132
Reviewed-on: https://go-review.googlesource.com/c/go/+/188137
Reviewed-by: Rob Pike <r@golang.org>
2019-08-02 21:52:01 +00:00
Damien Neil
d178c5888f os: don't consult Is methods on non-syscall error types
CL #163058 moves interpretation of platform-specific errors to the
syscall package. Package syscall errors implement an Is method which
os.IsPermission etc. consult. This results in an unintended semantic
change to the os package predicate functions: The following program
now prints 'true' where it used to print 'false':

	package main
	import "os"
	type myError struct{ error }
	func (e myError) Is(target error) bool { return target == os.ErrPermission }
	func main() { println(os.IsPermission(myError{})) }

Change the os package error predicate functions to only examine syscall
errors, avoiding this semantic change.

This CL does retain one minor semantic change: On Plan9, os.IsPermission
used to return true for any error with text containing the string
"permission denied". It now only returns true for a syscall.ErrorString
containing that text.

Change-Id: I6b512b1de6ced46c2f1cc8d264fa2495ae7bf9f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/188817
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2019-08-02 21:09:50 +00:00
Ian Lance Taylor
55e23cb1fe doc/go1.13: mention confusion between keep-alive timeout and deadline
Updates #31449

Change-Id: I4d7075b20cd8171bc792e40b388f4215264a3317
Reviewed-on: https://go-review.googlesource.com/c/go/+/188819
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-08-02 21:03:47 +00:00
Bryan C. Mills
07b3e629ce cmd/go: report loading errors from 'go mod tidy' and 'go mod vendor'
Fixes #27063

Change-Id: Iedd14fd614a3d79d1387b923a0f123c2bc9e0b33
Reviewed-on: https://go-review.googlesource.com/c/go/+/188763
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-02 20:48:58 +00:00
Keith Randall
316ac4f330 cmd/compile: fix crash on write barrier insertion
The compiler can crash if the compiled code tries to
unconditionally read from a nil pointer. This should cause
the generated binary to panic, not the compiler.

Fixes #33438

Change-Id: Ic8fa89646d6968e2cc4e27da0ad9286662f8bc49
Reviewed-on: https://go-review.googlesource.com/c/go/+/188760
Reviewed-by: Austin Clements <austin@google.com>
2019-08-02 19:35:37 +00:00
Emmanuel T Odeke
bdea352b96 doc/go1.13: document net/http.Transport.Request.Body unfurling
Documents the work from:
* CL 163599
* CL 163737

which now uses the Request.Body's io.ReaderFrom implementation,
if available, and permits system level optimizations such as
"sendfile" to be used to transmit/upload the Body, which greatly
speeds up file uploads.

Updates #33396

Change-Id: I7b8315c4b3e57ad47bb9be2b0c838857875d4bd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/188457
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-08-02 17:58:08 +00:00
Damien Neil
0e54d28ff7 all: remove os.ErrTimeout
It is unclear whether the current definition of os.IsTimeout is
desirable or not. Drop ErrTimeout for now so we can consider adding it
(or some other error) in a future release with a corrected definition.

Fixes #33411

Change-Id: I8b880da7d22afc343a08339eb5f0efd1075ecafe
Reviewed-on: https://go-review.googlesource.com/c/go/+/188758
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-02 17:57:18 +00:00
Alberto Donizetti
2d1a1e0a2a doc: fix Block interface parameters order
The Effective Go document references the crypto/cipher Block
interface, but the parameters' names are swapped. This change
alignes them to the crypto definition, to avoid confusion.

Fixes #33432

Change-Id: I8b9aac4dc6af3eec968bbc8f3ee5366b99016fcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/188797
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-02 17:51:34 +00:00
Baokun Lee
2d6ee6e89a os: enable the close-on-exec flag for openFdAt
There's a race here with fork/exec, enable the close-on-exec flag
for the new file descriptor.

Fixes #33405

Change-Id: If95bae97a52b7026a930bb3427e47bae3b0032ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/188537
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-08-01 20:37:08 +00:00
Darren McCleary
e7c51cad71 net/http: fix a typo in spelling of MultiPartForm
Change-Id: I33a5313ef10e8c88d9c12507573b385fa0843afe
GitHub-Last-Rev: 844d435158
GitHub-Pull-Request: golang/go#33412
Reviewed-on: https://go-review.googlesource.com/c/go/+/188498
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-08-01 20:35:26 +00:00
Emmanuel T Odeke
d6f6a46c07 doc/go1.13: add more release notes for net/http
Fixes #33396

Change-Id: Id975a23b8d6555a3f19ef283fccbbe122f10acfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/188477
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-08-01 20:32:27 +00:00
Damien Neil
ea8b0acdac all: remove os.ErrTemporary
As discussed in
https://github.com/golang/go/issues/32463#issuecomment-506833421
the classification of deadline-based timeouts as "temporary" errors is a
historical accident. I/O timeouts used to be duration-based, so they
really were temporary--retrying a timed-out operation could succeed. Now
that they're deadline-based, timeouts aren't temporary unless you reset
the deadline.

Drop ErrTemporary from Go 1.13, since its definition is wrong. We'll
consider putting it back in Go 1.14 with a clear definition and
deprecate net.OpError.Temporary.

Fixes #32463

Change-Id: I70cda664590d8872541e17409a5780da76920891
Reviewed-on: https://go-review.googlesource.com/c/go/+/188398
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2019-08-01 15:39:45 +00:00
Keith Randall
8a317ebc0f cmd/compile: don't eliminate all registers when restricting to desired ones
We shouldn't mask to desired registers if we haven't masked out all the
forbidden registers yet.  In this path we haven't masked out the nospill
registers yet. If the resulting mask contains only nospill registers, then
allocReg fails.

This can only happen on resultNotInArgs-marked instructions, which exist
only on the ARM64, MIPS, MIPS64, and PPC64 ports.

Maybe there's a better way to handle resultNotInArgs instructions.
But for 1.13, this is a low-risk fix.

Fixes #33355

Change-Id: I1082f78f798d1371bde65c58cc265540480e4fa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/188178
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-08-01 02:15:18 +00:00
Ian Lance Taylor
407010ef0b cmd/go: only pass -fsplit-stack to gccgo if supported
Also add other gccgo options.

This ports CL 45695 and CL 48592 from the gofrontend repo to the gc repo.

CL 45695 (partial entry, other parts out of date and not ported):

    cmd/go: gccgo: consistent results

    Pass the -fdebug-prefix-map and -gno-record-gcc-switches compiler
    options to gccgo to generate consistent results.

CL 48592:

    cmd/go: use gccSupportsFlag for -fsplit-stack

    Don't assume that all (or only) 386/amd64 compilers support
    -fsplit-stack.

Fixes #33108

Change-Id: I61f9e5a67e4fb059f26750e97621d27afa566ec2
Reviewed-on: https://go-review.googlesource.com/c/go/+/187824
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-07-31 23:53:23 +00:00
Eli Bendersky
e81b731592 encoding/json: clarify Marshal behavior for string keys of maps
This is a documentation-only change.

Fixes #28827

Change-Id: Ife9ab997809048784f35872b09905bc209a05eff
Reviewed-on: https://go-review.googlesource.com/c/go/+/188417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-31 21:49:08 +00:00
Andrew Bonventre
fe8a866464 doc/go1.12: document change in syscall.Setrlimit behavior
Fixes #30401

Change-Id: I7b5035ffc7333c746d4e31563df26ff4f934dfc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/188237
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-07-31 16:43:10 +00:00
Andrew Bonventre
8dddf7556e net/http: return nil from Header.Clone if the receiver is nil
Fixes #33141

Change-Id: I84a8b3496fc9396fd1c09ba9505697c34bdf7105
Reviewed-on: https://go-review.googlesource.com/c/go/+/188022
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-07-31 16:15:56 +00:00
Robert Griesemer
39d4178735 spec: add an example of a trivially invalid interface
In preparation for the forthcoming spec changes for #6977.
While at it, modernize existing File example that dates
back all the way to commit 18c5b488a3.

Change-Id: Id10e4df0513e3de15bd58867222923eefa9473ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/187978
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-31 05:45:43 +00:00
David Ndungu
1ad64fafc8 net/http: improve Request.Form and Request.PostForm documentation
Request.PostForm gets populated with form data for PATCH, POST, or PUT
http verbs.

Change-Id: I33065aa78a8470c4e9490aac830aa6f5963c61cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/187821
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-07-30 20:49:54 +00:00
Bryan C. Mills
5f8d8161e6 cmd/go/internal/cache: verify that timestamp is positive
An apparent typo caused us to re-check size instead.

Updates #29667

Change-Id: Icc1fb9cef1ba77b8490c8fbe6c343be06ff48d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/188020
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-07-30 20:16:45 +00:00
Bryan C. Mills
2fc7574aab cmd/go/internal/cache: avoid ioutil.WriteFile for writing cache entries
ioutil.WriteFile always truncates the destination file to 0 before
writing, which is inappropriate for unsynchronized, idempotent,
fixed-size files such as the cache entry files here.

Instead, truncate the file only after writing it, so that a second
write will never (even temporarily!) remove the contents of a
preceding write.

Fixes #29667

Change-Id: I16a53ce79d8a23d23580511cb6abd062f54b65ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/188157
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-07-30 20:16:40 +00:00
Michael Knyszek
8c3040d768 runtime: call sysHugePage less often
Currently when we coalesce memory we make a sysHugePage call
(MADV_HUGEPAGE) to ensure freed and coalesced huge pages are treated as
such so the scavenger's assumptions about performance are more in line
with reality.

Unfortunately we do it way too often because we do it if there was any
change to the huge page count for the span we're coalescing into, not
taking into account that it could coalesce with its neighbors and not
actually create a new huge page.

This change makes it so that it only calls sysHugePage if the original
huge page counts between the span to be coalesced into and its neighbors
do not add up (i.e. a new huge page was created due to alignment). Calls
to sysHugePage will now happen much less frequently, as intended.

Updates #32828.

Change-Id: Ia175919cb79b730a658250425f97189e27d7fda3
Reviewed-on: https://go-review.googlesource.com/c/go/+/186926
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-07-30 18:53:01 +00:00
Michael Anthony Knyszek
a41ebe6e25 runtime: add physHugePageShift
This change adds physHugePageShift which is defined such that
1 << physHugePageShift == physHugePageSize. The purpose of this variable
is to avoid doing expensive divisions in key functions, such as
(*mspan).hugePages.

This change also does a sweep of any place we might do a division or mod
operation with physHugePageSize and turns it into bit shifts and other
bitwise operations.

Finally, this change adds a check to mallocinit which ensures that
physHugePageSize is always a power of two. osinit might choose to ignore
non-powers-of-two for the value and replace it with zero, but mallocinit
will fail if it's not a power of two (or zero). It also derives
physHugePageShift from physHugePageSize.

This change helps improve the performance of most applications because
of how often (*mspan).hugePages is called.

Updates #32828.

Change-Id: I1a6db113d52d563f59ae8fd4f0e130858859e68f
Reviewed-on: https://go-review.googlesource.com/c/go/+/186598
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-07-30 18:44:52 +00:00
Andrew Todd
fbb819ebc4 strings: clarify usage of Title and ToTitle
This is intended to help clear up confusion around the usage of the
Title and ToTitle functions. It includes a link to define title case
to distinguish it from upper case. It also includes an additional
example for the ToTitle function to showcase the difference in behavior
between it and the Title function.

Fixes #33302

Change-Id: I44e62962fb04d0d22966a39eda3a2d16de7a2291
Reviewed-on: https://go-review.googlesource.com/c/go/+/187825
Reviewed-by: Rob Pike <r@golang.org>
2019-07-30 02:52:57 +00:00
Keith Randall
01d137262a runtime: use uintptr instead of int32 for counting to next heap profile sample
Overflow of the comparison caused very large (>=1<<32) allocations to
sometimes not get sampled at all. Use uintptr so the comparison will
never overflow.

Fixes #33342

Tested on the example in 33342. I don't want to check a test in that
needs that much memory, however.

Change-Id: I51fe77a9117affed8094da93c0bc5f445ac2d3d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/188017
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-07-29 21:07:49 +00:00
Jonathan Amsterdam
7b8234b48f go1.13.html: release note for %w
Also, reorder packages so the list is in alphabetical order.

Fixes #32914.

Change-Id: Ifa504cb7e48df31ba6dc0e5756148430b59fa139
Reviewed-on: https://go-review.googlesource.com/c/go/+/187797
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-07-29 20:29:54 +00:00
Filippo Valsorda
5235501c05 crypto/x509: add Ed25519 to ExampleParsePKIXPublicKey
ParsePKIXPublicKey gained Ed25519 support in CL 175478.

Change-Id: I11ffe0a62743292367b3adb103956e61bad57cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/183243
Reviewed-by: Katie Hockman <katie@golang.org>
2019-07-29 16:52:01 +00:00
Dominik Honnef
c4ca60313e all: change some function documentation to be more idiomatic
Change-Id: I932de9bb061a8ba3332ef03207983e8b98d6f1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/187918
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-28 18:09:57 +00:00
Daniel Martí
a25c2878c7 doc: use <code> for a few file paths that didn't
Spotted while seeing CL 187818 in master.

Change-Id: Ic3f42558f6833fc35580b2b2a15f2c5aba5713c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/187822
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-27 23:29:18 +00:00
Giovanni Bajo
80f9d32438 doc: mention that GOPATH/bin should be in PATH
As noticed while mentoring at Gophercon, a common mistake for
beginners is that, after they install git-codereview, it's not
found by git because they haven't put GOPATH/bin in their
environment.

Change-Id: I885cee0f532a4069d1a17ea27365d54965ecca22
Reviewed-on: https://go-review.googlesource.com/c/go/+/187818
Reviewed-by: Katie Hockman <katie@golang.org>
2019-07-27 19:01:49 +00:00
Emmanuel T Odeke
919594830f os: document File's concurrent operation resource limits
Document that *os.File is subject to resource limits
for concurrent operations. We aren't documenting
a specific number of concurrent operations because that
number is OS/system dependent. This limit comes from:
    internal/poll/fd_mutex.go
where we use 20 bits to count locks.

Fixes #32544

Change-Id: I7d305d4aaba5b2dbc6f1ab8c447117fde5e31a66
Reviewed-on: https://go-review.googlesource.com/c/go/+/181841
Reviewed-by: Rob Pike <r@golang.org>
2019-07-23 23:42:43 +00:00
Jordi Martin
68e28998d7 cmd/go: keep "go help" in unknown topic suggestion
Fixed missing concatenation to build the suggested command.

Fixes #33153

Change-Id: I26c02f2966247aa07d1447b8ec1a2203046842dd
GitHub-Last-Rev: 9631abf1d0
GitHub-Pull-Request: golang/go#33245
Reviewed-on: https://go-review.googlesource.com/c/go/+/187217
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-23 20:39:43 +00:00
Than McIntosh
e8c7e639ea test: new testcase for gccgo compiler failure
Updates #33219

Change-Id: I1702d4c630bb891fcb8b59e775dd3f1673cd8640
Reviewed-on: https://go-review.googlesource.com/c/go/+/187057
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-23 12:39:03 +00:00
Ian Lance Taylor
707f3e8c61 cmd/go: mention GODEBUG in "go help environment"
Change-Id: Id2c07ccba7c514ec3a4bbd493edbc68ae5cd6250
Reviewed-on: https://go-review.googlesource.com/c/go/+/187157
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-07-23 00:37:29 +00:00
Bryan C. Mills
b9df8df70f doc/go1.13: mention the effect of testing.Init on package initialization
Fixes #31859

Change-Id: I228ed93f9466d1a22f8796964f5d2f056ab9b62f
Reviewed-on: https://go-review.googlesource.com/c/go/+/186818
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-07-22 21:43:31 +00:00
Bryan C. Mills
5e21032b3d Revert "cmd/go: move automatic testing.Init call into generated test code"
This reverts CL 176098.

Reason for revert: added complexity, but did not completely fix the
underlying problem. A complete solution would not be worth the
complexity, and as a partial solution this is probably not worth the
complexity either.

Updates #31859

Change-Id: Ifd34c292fd1b811c60afe3c339e5edd3f37190c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/186817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
2019-07-22 21:42:51 +00:00
Jay Conrod
f518a96e00 cmd/go: document go get @upgrade behavior in release notes
Fixes #33149

Change-Id: If9ff24fea6d087b4047a9f6e50f99f449f9b1c52
Reviewed-on: https://go-review.googlesource.com/c/go/+/186618
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-07-19 20:08:48 +00:00
Austin Clements
5b15510d96 runtime: align allocations harder in GODEBUG=sbrk=1 mode
Currently, GODEBUG=sbrk=1 mode aligns allocations by their type's
alignment. You would think this would be the right thing to do, but
because 64-bit fields are only 4-byte aligned right now (see #599),
this can cause a 64-bit field of an allocated object to be 4-byte
aligned, but not 8-byte aligned. If there is an atomic access to that
unaligned 64-bit field, it will crash.

This doesn't happen in normal allocation mode because the
size-segregated allocation and the current size classes will cause any
types larger than 8 bytes to be 8 byte aligned.

We fix this by making sbrk=1 mode use alignment based on the type's
size rather than its declared alignment. This matches how the tiny
allocator aligns allocations.

This was tested with

  GOARCH=386 GODEBUG=sbrk=1 go test sync/atomic

This crashes with an unaligned access before this change, and passes
with this change.

This should be reverted when/if we fix #599.

Fixes #33159.

Change-Id: Ifc52c72c6b99c5d370476685271baa43ad907565
Reviewed-on: https://go-review.googlesource.com/c/go/+/186919
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-07-19 15:04:08 +00:00