1
0
mirror of https://github.com/golang/go synced 2024-10-01 13:28:37 -06:00
Commit Graph

36874 Commits

Author SHA1 Message Date
Constantin Konstantinidis
46076c3757 mime/multipart: return error from NextPart if boundary is empty
NewReader cannot return an error. This behaviour is kept.
NextPart returns EOF when boundary is empty.
RFC 2046 does not allow it. The fix is to return an error
on the call of NextPart.

Fixes #23170

Change-Id: I775afd3f93e8b56e6cb274bc5c9de362a18bcc3c
Reviewed-on: https://go-review.googlesource.com/118822
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 15:51:57 +00:00
Tobias Klauser
90559ab9f2 cmd/go: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code in alldocs.go

Change-Id: I03985de20363ba8e09a5a624a931090ec8d196e6
Reviewed-on: https://go-review.googlesource.com/118816
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 15:12:11 +00:00
Alberto Donizetti
70c3bf27de runtime/pprof: use testenv.GoToolPath in TestMapping
The TestMapping test invokes the go tool in an exec.Command by
directly hard-coding a "go" string for the command. This can cause
test failures on systems where the "go" command points to an old
toolchain where the test is not supposed to work.

Use testenv.GoToolPath instead.

Also call 'go run' directly on the mappingtest/main.go file instead of
go-running the directory.

Change-Id: Ib91877c021209cbf4da50a561737d7a9d42c6adc
Reviewed-on: https://go-review.googlesource.com/118662
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 13:45:55 +00:00
Tobias Klauser
d8e86caa3f os: skip TestFifoEOF on android
TestFifoEOF fails on android because the mkfifo syscall is not allowed:

--- FAIL: TestFifoEOF (0.00s)
    fifo_test.go:39: permission denied

Change-Id: I007ff359831525add39cec34de4b3d3cd3adb047
Reviewed-on: https://go-review.googlesource.com/118815
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 13:41:57 +00:00
Tobias Klauser
1031380361 syscall, internal/syscall: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code.

Change-Id: I4ac8b99ac45f25dd2399d048ea831489e5394984
Reviewed-on: https://go-review.googlesource.com/118821
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-14 13:21:46 +00:00
Alex Brainman
af4d60428f internal/poll: specify current file position when calling TransmitFile
Current SendFile implementation assumes that TransmitFile starts from
the current file position. But that appears not true for Windows 10
Version 1803.

TransmitFile documentation

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740565(v=vs.85).aspx

suggests, "You can use the lpOverlapped parameter to specify a 64-bit
offset within the file at which to start the file data transfer by
setting the Offset and OffsetHigh member of the OVERLAPPED structure."

Do as it advises.

Fixes #25722

Change-Id: I241d3bf76d0d5590d4df27c6f922d637068232fb
Reviewed-on: https://go-review.googlesource.com/117816
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 09:42:03 +00:00
Dominik Honnef
7bab1ee5e0 flag: fix headers in documentation, again
Godoc expects text after a header, not code.

Change-Id: I99f412ad15e10bf9cea0dbd19019ed6ce477736c
Reviewed-on: https://go-review.googlesource.com/117595
Reviewed-by: Rob Pike <r@golang.org>
2018-06-14 02:58:06 +00:00
Akhil Indurti
d7f874fef6 cmd/go: document convention to signify generated code.
This change updates the go tool's documentation under the section
"Generate Go files by processing source" to mention the convention that
generated source files should have a line of text that matches the
following regular expression:

    ^// Code generated .* DO NOT EDIT\.$

