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

37314 Commits

Author SHA1 Message Date
Ian Lance Taylor
5332b5e75a doc: mention Faccessat flags support in go1.11
Change-Id: I4d01be5330db06877065aabe7a3faf69bce0dfb2
Reviewed-on: https://go-review.googlesource.com/126515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-31 15:44:37 +00:00
Yury Smolsky
0b7d87e6f9 cmd/compile: remove dead code
This struct, global var and method are not used anywhere.

Change-Id: I83d9e93041a46904064d0fa88ab655a50149c747
Reviewed-on: https://go-review.googlesource.com/126397
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-31 15:42:33 +00:00
Paul Jolly
af29e98390 doc: add link to go command modules docs from Go 1.11 release notes
The FAQ already has a link to the release notes and the go command docs.
Add a link from the release notes to the go command docs, to ensure that
people ultimately end up there (the docs that then signpost
people to the relevant other help docs).

Updates #25517.

Change-Id: I284c84af712d4519c59f7ca6c396b05a4c967cee
Reviewed-on: https://go-review.googlesource.com/126777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-31 15:16:27 +00:00
Brad Fitzpatrick
d10ab13c18 net/http: expand a TimeoutHandler test a bit
Updates #22821

Change-Id: I2d0d483538174a90f56c26d99bea89fe9ce4d144
Reviewed-on: https://go-review.googlesource.com/125855
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-31 15:07:39 +00:00
Bryan C. Mills
b294fe9b0a cmd/go: prohibit modules from importing vendored golang_org packages
Expand mod_internal tests to cover vendoring, replacements, and failure
messages.

Packages beginning with "golang_org/" resolve to $GOROOT/src/vendor, and should
therefore not be visible within module code.

Fixes #23970.

Change-Id: I706e9c4a1d1e025883e84b897972678d0fa3f2bd
Reviewed-on: https://go-review.googlesource.com/125836
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-31 02:04:53 +00:00
Bryan C. Mills
68170aa677 cmd/go: forbid use of one module with two different paths
If a single module is imported via two different paths (e.g., as itself and as a
replacement for something else), some users may be surprised if the two paths
do not share the same package-level state. Others may be surprised if the two
paths do share state.

Punt on the question for now by rejecting that condition explicitly.

Fixes #26607.

Change-Id: I15c3889f61f8dd4ba5e5c48ca33ad63aeecac04e
Reviewed-on: https://go-review.googlesource.com/126156
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-31 02:02:51 +00:00
Bryan C. Mills
682faae2e3 cmd/go/internal/modload: inline doImport into doPkg
doImport is itself a thin wrapper around Import, and doPkg is its only call
site. I'm having trouble following what doPkg is doing due to the indirection,
so I'm removing it.

Change-Id: I6167be68e869a36010a56a5869df50b1145ac813
Reviewed-on: https://go-review.googlesource.com/125837
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-31 02:00:47 +00:00
Bryan C. Mills
db2f680fdf cmd/go: allow internal imports based on module paths
Updates #23970.

Change-Id: I2e69ad15b9d1097bfeef9947f03cfa6834a6a049
Reviewed-on: https://go-review.googlesource.com/125676
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-31 01:58:53 +00:00
Bryan C. Mills
38dc795074 cmd/go: allow unversioned paths to -dropreplace flag
We can add unversioned paths via -replace;
-dropreplace must be able to drop them.

Fixes #26417.

Change-Id: Ic05e9ae2ad80c008e11b195695cbb9d0fc8dbc0a
Reviewed-on: https://go-review.googlesource.com/126155
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-31 01:57:22 +00:00
Michael Matloob
52cc9e3762 cmd/go: add test code packages in list -test
Previously go list -test <pkg> would return pkg and, if it exists,
pkg.test, the test main package. This change will also list the
two test code packages (if they exist) that contain testing functions,
<pkg> [<pkg>.test] and <pkg>_test [<pkg>.test].

These packages which contain testing code are usually the packages
go list users desire to know about, so they should be surfaced
in go list -test.

See the discussion at
golang.org/cl/123635#message-5befbc66663063fb7247645a02ab1327a681e362
for more context.

