Beginning on Go 1.9, ServeMux has been dropping the port number from the Host
header and in the path pattern. This commit explicitly mentions the change in
behavior and adds a simple test case to ensure consistency.
Fixes#23351.
Change-Id: I0270c8bd96cda92c13ac6437cdf66c2807b3042d
Reviewed-on: https://go-review.googlesource.com/120557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reword the package summary to be a little easier to read.
Change-Id: I84a9301a02e228b46165410a429548b3774762d5
GitHub-Last-Rev: 1342c7219f
GitHub-Pull-Request: golang/go#26052
Reviewed-on: https://go-review.googlesource.com/120795
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Previously, it would return an empty string if it
could not determine the user's cache directory.
Return an error instead.
Change-Id: I74f00b1ad3858efa3fe2700c599271ebfe5764b6
Reviewed-on: https://go-review.googlesource.com/120757
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
It will not be present in go1.11beta1 but will be present
in subsequent releases.
Change-Id: I298fb682945345bb4a34ec83802fd644f75bdd98
Reviewed-on: https://go-review.googlesource.com/120756
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
semasleep on Darwin was refactored in https://golang.org/cl/118736 to
use the pthread_cond_timedwait function from libc. The new code
incorrectly assumed that pthread_cond_timedwait took a timeout relative
to the current time, when it in fact it takes a timeout specified in
absolute time. semasleep thus specified a timeout well in the past,
causing it to immediately exceed the timeout and spin hot. This was the
source of a large performance hit to CockroachDB (#26019).
Adjust semasleep to instead call pthread_cond_timedwait_relative_np,
which properly interprets its timeout parameter as relative to the
current time.
pthread_cond_timedwait_relative_np is non-portable, but using
pthread_cond_timedwait correctly would require two calls to
gettimeofday: one in the runtime package to convert the relative timeout
to absolute time, then another in the pthread library to convert back to
a relative offset [0], as the Darwin kernel expects a relative offset.
[0]: https://opensource.apple.com/source/libpthread/libpthread-301.30.1/src/pthread_cond.c.auto.htmlFix#26019.
Change-Id: I1a8c2429f79513b43d2b256365cd9166d235af8b
Reviewed-on: https://go-review.googlesource.com/120635
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This change fixes a typo in doc/contribute.html (afects -> affects)
and rewords a few slightly akward sentences.
Change-Id: I6bfbacba0de29464fce134b0fdaf3898a97b8d57
Reviewed-on: https://go-review.googlesource.com/120105
Reviewed-by: Rob Pike <r@golang.org>
Add a test by making misc/cgo/testshared/src/trivial.go marginally less
trivial.
Fixes#25970.
Change-Id: I8815d0c56b8850fcdbf9b45f8406f37bd21b6865
Reviewed-on: https://go-review.googlesource.com/120235
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
We want to compress DWARF even on macOS, but the native toolchain isn't
going to understand it. Add a flag that can be used to disable
compression, then add Darwin to the whitelist used during internal
linking.
Unlike GNU ld, the Darwin linker doesn't have a handy linker flag to do
compression. But since we're already doing surgery to put the DWARF in
the output executable in the first place, compressing it at the same
time isn't unduly difficult. This does have the slightly odd effect of
compressing some Apple proprietary debug sections, which absolutely
nothing will understand. Leaving them uncompressed didn't make much
sense, though, since I doubt they're useful without (say) __debug_info.
Updates #11799
Change-Id: Ie00b0215c630a798c59d009a641e2d13f0e7ea01
Reviewed-on: https://go-review.googlesource.com/120155
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
After the std tests, most of the rest of the tests aren't applicable
to js/wasm. (anything with -cpu=>1, cgo, etc)
Skip them all for now. We can incrementally re-enable them over time
as the js/wasm port is fleshed out. But let's get the builder column
black again so we can enable trybots and keep it black.
Updates #26014
Updates #26015
Updates #18892
Change-Id: I8992ed3888f598fa42273ce8646a32d62ce45b1d
Reviewed-on: https://go-review.googlesource.com/120575
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
If expanding an inline function body required lazily expanding a
package-scoped type whose identifier was shadowed within the function
body, the lazy expansion would instead overwrite the local symbol
definition instead of the package-scoped symbol. This was due to
importsym using s.Def instead of s.PkgDef.
Unfortunately, this is yet another consequence of the current awkward
scope handling code.
Passes toolstash-check.
Fixes#25984.
Change-Id: Ia7033e1749a883e6e979c854d4b12b0b28083dd8
Reviewed-on: https://go-review.googlesource.com/120456
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
MOVWconst's AuxInt is Int32. SSA check complains if the AuxInt
does not fit in int32. Convert uint32 to int32 to make it happy.
The generated code is unchanged. MOVW only cares low 32 bits.
Passes "toolstash -cmp" std cmd for ARM.
Fixes#25993.
Change-Id: I2b6532c9c285ea6d89652505fb7c553f85a98864
Reviewed-on: https://go-review.googlesource.com/120335
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
It's more common to specify GOOS/GOARCH values in that order,
rather than the inverse. Fix the order.
Updates #18892.
Change-Id: I8551508599e019f6617dc007397b562c9926418d
Reviewed-on: https://go-review.googlesource.com/120057
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Remove unnecessary race.Release annotation from Unlock.
For RWMutex we want to establish the following happens-before (HB) edges:
1. Between Unlock and the subsequent Lock.
2. Between Unlock and the subsequent RLock.
3. Between batch of RUnlock's and the subsequent Lock.
1 is provided by Release(&rw.readerSem) in Unlock and Acquire(&rw.readerSem) in Lock.
2 is provided by Release(&rw.readerSem) in Unlock and Acquire(&rw.readerSem) in RLock.
3 is provided by ReleaseMerge(&rw.writerSem) in RUnlock in Acquire(&rw.writerSem) in Lock,
since we want to establish HB between a batch of RUnlock's this uses ReleaseMerge instead of Release.
Release(&rw.writerSem) in Unlock is simply not needed.
FWIW this is also how C++ tsan handles mutexes, not a proof but at least something.
Making 2 implementations consistent also simplifies any kind of reasoning against both of them.
Since this only affects performance, a reasonable test is not possible.
Everything should just continue to work but slightly faster.
Credit for discovering this goes to Jamie Liu.
Change-Id: Ice37d29ecb7a5faed3f7781c38dd32c7469b2735
Reviewed-on: https://go-review.googlesource.com/120495
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Logf doesn't make the test fail, so the test was always OK.
Change-Id: I7c10ee74ff7e5d28cbd3a35e185093cb9f349470
Reviewed-on: https://go-review.googlesource.com/120496
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Code comments should have a space between comments characters and
actual words.
Change-Id: I6274baf1fc09b37a32ec6c69ddbb8edca9eb5469
Reviewed-on: https://go-review.googlesource.com/120475
Reviewed-by: Ian Lance Taylor <iant@golang.org>
golang.org/cl/84480 altered the API for the parse package for
clarity and consistency. However, the changes also broke the
API for consumers of the package. This CL reverts the API
to the previous spelling, adding only a single new exported
symbol.
Fixes#25968
Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f
Reviewed-on: https://go-review.googlesource.com/120355
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Currently, if lock or unlock calls throw because the g.m.lock count is
corrupted, we're unlikely to get a stack trace because startpanic_m
will itself attempt to acquire a lock, causing a recursive failure.
Avoid this by forcing the g.m.locks count to a sane value if it's
currently bad.
This might be enough to get a stack trace from #25128.
Change-Id: I52d7bd4717ffae94a821f4249585f3eb6cd5aa41
Reviewed-on: https://go-review.googlesource.com/120416
Reviewed-by: Ian Lance Taylor <iant@golang.org>
expandDecl can be called recursively, so it's not an appropriate place
to clean inimport. Instead, move this up to resolve, along with an
appropriate recursion check.
Passes toolstash-check.
Change-Id: I138d37b057dcc6525c780b4b3fbaa5e97f99655b
Reviewed-on: https://go-review.googlesource.com/120455
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Change-Id: I579cc9f4f8e5be5fd6447a99614797ab7bc53611
Reviewed-on: https://go-review.googlesource.com/120175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Currently wasm_exec.js is executable (0755) yet has no interpreter.
Indeed wasm_exec.js is only ever used as an argument to Node or loaded
via a <script> tag in a browser-loaded HTML file. Hence the execute
mode bits are superfluous and simply serve to clutter your PATH if
$GOROOT/misc/wasm is on your PATH (as is required if you want to run go
test syscall/js).
Change-Id: I279e2457094f8a12b9bf380ad7f1a9f47b22fc96
Reviewed-on: https://go-review.googlesource.com/120435
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The previous code acquired a read lock on src and a write lock on
dst for the entire duration of Splice. This resulted in deadlock,
in a situation akin to the following:
Splice is blocking, waiting to read from src.
The caller tries to close dst from another goroutine, but Close on
dst blocks in runtime.semacquire, because Splice is still holding a
write lock on it, and the Close didn't unblock any I/O.
The caller cannot unblock the read side of Splice through other means,
because they are stuck waiting in dst.Close().
Use more fine-grained locking instead: acquire the read lock on src
just before trying to splice from the source socket to the pipe,
and acquire the write lock on dst just before trying to splice from
the pipe to the destination socket.
Fixes#25985
Change-Id: I264c91c7a69bb6c5e28610e2bd801244804cf86d
Reviewed-on: https://go-review.googlesource.com/120317
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
ARMv8.1 has added new instruction (LDADDAL) for atomic memory operations. This
CL improves existing atomic add intrinsics with the new instruction. Since the
new instruction is only guaranteed to be present after ARMv8.1, we guard its
usage with a conditional on CPU feature.
Performance result on ARMv8.1 machine:
name old time/op new time/op delta
Xadd-224 1.05µs ± 6% 0.02µs ± 4% -98.06% (p=0.000 n=10+8)
Xadd64-224 1.05µs ± 3% 0.02µs ±13% -98.10% (p=0.000 n=9+10)
[Geo mean] 1.05µs 0.02µs -98.08%
Performance result on ARMv8.0 machine:
name old time/op new time/op delta
Xadd-46 538ns ± 1% 541ns ± 1% +0.62% (p=0.000 n=9+9)
Xadd64-46 505ns ± 1% 508ns ± 0% +0.48% (p=0.003 n=9+8)
[Geo mean] 521ns 524ns +0.55%
Change-Id: If4b5d8d0e2d6f84fe1492a4f5de0789910ad0ee9
Reviewed-on: https://go-review.googlesource.com/81877
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
CL 96575 introduced concurrency protection for
ServeMux.shouldRedirect with a read lock and deferred unlock.
However, the change produced a noticeable regression.
Instead add the suffix "RLocked" to the function name to
declare that we should hold the read lock as a pre-requisite
before calling it, hence avoiding the defer altogether.
Benchmarks:
name old time/op new time/op delta
ServeMux-8 63.3µs ± 0% 54.6µs ± 0% -13.74% (p=0.000 n=9+9)
ServeMux_SkipServe-8 41.4µs ± 2% 32.7µs ± 1% -21.05% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
ServeMux-8 17.3kB ± 0% 17.3kB ± 0% ~ (all equal)
ServeMux_SkipServe-8 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
ServeMux-8 360 ± 0% 360 ± 0% ~ (all equal)
ServeMux_SkipServe-8 0.00 0.00 ~ (all equal)
Updates #25383
Updates #25482
Change-Id: I2ffa4eafe165faa961ce23bd29b5653a89facbc2
Reviewed-on: https://go-review.googlesource.com/113996
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We delayed doing this for 4 years for fear that it might break something,
but it was standardized (RFC 4329) 12 years ago, and the default in Debian
and other places is correct:
$ cat /etc/mime.types | grep js$
application/javascript js
Time for us to change too.
I doubt there will be problems, but we'll see during the Go 1.11 beta.
Fixes#7498
Change-Id: Iba0bf8a6e707a64dd63317e1c0d6dd9a18634527
Reviewed-on: https://go-review.googlesource.com/120058
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The git clone url should be a Gerrit host and not Github, otherwise the
codereview command will fail.
git-codereview: failed to load Gerrit origin: git origin must be a Gerrit host, not GitHub: https://github.com/golang/go
Change-Id: I62f62c86ee6dce0720a844fc56340135dfae8405
Reviewed-on: https://go-review.googlesource.com/117178
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
ServerKeyExchange and CertificateVerify can share the same logic for
picking a signature algorithm (based on the certificate public key and
advertised algorithms), selecting a hash algorithm (depending on TLS
version) and signature verification.
Refactor the code to achieve code reuse, have common error checking
(especially for intersecting supported signature algorithms) and to
prepare for addition of new signature algorithms. Code should be easier
to read since version-dependent logic is concentrated at one place.
Change-Id: I978dec3815d28e33c3cfbc85f0c704b1894c25a3
Reviewed-on: https://go-review.googlesource.com/79735
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Instead of "inconsistent poll.fdMutex", panic with
"too many concurrent operations on a single file or socket (max 1048575)".
Fixes#25558
Change-Id: I5cad3633aa539fb6f48cca236c6656c86acfb663
Reviewed-on: https://go-review.googlesource.com/119956
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This change was introduced while adding the dark copy
of golang.org/x/vgo in CL 118095.
While the comment made sense in a separate vgo repo, when it is
merged with the main repo, this should not remain.
Found while running mkalldocs.sh in CL 119695.
Change-Id: I112a4629c415032bd29e165ac1c27a0f3cabeede
Reviewed-on: https://go-review.googlesource.com/119938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When used with the go tool, gccgo will normally generate archive files.
This change teaches the gccgoimporter package how to read the export
data from an archive.
This is needed by, for example, cmd/vet, when typechecking packages.
Change-Id: I21267949a7808cd81c0042af425c774a4ff7d82f
Reviewed-on: https://go-review.googlesource.com/119895
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Current versions of gccgo issue a duplicate definition error when both
a definition and an empty declaration occur. Use build tags to avoid
that case for the issue9400 subdirectory.
Change-Id: I18517af87bab05e9ca43f2f295459cf34347c317
Reviewed-on: https://go-review.googlesource.com/119896
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
num cpu unit test fixes for FreeBSD.
cpuset -g can possibly output more
data than expected.
Fixes#25924
Change-Id: Iec45a919df68648759331da7cd1fa3b9f3ca4241
GitHub-Last-Rev: 4cc275b519
GitHub-Pull-Request: golang/go#25931
Reviewed-on: https://go-review.googlesource.com/119376
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Since we're going to start compressing DWARF on Windows and maybe
Darwin, copy the ELF support for .zdebug sections to macho and pe. The
code is almost completely the same across the three.
While I was here I added support for compressed .debug_type sections,
which I presume were overlooked before.
Tests will come in a later CL once we can actually generate compressed
PE/Mach-O binaries, since there's no other good way to get test data.
Updates #25927, #11799
Change-Id: Ie920b6a16e9270bc3df214ce601a263837810376
Reviewed-on: https://go-review.googlesource.com/119815
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
The name was "Mac OS X" during versions 10.0 to 10.7.
It was renamed to "OS X" starting from 10.8 until 10.11.
The current name is "macOS" starting with 10.12. [1]
Previous changes (e.g., CL 47252) updated "Mac OS X" to macOS
in some places, but not everywhere. This CL updates remaining
instances for consistency.
Only the pages that display current information were updated;
historical pages such as release notes for older Go releases,
past articles, blog posts, etc., were left in original form.
Rename the "#osx" anchor to "#macos" on /doc/install page,
along with the single reference to it on the same page.
Add an empty div with id="osx" to not break old links.
Update minimum macOS version from 10.8 to 10.10 per #23122.
[1]: https://en.wikipedia.org/wiki/macOS#History
Updates #23122.
Change-Id: I69fe4b85e83265b9d99f447e3cc5230dde094869
Reviewed-on: https://go-review.googlesource.com/119855
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Normalized all panic checks and added inexact aliasing panics across
Stream, Block, BlockMode and AEAD implementations.
Also, tweaked the aliasing docs of cipher.AEAD, as they did not account
for the append nature of the API.
Fixes#21624
Change-Id: I075c4415f59b3c06e3099bd9f76de6d12af086bf
Reviewed-on: https://go-review.googlesource.com/109697
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Adds the appropriate check to inl.go.
Includes tests of both -race+go:norace and plain go:norace.
Fixes#24651.
Change-Id: Id806342430c20baf4679a985d12eea3b677092e0
Reviewed-on: https://go-review.googlesource.com/119195
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>