Previously, the canonical documentation for this convention
(https://golang.org/s/generatedcode) referenced Rob Pike's comment at
https://golang.org/issue/13560#issuecomment-288457920. This change
merely moves that information to a more visible place.

Updates #25433.

Change-Id: I804d95d307d1dc68cb28da3750ebe9090178c474
Reviewed-on: https://go-review.googlesource.com/118756
Reviewed-by: Rob Pike <r@golang.org>
2018-06-14 01:47:46 +00:00
Brad Fitzpatrick
2642df9a2c crypto/x509: re-enable TestSystemRoots on darwin
It was apparently waiting on CL 36942, which was submitted.

Fixes #21416

Change-Id: I8f4ccc5a3176070abf0df019c82700c5761b5f53
Reviewed-on: https://go-review.googlesource.com/117055
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-14 00:25:20 +00:00
Ian Lance Taylor
3a7cbfaa40 cmd/cgo: add import path to hash
This avoids name conflicts when two identical packages use cgo.
This can happen in practice when the same package is vendored multiple
times in a single build.

Fixes #23555

Change-Id: I9f0ec6db9165dcf9cdf3d314c668fee8ada18f9c
Reviewed-on: https://go-review.googlesource.com/118739
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 23:36:03 +00:00
Emmanuel T Odeke
7bc99ffa05 cmd/compile: make case insensitive suggestions aware of package
Ensure that compiler error suggestions after case insensitive
field lookups don't mistakenly reported unexported fields if
those fields aren't in the local package being processed.

Fixes #25727

Change-Id: Icae84388c2a82c8cb539f3d43ad348f50a644caa
Reviewed-on: https://go-review.googlesource.com/117755
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 23:12:54 +00:00
Ian Lance Taylor
b8dc931326 misc/cgo/test: add test for passing compatible typedefs
Fixes #23720

Change-Id: I28e0c16503bc043f793e0dab19668f7a66313312
Reviewed-on: https://go-review.googlesource.com/118737
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 23:08:56 +00:00
Sabin Mihai Rapan
67d276c57c cgo: update documentation on calling C variadic functions
The current implementation does not support calling C variadic
functions (as discussed in #975). Document that.

Fixes #23537

Change-Id: If4c684a3d135f3c2782a720374dc4c07ea66dcbb
Reviewed-on: https://go-review.googlesource.com/90415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 22:35:42 +00:00
Andrii Soldatenko
efddc161d2 math: add examples to Ceil, Floor, Pow, Pow10 functions
Change-Id: I9154df128b349c102854bb0f21e4c313685dd0e6
Reviewed-on: https://go-review.googlesource.com/118659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 22:01:28 +00:00
Tim Cooper
a7d89572be doc: fix fmt usage in code.html
Fixes #25876

Change-Id: I149dbb2afef13cc13fb5722d930377ed918d7e3c
Reviewed-on: https://go-review.googlesource.com/118717
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 22:00:24 +00:00
Brad Fitzpatrick
fc0e1d2b6f archive/zip: warn about FileHeader.Name being unvalidated on read
Updates #25849

Change-Id: I09ee928b462ab538a9d38c4e317eaeb8856919f2
Reviewed-on: https://go-review.googlesource.com/118335
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2018-06-13 21:57:41 +00:00
Ian Lance Taylor
1e721cfc43 bufio: clarify SplitFunc docs for nil token
Fixes #25472

Change-Id: Idb72ed06a3dc43c49ab984a80f8885352b036465
Reviewed-on: https://go-review.googlesource.com/118695
Reviewed-by: Rob Pike <r@golang.org>
2018-06-13 21:43:06 +00:00
Robert Griesemer
1fcf183a87 go/internal/gccgoimporter: remove dead code
The function parseInitData appears to be unused. Deleted.

Change-Id: I7d4efed9d2519cfbd0ba03d89b45add8b314ea84
Reviewed-on: https://go-review.googlesource.com/118556
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 21:31:59 +00:00
Yury Smolsky
5eb98b3c30 cmd/compile: use expandable columns in ssa.html
Display just a few columns in ssa.html, other
columns can be expanded by clicking on collapsed column.

Use sans serif font for the text, slightly smaller font size
for non program text.

Fixes #25286

Change-Id: I1094695135401602d90b97b69e42f6dda05871a2
Reviewed-on: https://go-review.googlesource.com/117275
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-06-13 21:02:54 +00:00
Tobias Klauser
fb4fb0430b syscall: check Fchmodat flags parameter on Linux
As mentioned in #25845, port CL 46474 from golang.org/x/sys/unix to the
syscall package.

Currently Linux' fchmodat(2) syscall implementation doesn't support the
flags parameter (though it might in future versions [1]). Fchmodat in
the syscall package takes the parameter and (wrongly) passes it on to the
syscall which will ignore it.

According to the POSIX.1-2008 manual page [2], AT_SYMLINK_NOFOLLOW is
the only valid value for the flags parameter and EOPNOTSUPP should be
returned in case changing the mode of a symbolic link is not supported
by the underlying system. EINVAL should be returned for any other value
of the flags parameter.

  [1] https://patchwork.kernel.org/patch/9596301/
  [2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

Updates #20130
Updates #25845

Change-Id: I1021dd0e6a4f4cb3557cb1c1b34dd618c378cda6
Reviewed-on: https://go-review.googlesource.com/118658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 20:32:08 +00:00
Ian Lance Taylor
4a778cdf33 os: don't poll fifos on Darwin
The Darwin kqueue implementation doesn't report any event when the
last writer for a fifo is closed.

Fixes #24164

Change-Id: Ic2c47018ef1284bf2e26379f8dd7646edaad4d05
Reviewed-on: https://go-review.googlesource.com/118566
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 20:27:55 +00:00
Elias Naur
c824f540d9 runtime: move iOS kevent calls to libc
Change-Id: Ie97c9c9163f5af7b4768c34faac726e21627aa79
Reviewed-on: https://go-review.googlesource.com/118660
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-06-13 18:27:23 +00:00
Keith Randall
72c29fc8cd runtime: move darwin kevent calls to libc
kqueue, kevent, closeonexec, setitimer, with sysctl and fcntl helpers.

TODO:arm,arm64

Change-Id: I9386f377186d6ac7cb99064c524a67e0c8282eba
Reviewed-on: https://go-review.googlesource.com/118561
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-06-13 18:27:15 +00:00
Hana Kim
537fb06c5d runtime/pprof: skip TestMapping if CGO is not available
The test requires cgo

Change-Id: I1bffee5f187afcf4b7e27516451c56ddfc263a26
Reviewed-on: https://go-review.googlesource.com/118638
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 18:06:14 +00:00
Austin Clements
a1b85ee754 Revert "cmd/link: separate virtual address layout from file layout"
This reverts commit bd83774593.

Reason for revert: This broke ELF layout on arm, arm64, mips*, mips64*, ppc64*, and s390x.

Change-Id: I56a27b76e6f4b22ce39a99790af9116f8687eee9
Reviewed-on: https://go-review.googlesource.com/118675
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 17:55:32 +00:00
Brad Fitzpatrick
24d29e85cb net/http: make Transport.RoundTrip check context.Done earlier
Fixes #25852

Change-Id: I35c630367c8f1934dcffc0b0e08891d55a903518
Reviewed-on: https://go-review.googlesource.com/118560
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-06-13 17:12:57 +00:00
Tobias Klauser
a2f72cc80d syscall: support Linux syscalls without error return on mipsx/mips64x
Like on other architectures, use rawSyscallNoError for Linux syscalls
that don't return an error and convert all applicable occurences of
RawSyscall to use it instead.

This was missed in CL 84485 because mkall.sh doesn't support
mipsx/mips64x, so add the corresponding entries as well.

Updates #22924

Change-Id: I762cbee0827140b9890c4a10830e0b4cd33de92f
Reviewed-on: https://go-review.googlesource.com/118655
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 14:55:01 +00:00
Richard Musiol
72ce047a6c misc/wasm: remove use of performance.timeOrigin
This commit changes wasm_exec.js to not depend on the existence of
performance.timeOrigin. The field is not yet supported on all
browsers, e.g. it is unavailable on Safari.

Change-Id: I6cd3834376c1c55424c29166fde1219f0d4d338f
Reviewed-on: https://go-review.googlesource.com/118617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 14:51:01 +00:00
Hana Kim
7b2f55d89f runtime/pprof: set HasFunctions of mapping entries
The pprof tool utilizes attributes of mapping entries
such as HasFunctions to determine whether the profile
includes necessary symbol information.
If none of the attributes is set, pprof tool tries to
read the corresponding binary to use for local symbolization.
If the binary doesn't exist, it prints out error messages.

Go runtime generated profiles without any of the attributes
set so the pprof tool always printed out the error messages.
The error messages became more obvious with the new
terminal support that uses red color for error messages.

Go runtime can symbolize all Go symbols and generate
self-contained profile for pure Go program. Thus, there
is no reason for the pprof tool to look for the copy of
the binary. So, this CL sets one of the attributes
(HasFunctions) true if all PCs in samples look fully
symbolized.

For non-pure Go program, however, it's possible that
symbolization of non-Go PCs is incomplete. In this case,
we need to leave the attributes all false so pprof can attempt
to symbolize using the local copy of the binary if available.
It's hard to determine whether a mapping includes non-Go
code. Instead, this CL checks PCs from collected samples.
If unsuccessful symbolization is observed, it skips setting
the HasFunctions attribute.

Fixes #25743

Change-Id: I5108be45bbc37ab486d145fa03e7ce37d88fad50
Reviewed-on: https://go-review.googlesource.com/118275
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 14:04:38 +00:00
Tobias Klauser
16caec5892 cmd/dist, go/types: add support for GOARCH=riscv64
This is needed in addition to CL 110066 in order to be able to generate
Go type definitions for linux/riscv64 in the golang.org/x/sys/unix
package.

Change-Id: I4a27e6424aaea63283b55bd4f73b958b41f29d72
Reviewed-on: https://go-review.googlesource.com/118618
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 13:52:15 +00:00
Russ Cox
ee2e8ecb19 cmd/go: fix go list usage line
CL 108156 added -cgo and -export,
but in the usage line it added -cgo and -list.
CL 117015 correctly added -export to the usage line.
All that remains is to remove -list.

Change-Id: I8cc5cfc78bc6b52080ae1b861f92620a8f18b53f
Reviewed-on: https://go-review.googlesource.com/118375
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 13:45:21 +00:00
Suriyaa Sundararuban
1041ac8781 doc: use HTTPS for links
Change-Id: I9d2d25df067ca573589db5ff18296a5ec33866be
Reviewed-on: https://go-review.googlesource.com/118595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-13 13:45:01 +00:00
Ian Lance Taylor
f297d165c9 encoding/gob: correct issue number typo in comment
Change-Id: I3ac25cf1770b5ac0d36690c37615b3badd27463d
Reviewed-on: https://go-review.googlesource.com/118455
Reviewed-by: Rob Pike <r@golang.org>
2018-06-13 05:33:59 +00:00
Dave Russell
930185f26d doc/contribute.html: add whitespace after <code> blocks, where missing
Change-Id: Iea5c705dd58f9b83fbeb0500defcc08c34716169
GitHub-Last-Rev: 35702c784e
GitHub-Pull-Request: golang/go#25858
Reviewed-on: https://go-review.googlesource.com/118536
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 04:46:06 +00:00
Robert Griesemer
59be226107 go/importer: better error message when importer is out of date
Separated out panic handling for bimporter and importer so that
the handler can consider the current version and report a better
error.

Added new export data test for export data version 999 (created
by changing the compiler temporarily) and verifying expected
error message.

Fixes #25856.

Change-Id: Iaafec07b79499154ef7c007341783fa07c57f24d
Reviewed-on: https://go-review.googlesource.com/118496
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-06-13 04:39:18 +00:00
Nathan Cantelmo
4f6b9ed5ad doc: document the lack of support for symlinks under GOPATH
In an effort to help others avoid the issues I've hit due to lack of
symlink support under GOPATH, I've added a note of warning to the
Workspaces section.

I have not changed the contents of go help gopath, because on reflection
it seems this change alone may be sufficient.

Fixes #21320

Change-Id: Ib8969bf12cecad878e89ff66b5864bbf3caaf219
Reviewed-on: https://go-review.googlesource.com/61930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-12 23:52:02 +00:00
Niek Sanders
b768d82d8e encoding/base32: eliminate alphabet bounds check
name              old time/op   new time/op   delta
EncodeToString-4   35.5µs ± 7%   33.3µs ± 6%  -6.27%   (p=0.008 n=10+9)
DecodeString-4      120µs ± 7%    113µs ± 8%  -5.88%  (p=0.011 n=10+10)

name              old speed     new speed     delta
EncodeToString-4  231MB/s ± 8%  247MB/s ± 5%  +6.55%   (p=0.008 n=10+9)
DecodeString-4    109MB/s ± 7%  116MB/s ± 8%  +6.27%  (p=0.011 n=10+10)

Change-Id: I60bf962464179e35b1711617adbc45a822eaece5
Reviewed-on: https://go-review.googlesource.com/45876
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-12 22:51:30 +00:00
Matthew Broberg
3885e86411 regexp: add QuoteMeta example
Change-Id: I0bbb53cad9a7c464ab1cfca381128f33496813ff
Reviewed-on: https://go-review.googlesource.com/49130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-12 22:37:01 +00:00
Ioannis Georgoulas
2cf9732e8a context: add docs to ExampleWithValue
Change-Id: I3a83c63f4db2e46fd96f373378a429896e93f9d1
Reviewed-on: https://go-review.googlesource.com/48861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-12 22:33:54 +00:00
Richard Musiol
be36bd996e runtime/internal/sys: rename Wasm to WASM
This commit changes sys.Wasm to sys.WASM, as requested on
https://groups.google.com/forum/#!topic/golang-dev/VquDxlhjPkg

Change-Id: I30a208c34576a8bb49b9beb524203d71df8fdf1c
Reviewed-on: https://go-review.googlesource.com/118395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-12 22:09:45 +00:00
Austin Clements
bd83774593 cmd/link: separate virtual address layout from file layout
Currently these two forms of layout are done in a single pass. This
makes it difficult to compress DWARF sections because that must be
done after relocations are applied, which must happen after virtual
address layout, but we can't layout the file until we've compressed
the DWARF sections.

Fix this by separating the two layout steps. In the process, we can
also unify the copy-pasted code in Link.address to compute file
offsets. Currently, each instance of this is slightly different, but
there's no reason for it to be. For example, we don't perform
PEFILEALIGN alignment on Segrodata or Selreltodata even when HeadType
== Hwindows, but it turns out it doesn't matter whether you do or
don't because these segments simply don't exist on Windows. Hence, in
the unified code path, we do this alignment for all segments.
Likewise, there are two ways of computing Fileoff:
  seg.Vaddr - prev.Vaddr + prev.Fileoff
and
  prev.Fileoff + uint64(Rnd(int64(prev.Filelen), int64(*FlagRound)))
At the moment, these always have the same value, but the latter will
continue to work after we start compressing sections on disk.

Tested by comparing test binaries for all packages in std before and
after this change for GOOS={linux,windows,darwin,plan9}. All binaries
are identical.

For #11799.

Change-Id: If09f28771bb4d78dd392fd58b8d7c9d5f22b0b9f
Reviewed-on: https://go-review.googlesource.com/111682
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-12 20:37:02 +00:00
Russ Cox
f7142206e9 cmd/go: use build cache for tests when GOCACHE is unset
Before this CL, if you had GOCACHE=/some/dir, then the cmd/go tests used it.
But if you were relying on the implicit behavior that GOCACHE being empty
meant an appropriate system-specific cache directory, then the cmd/go tests
ran with no cache at all, which makes them about 4X slower.

During all.bash GOCACHE is set to a fresh temporary directory and is therefore
already getting proper caching; this CL mainly helps people running 'go test cmd/go'
by hand.

Change-Id: I7c322ca79b877c1d0a3b448b95d5354fbfcba7f8
Reviewed-on: https://go-review.googlesource.com/118320
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-12 20:31:40 +00:00
Cherry Zhang
44b826bb28 cmd/compile: use a different register for updated value in AtomicAnd8/Or8 on ARM64
ARM64 manual says it is "constrained unpredictable" if the src
and dst registers of STLXRB are same, although it doesn't seem
to cause any problem on real hardwares so far. Fix by allocating
a different register to hold the updated value for
AtomicAnd8/Or8. We do this by making the ops returns <val,mem>
like AtomicAdd, although val will not be used elsewhere.

Fixes #25823.

Change-Id: I735b9822f99877b3c7aee67a65e62b7278dc40df
Reviewed-on: https://go-review.googlesource.com/117976
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Wei Xiao <Wei.Xiao@arm.com>
2018-06-12 20:22:50 +00:00
Brad Fitzpatrick
39ad208c13 test: add test to verify that string copies don't get optimized away
Fixes #25834

Change-Id: I33e58dabfd04b84dfee1a9a3796796b5d19862e7
Reviewed-on: https://go-review.googlesource.com/118295
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-12 19:10:34 +00:00
Robert Griesemer
48987baa09 cmd/compile: correct alias cycle detection
The original fix (https://go-review.googlesource.com/c/go/+/35831)
for this issue was incorrect as it reported cycles in cases where
it shouldn't.

Instead, use a different approach: A type cycle containing aliases
is only a cycle if there are no type definitions. As soon as there
is a type definition, alias expansion terminates and there is no
cycle.

Approach: Split sprint_depchain into two non-recursive and more
easily understandable functions (cycleFor and cycleTrace),
and use those instead for cycle reporting. Analyze the cycle
returned by cycleFor before issueing an alias cycle error.

Also: Removed original fix (main.go) which introduced a separate
crash (#23823).

Fixes #18640.
Fixes #23823.
Fixes #24939.

Change-Id: Ic3707a9dec40a71dc928a3e49b4868c5fac3d3b7
Reviewed-on: https://go-review.googlesource.com/118078
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2018-06-12 18:55:39 +00:00
Andrew Bonventre
dda7985a7b doc/go1.11: first draft of release notes
Updates golang/go#23122

Change-Id: I2d6769101cdd580901cb08a3027d787fa438d4bc
Reviewed-on: https://go-review.googlesource.com/117975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-12 17:39:28 +00:00
Elias Naur
021c39d7a3 runtime: use libc for signal functions on iOS
Also:
 - Add extra SystemStack space for darwin/arm64 just
like for darwin/arm.
 - Removed redundant stack alignment; the arm64 hardware enforces
 the 16 byte alignment.
 - Save and restore the g registers at library initialization.
 - Zero g registers since libpreinit can call libc functions
 that in turn use asmcgocall. asmcgocall requires an initialized g.
 - Change asmcgocall to work even if no g is set. The change mimics
 amd64.

Change-Id: I1b8c63b07cfec23b909c0d215b50dc229f8adbc8
Reviewed-on: https://go-review.googlesource.com/117176
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-06-12 17:05:46 +00:00
Keith Randall
ec989337c5 runtime: use libc's signal functions on Darwin
sigaction, sigprocmask, sigaltstack, and raiseproc.

Fix bug in mstart_stub where we weren't saving callee-saved registers,
so if an m finished the pthread library calling mstart_stub would
sometimes fail.

Update #17490
Update #22805

Change-Id: Ie297ede0997910aa956834e49e85711b90cdfaa7
Reviewed-on: https://go-review.googlesource.com/116875
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-12 17:05:39 +00:00
Thomas Wanielista
adeb7e640b go/doc: classify function returning slice or array of T as constructor
Previously, go/doc would only consider functions and slices that
return types of T or any number of pointers to T: *T, **T, etc. This
change expands the definition of a constructor to include functions
that return arrays of a type (or pointer to that type) in its first
return.

With this change, the following return types also classify a function
as a constructor of type T:

[1]T
[1]*T
[1]**T
(and so on)

Fixes #22856.

Change-Id: I37957c5f2d6a7b2ceeb3fbaef359057f2039393d
Reviewed-on: https://go-review.googlesource.com/85355
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-06-12 16:37:37 +00:00
Elias Naur
f027d1a878 runtime: convert a darwin/arm64 syscall to libc
Change-Id: I5704a07375fc672ac70c1f4e8df6f4fff760b4bf
Reviewed-on: https://go-review.googlesource.com/118117
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-06-12 15:29:51 +00:00