Change-Id: I7170b539d02b548c050ac54048735ed785f47389
Reviewed-on: https://go-review.googlesource.com/126475
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-30 16:40:04 +00:00
Ben Shi
e351a16005 cmd/internal/obj/arm64: reject incorrect form of LDP/STP
"LDP (R0), (F0, F1)" and "STP (F1, F2), (R0)" are
silently accepted by the arm64 assembler without
any error message. And this CL fixes that bug.

fixes #26556.

Change-Id: Ib6fae81956deb39a4ffd95e9409acc8dad3ab2d2
Reviewed-on: https://go-review.googlesource.com/125637
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-07-30 15:31:06 +00:00
Alberto Donizetti
86f907fdec doc/go1.11: add missing word
Change-Id: Iad01c9a4a080cf0c317768c34b3fbfd3c9707969
Reviewed-on: https://go-review.googlesource.com/126609
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-30 14:44:47 +00:00
Brad Fitzpatrick
12d27d8ea5 doc/go1.11: note that godoc now shows the Go version that added features
Change-Id: Ie613a707dad1ac69627e1d7584d7d4e311db22f7
Reviewed-on: https://go-review.googlesource.com/126622
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-29 20:05:41 +00:00
John Gibb
f6a5fada27 path: present the correct error message in TestMatch
The message was hardcoded to indicate that the test wanted a nil error, even
though in some cases a specific error was wanted. This patch fixes the
message to print the wanted error.

Change-Id: Id86ea89d6f41f25bfa164acc50142ae8ff0ec410
GitHub-Last-Rev: c220374845
GitHub-Pull-Request: golang/go#26674
Reviewed-on: https://go-review.googlesource.com/126619
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-29 19:18:48 +00:00
David du Colombier
154394f8d3 cmd/go: fix TestScript/mod_gobuild_import on Plan 9
CL 125296 added TestScript/mod_gobuild_import. This
test is failing on Plan 9, because go/build invokes
the go tool which cannot be found in the path.

The "PATH" environment variable has been updated to
contain the path to the go tool on Unix and Windows,
but on Plan 9, the analogous environment variable is
called "path".

This change fixes the script engine by setting
the "path" environment variable on Plan 9.

Fixes #26669.

Change-Id: If1be50e14baceccee591f4f76b7e698f5e12a2d4
Reviewed-on: https://go-review.googlesource.com/126608
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-29 15:42:29 +00:00
Constantin Konstantinidis
5ad0a524d2 cmd/go: uses SID of group Guests to test ACL
The test TestACL failed when ran on a Windows set
up in another language as the "Guest" account
name is translated. The SID of the group of Guests
always exist and is used instead.

Fixes #26658

Change-Id: Ia885d08a9e50563787e389c2d2dc2547881a2943
Reviewed-on: https://go-review.googlesource.com/126598
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-28 09:06:26 +00:00
Russ Cox
0090c13c91 cmd/go: ignore unknown directives in dependency go.mod files
This will help with forward compatibility when we add additional
directives that only matter for the main module (or that can be
safely ignored otherwise).

Change-Id: Ida1e186fb2669b128aeb5a9a1187e2535b72b763
Reviewed-on: https://go-review.googlesource.com/125936
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:15:16 +00:00
Russ Cox
9cde8048ad cmd/go: document in 'go help mod' that people should use 'go get'
We're starting to see tutorials that assume
'go mod' is the only module-related command.

Fixes #26597.

Change-Id: I44701f29f89fc67086f96307afbdb4659bb63873
Reviewed-on: https://go-review.googlesource.com/125935
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:15:10 +00:00
Russ Cox
a74cc47244 cmd/go: add 'go help goproxy'
Fixes #26553.

Change-Id: I522a0fa96ae161b67d89f38dafde528adcbae243
Reviewed-on: https://go-review.googlesource.com/125658
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:15:05 +00:00
Russ Cox
f37ca81c84 cmd/go: fix spurious edges in mod -graph output
The mod -graph output was showing every dependency
as an edge from the main module, instead of showing only
the things that are listed in go.mod.

Fixes #26489.

Change-Id: I248fedb1fc9225e2a7a9ddc2f4a84520b3a96138
Reviewed-on: https://go-review.googlesource.com/125657
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:15:00 +00:00
Russ Cox
0cb6b55f43 cmd/go: add go list -m -f {{.GoMod}} to show path to go.mod file
"go env GOMOD" gives this for the main module already
but it's useful to be able to query other modules.
Using {{.Dir}} does not work if the go.mod was auto-synthesized.

Change-Id: If4844571e9e429b541de0d40c36ff4c5743b2031
Reviewed-on: https://go-review.googlesource.com/125656
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:14:56 +00:00
Russ Cox
011b6ff8d7 cmd/go: document go env GOMOD
Fixes #26500.

Change-Id: I0a00009ce10f7aab3e6e79f7218307c3008422d1
Reviewed-on: https://go-review.googlesource.com/125655
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:14:50 +00:00
Russ Cox
8fbbf63cc6 cmd/cgo: document that #including source files in subdirectories is a bad idea
Suggested in discussion on #26366.

Change-Id: Id9ad2e429a915f88b4c4b30fc415c722eebe0ea4
Reviewed-on: https://go-review.googlesource.com/125297
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-28 01:14:45 +00:00
Russ Cox
f85125345c go/build: invoke go command to find modules during Import, Context.Import
The introduction of modules has broken (intentionally) the rule
that the source code for a package x/y/z is in GOPATH/src/x/y/z
(or GOROOT/src/x/y/z). This breaks the code in go/build.Import,
which uses that rule to find the directory for a package.

In the long term, the fix is to move programs that load packages
off of go/build and onto golang.org/x/tools/go/packages, which
we hope will eventually become go/packages. That code invokes
the go command to learn what it needs to know about where
packages are.

In the short term, though, there are lots of programs that use go/build
and will not be able to find code in module dependencies.
To help those programs, go/build now runs the go command to
ask where a package's source code can be found, if it sees that
modules are in use. (If modules are not in use, it falls back to the
usual lookup code and does not invoke the go command, so that
existing uses are unaffected and not slowed down.)

Helps #24661.
Fixes #26504.

Change-Id: I0dac68854cf5011005c3b2272810245d81b7cc5a
Reviewed-on: https://go-review.googlesource.com/125296
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-28 01:14:39 +00:00
Craig Citro
8450fd9677 net/http: document Transport.Proxy's https support
The net/http module added support for HTTPS proxies in CL 68550, but the
Transport.Proxy docstring was never updated to reflect this. This (doc-only)
update adds "https" to the list of supported schemes.

Change-Id: I0570fcdae8232bb42d52c4dd739dd09ee8dfd612
Reviewed-on: https://go-review.googlesource.com/126495
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-27 21:40:10 +00:00
Ian Lance Taylor
d970519086 syscall: support Faccessat flags argument
The Linux kernel faccessat system call does not take a flags parameter.
The flag parameter to the C library faccessat function is implemented in C.
The syscall.Faccessat function takes a flags parameter. In older releases
we have passed the flags parameter to the kernel, which ignored it.
In CL 120015 we started returning an error if any flags were set.
That seems clearly better than ignoring them, but it turns out that some
code was using the flags. The code was previously subtly broken.
Now it is obviously broken. That is better, but we can do better still:
we can implement the flags as the C library does. That is what this CL does.

Change-Id: I259bd6f240c3951e939b81c3032dead3d9c567b4
Reviewed-on: https://go-review.googlesource.com/126415
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-27 21:13:43 +00:00
Brad Fitzpatrick
902fc11427 net/http: try to document ServeFile security more
We've expanded this several times. Try more.

Fixes #18837

Change-Id: I03b699391351a30ee60a15d7aa712c6c66444cf9
Reviewed-on: https://go-review.googlesource.com/125875
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-27 21:01:10 +00:00
Constantin Konstantinidis
9dab384778 cmd/link: added test of availability of gcc
The test RuntimeTypeAttr always failed when gcc
was unavailable. The test is duplicated for internal
and external linking. The usual verification
of host linker is added at the beginning of the
external link test.

Fixes #26621

Change-Id: I076d661f854c8a6de8fa5e7b069942a471445047
Reviewed-on: https://go-review.googlesource.com/126075
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-07-27 18:35:13 +00:00
Jeet Parekh
05f9b36952 syscall: improve NewCallback documentation and panic message
Fixes #26138

Change-Id: If77b2839bccc600223735df42438a19131cd051c
GitHub-Last-Rev: 64ceaea9f1
GitHub-Pull-Request: golang/go#26617
Reviewed-on: https://go-review.googlesource.com/126035
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-27 17:42:58 +00:00
Ian Lance Taylor
ead59f4bf3 cmd/cgo: don't resolve typedefs in -godefs mode
In -godefs mode any typedefs that appear in struct fields and the like
will presumably be defined in the input file. If we resolve to the
base type, those cross-references will not work. So for -godefs mode,
keep the Go 1.10 behavior and don't resolve the typedefs in a loop.

Fixes #26644

Change-Id: I48cf72d9eb5016353c43074e6aff6495af326f35
Reviewed-on: https://go-review.googlesource.com/125995
Reviewed-by: Keith Randall <khr@golang.org>
2018-07-27 16:46:42 +00:00
Martin Möhrmann
911a5fda13 crypto/x509: skip TestSystemRoots
cgo and non-cgo code paths can disagree
on the number of root certificates:
=== RUN   TestSystemRoots
--- FAIL: TestSystemRoots (0.31s)
    root_darwin_test.go:31:     cgo sys roots: 93.605184ms
    root_darwin_test.go:32: non-cgo sys roots: 213.998586ms
    root_darwin_test.go:44: got 168 roots
    root_darwin_test.go:44: got 427 roots
    root_darwin_test.go:73: insufficient overlap between cgo and non-cgo roots; want at least 213, have 168
FAIL
exit status 1

Updates #21416
Updates #24652

Change-Id: Idb6d35b17c142dfff79a10cf6b40a42d12f9d17e
Reviewed-on: https://go-review.googlesource.com/125259
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-27 16:44:57 +00:00
Daniel Martí
b39fb9ec85 cmd/go/internal/par: fix TestWorkParallel retries
When the test retried multiple times, it reused the same Work variable,
causing in the builders being flaky due to panics. I was able to
immediately reproduce the failure with stress and -race:

	$ go test -race -c && stress -p 32 ./par.test -test.run=TestWorkParallel$

	/tmp/go-stress909062277
	--- FAIL: TestWorkParallel (0.07s)
	panic: par.Work.Do: already called Do [recovered]
		panic: par.Work.Do: already called Do

Instead, use a new Work variable at each retry. Now, the line above
seems to never fail. Of course, much higher 'stress -p' values will
still result in "does not seem to be parallel" test failures since the
machine lacks resources. But those are test failures, not panics.

Fixes #26642.

Change-Id: I5e962eca7602cf413d911ff5669f56d4f52da5a7
Reviewed-on: https://go-review.googlesource.com/126355
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-27 16:29:52 +00:00
Yury Smolsky
6732633bc6 cmd/go: remove unused global var isGoRelease
This variable is not used anymore. It was used in the
TestPackageNotStaleWithTrailingSlash test.

Change-Id: I5e52d4d1d91592dd21e2d9cff96974a49d07f5f8
Reviewed-on: https://go-review.googlesource.com/126376
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-27 16:23:37 +00:00
David Wimmer
bd98a81dc2 syscall: implement pipe() on linux/mips
Change the Pipe() function to use the pipe() syscall (which has a unique
calling convention on linux/mips) instead of using pipe2(). This allows
it work on kernels <2.6.27 when pipe2() was introduced.

Change-Id: I65dfbd2a02b64e777a8eb13013d718e356521be6
GitHub-Last-Rev: c483a06168
GitHub-Pull-Request: golang/go#26608
Reviewed-on: https://go-review.googlesource.com/125915
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Vladimir Stefanovic <vladimir.stefanovic@mips.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-26 17:13:12 +00:00
Minaev Mike
e5b13401c6 crypto/tls: fix deadlock when Read and Close called concurrently
The existing implementation of TLS connection has a deadlock. It occurs
when client connects to TLS server and doesn't send data for
handshake, so server calls Close on this connection. This is because
server reads data under locked mutex, while Close method tries to
lock the same mutex.

Fixes #23518

Change-Id: I4fb0a2a770f3d911036bfd9a7da7cc41c1b27e19
Reviewed-on: https://go-review.googlesource.com/90155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-07-25 23:53:54 +00:00
Ian Lance Taylor
7b46867d6e cmd/go: for missing binary-only package, say where it should be
Before this CL the user effectively has to guess at the expected
location of a binary-only package. While the location is normally
obvious ($GOPATH/pkg/GOOS_GOARCH/PATH/PKG.a) it is much less so when
building with options that implicitly add an -installsufix option.

Fixes #26590

Change-Id: I753ef54d6dcf733bb456dba65a4a92e4db57a1b0
Reviewed-on: https://go-review.googlesource.com/125818
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-25 23:32:37 +00:00
Ian Lance Taylor
c0e5485bd5 runtime: ignore GNU/Linux sigaction errors for signals 32 and 33
This avoids problems when running under QEMU. It seems that at least
some QEMU versions turn the sigaction implementation into a call to
the C library sigaction function. The C library function will reject
attempts to set the signal handler for signals 32 and 33. Ignore
errors in that case.

Change-Id: Id443a9a32f6fb0ceef5c59a398e7ede30bf71646
Reviewed-on: https://go-review.googlesource.com/125955
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-25 21:30:24 +00:00
Ian Gudger
5f5402b723 net: fix handling of Conns created by Resolver.Dial
The DNS client in net is documented to treat Conns returned by
Resolver.Dial which implement PacketConn as UDP and those which don't as
TCP regardless of what was requested. golang.org/cl/37879 changed the
DNS client to assume that the Conn returned by Resolver.Dial was the
requested type which broke compatibility.

Fixes #26573
Updates #16218

Change-Id: Idf4f073a4cc3b1db36a3804898df206907f9c43c
Reviewed-on: https://go-review.googlesource.com/125735
Run-TryBot: Ian Gudger <igudger@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-24 23:54:08 +00:00
Rob Pike
c1e1e882d2 doc: fix a couple of drive-by review comments in FAQ
Change-Id: I10cc2073e28cefb1b9a10c0ae89d819ad6417d66
Reviewed-on: https://go-review.googlesource.com/125695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-24 22:32:58 +00:00
Filippo Valsorda
7bebc6b722 net/http: fix and normalize the [Server.][ListenAnd]Serve[TLS] docs
The only inaccurate part was the HTTP/2 caveat in Server.ServeTLS, which
only applies to the plain Serve variant.

The restriction implemented in shouldConfigureHTTP2ForServe is not on
the setupHTTP2_ServeTLS codepath because ServeTLS owns the tls.Listener,
so we fix it for the user instead of disabling HTTP/2.

Fixes #24607

Change-Id: Ie5f207d0201f09db27bf81b75535e5f6fdaf91e2
Reviewed-on: https://go-review.googlesource.com/103815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-24 21:45:42 +00:00
Keith Randall
fe68ab3bcd runtime: traceback from outermost libc call
If we're in a libc call and get a trap, don't try to traceback the libc call.
Start from the state we had at entry to libc.

If there are multiple libc calls outstanding, remember the outermost one.

Fixes #26393

Change-Id: Icfe8794b95bf3bfd1a0679b456dcde2481dcabf3
Reviewed-on: https://go-review.googlesource.com/124195
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-24 21:06:55 +00:00
Keith Randall
5fc70b6fac cmd/compile: set stricter inlining threshold in large functions
If we're compiling a large function, be more picky about how big
the function we're inlining is.  If the function is >5000 nodes,
we lower the inlining threshold from a cost of 80 to 20.

Turns out reflect.Value's cost is exactly 80.  That's the function
at issue in #26546.

20 was chosen as a proxy for "inlined body is smaller than the call would be".
Simple functions still get inlined, like this one at cost 7:

func ifaceIndir(t *rtype) bool {
	return t.kind&kindDirectIface == 0
}

5000 nodes was chosen as the big function size.  Here are all the
5000+ node (~~1000+ lines) functions in the stdlib:

5187 cmd/internal/obj/arm (*ctxt5).asmout
6879 cmd/internal/obj/s390x (*ctxtz).asmout
6567 cmd/internal/obj/ppc64 (*ctxt9).asmout
9643 cmd/internal/obj/arm64 (*ctxt7).asmout
5042 cmd/internal/obj/x86 (*AsmBuf).doasm
8768 cmd/compile/internal/ssa rewriteBlockAMD64
8878 cmd/compile/internal/ssa rewriteBlockARM
8344 cmd/compile/internal/ssa rewriteValueARM64_OpARM64OR_20
7916 cmd/compile/internal/ssa rewriteValueARM64_OpARM64OR_30
5427 cmd/compile/internal/ssa rewriteBlockARM64
5126 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_50
6152 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_60
6412 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_70
6486 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_80
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_90
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_100
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_110
6675 cmd/compile/internal/gc typecheck1
5433 cmd/compile/internal/gc walkexpr
14070 cmd/vendor/golang.org/x/arch/arm64/arm64asm decodeArg

There are a lot more smaller (~1000 node) functions in the stdlib.
The function in #26546 has 12477 nodes.

At some point it might be nice to have a better heuristic for "inlined
body is smaller than the call", a non-cliff way to scale down the cost
as the function gets bigger, doing cheaper inlined calls first, etc.
All that can wait for another release. I'd like to do this CL for
1.11.

Fixes #26546
Update #17566

Change-Id: Idda13020e46ec2b28d79a17217f44b189f8139ac
Reviewed-on: https://go-review.googlesource.com/125516
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2018-07-24 16:11:08 +00:00
Baokun Lee
90066bf06a cmd/go/internal/modfetch: run git log with "-c log.showsignature=false"
The old version git not support "--no-show-signature", git add this from
v2.10.0.

Fixes golang/go#26501.

Change-Id: Ia6b54488651e8687b08a4d40e092822bf960c4fe
Reviewed-on: https://go-review.googlesource.com/125315
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-24 15:51:01 +00:00
Yann Hodique
4f9ae7739b cmd/go: fix Go structs in -json documentation
"string" should really be "struct" in the structures describing the module.

Change-Id: I4e9cb12434bd33aa243622380c78e5e297d01d0b
Reviewed-on: https://go-review.googlesource.com/125638
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-24 14:29:38 +00:00
Dmitry Vyukov
08ab820437 net/rpc: clarify requirements for connections and codecs
1. Connections and codecs need to be partially safe for concurrent use.
   Namely, read side is serialized by one mutex,
   and writing side is serialized by another.
   Current comment says that they need to be fully thread-safe,
   which makes the default implementations (gobClientCodec/gobServerCodec)
   non-conforming.

2. Say that ServerCodec.Close can be called multiple times
   and must be idempotent. Server requires this and gobServerCodec
   accounts for this,  but the requirement is not documented.

Change-Id: Ie877e37891fed28056e3d9d1722edaed8e154067
Reviewed-on: https://go-review.googlesource.com/120818
Reviewed-by: Rob Pike <r@golang.org>
2018-07-24 09:23:08 +00:00
Brad Fitzpatrick
6df4c3a44b net/http: document that Client methods always return *url.Error
Updates #9424

Change-Id: If117ba3e7d031f84b30d3a721ef99fe622734de2
Reviewed-on: https://go-review.googlesource.com/125575
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-24 03:21:35 +00:00
Brad Fitzpatrick
416676f4d9 net/http: deflake TestRetryRequestsOnError
There's a 50ms threshold in net/http.Transport that this test
sometimes hitting on slower devices. That was unrelated to what this
test was trying to test. So instead just t.Skip on RoundTrip errors
unless the failure was quick (under 25ms), in which case the error
must've been about something else. Our fast machines should catch
regressions there.

Fixes #25366

Change-Id: Ibe8e2716a5b68558b57d0b8b5c46f38e46a2cba2
Reviewed-on: https://go-review.googlesource.com/125555
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-24 00:25:50 +00:00
Ian Lance Taylor
240ae7e304 cmd/vet: if a function modifies its args, it's not a print wrapper
Fixes #26486
Updates #26555

Change-Id: I402137b796e574e9b085ab54290d1b4ef73d3fcc
Reviewed-on: https://go-review.googlesource.com/125039
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-23 22:45:16 +00:00
Brad Fitzpatrick
214f7ec554 net/http: update Serve docs on when HTTP/2 is enabled
Contains portions and modified portions of CL 103815

Fixes #24607

Change-Id: Ic330850a0f098f183315f04ea4780eded46c5b77
Reviewed-on: https://go-review.googlesource.com/125515
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-23 19:21:44 +00:00
marwan-at-work
62f401bf18 cmd/go/internal/modfetch: do not panic when zip is incorrect
Fixes #26536

Change-Id: I75d284bd39af0a06e31d18c7f7745c5a8ecbe6ac
GitHub-Last-Rev: 88040a9edb
GitHub-Pull-Request: golang/go#26537
Reviewed-on: https://go-review.googlesource.com/125436
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-23 16:05:04 +00:00