1
0
mirror of https://github.com/golang/go synced 2024-09-30 11:18:33 -06:00
Commit Graph

30091 Commits

Author SHA1 Message Date
Paul Marks
5d8324e682 net: add hostname warnings to all first(isIPv4) functions.
In general, these functions cannot behave correctly when given a
hostname, because a hostname may represent multiple IP addresses, and
first(isIPv4) chooses at most one.

Updates #9334

Change-Id: Icfb629f84af4d976476385a3071270253c0000b1
Reviewed-on: https://go-review.googlesource.com/31931
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 04:18:41 +00:00
Russ Cox
71cf409dbd runtime: accept timeout from non-timeout semaphore wait on OS X
Looking at the kernel sources, I don't see how this is possible.
But obviously it is. Just try again.

Fixes #17161.

Change-Id: Iea7d53f7cf75944792d2f75a0d07129831c7bcdb
Reviewed-on: https://go-review.googlesource.com/31823
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 02:51:04 +00:00
Ian Lance Taylor
b4ce38ec57 cmd/cgo: throw if C.malloc returns nil
Change-Id: If7740ac7b6c4190db5a1ab4100d12cf16dc79c84
Reviewed-on: https://go-review.googlesource.com/31768
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-25 02:38:49 +00:00
Hiroshi Ioka
643c6b3c74 path/filepath: make TestToNorm robust
The old code leaves garbages in a temporary directory because it
cannot remove the current working directory on windows.
The new code changes the directory before calling os.Remove.

Furthermore, the old code assumes that ioutil.TempDir (os.TempDir)
doesn't return a relative path nor an UNC path.
If it isn't the case, the new code calls t.Fatal earlier for preventing
ambiguous errors.

Finally, the old code reassigns the variable which is used by the defer
function. It could cause unexpected results, so avoid that.

Change-Id: I5fc3902059ecaf18dc1341ecc4979d1206034cd7
Reviewed-on: https://go-review.googlesource.com/31790
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-10-25 01:57:05 +00:00
Alex Brainman
02c1d8a158 cmd/link/internal/ld: remove goto from ldpe.go
Updates #15345

Change-Id: I447d133512e99a9900928a910e161a85db6e8b75
Reviewed-on: https://go-review.googlesource.com/31792
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 01:22:29 +00:00
Robert Griesemer
c0e2318f7c cmd/compile: simplify parsing of type aliases
Change-Id: Ia86841cf84bc17ff6ecc6e5ac4cec86384a0da00
Reviewed-on: https://go-review.googlesource.com/31719
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-25 00:54:30 +00:00
Robert Griesemer
1b0cf430dd cmd/compile: implement package-level aliases (no export yet)
Requires -newparser=1.

For #17487.
For #16339.

Change-Id: I156fb0c0f8a97e8c72dbbfbd7fe821efee12b957
Reviewed-on: https://go-review.googlesource.com/31597
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-25 00:54:09 +00:00
Josh Bleecher Snyder
7e9f420ddf test: delete bugs directory
It appears to be a vestigial holding ground for bugs.
But we have an issue tracker, and #1909 is there and open.

Change-Id: I912ff222a24c51fab483be0c67dad534f5a84488
Reviewed-on: https://go-review.googlesource.com/31859
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 00:17:57 +00:00
David du Colombier
c63db157bd net: handle "dns failure" as errNoSuchHost on Plan 9
CL 31468 added TestLookupNonLDH, which was failing on Plan 9,
because LookupHost was expecting to return errNoSuchHost
on DNS resolution failure, while Plan 9 returned the
"dns failure" string.

In the Plan 9 implementation of lookupHost, we now return
errNoSuchHost instead of the "dns failure" string, so
the behavior is more consistant with other operating systems.

Fixes #17568.

Change-Id: If64f580dc0626a4a4f19e5511ba2ca5daff5f789
Reviewed-on: https://go-review.googlesource.com/31873
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 00:04:42 +00:00
Brad Fitzpatrick
6e78f76974 testing/quick, text/tabwriter: freeze packages
Fixes #15557

Change-Id: I02ad98068894e75d4e08e271fdd16cb420519460
Reviewed-on: https://go-review.googlesource.com/31910
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-10-24 23:31:50 +00:00
Alexander Döring
4c9c023346 math,math/cmplx: fix linter issues
Change-Id: If061f1f120573cb109d97fa40806e160603cd593
Reviewed-on: https://go-review.googlesource.com/31871
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-24 23:25:46 +00:00
Joshua Boelter
426c287eb6 crypto/tls: add VerifyPeerCertificate to tls.Config
VerifyPeerCertificate returns an error if the peer should not be
trusted. It will be called after the initial handshake and before
any other verification checks on the cert or chain are performed.
This provides the callee an opportunity to augment the certificate
verification.

If VerifyPeerCertificate is not nil and returns an error,
then the handshake will fail.

Fixes #16363

Change-Id: I6a22f199f0e81b6f5d5f37c54d85ab878216bb22
Reviewed-on: https://go-review.googlesource.com/26654
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 23:24:11 +00:00
Josh Bleecher Snyder
93bca632d9 cmd/compile: preserve type information in inrange
Fixes #17551.

Change-Id: I84b7d82654cda3559c119aa56b07f30d0d224865
Reviewed-on: https://go-review.googlesource.com/31857
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-24 22:57:21 +00:00
Cherry Zhang
b55cee1893 cmd/internal/obj/mips: store LR before update SP in function prologue
This prevents the traceback code from seeing a half-updated
stack frame when a profiling signal comes during the execution
of function prologue. Also fixes mips64x part of #17381.

Change-Id: Iec9683427e546e3648b2e8b1dde956d13f6eb938
Reviewed-on: https://go-review.googlesource.com/31721
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-10-24 22:39:15 +00:00
David du Colombier
0c02280fe0 net: fix TestCloseError on Plan 9
Since CL 30614, TestCloseError is failing on Plan 9,
because File.Write now checks f.fd == badFd before
calling syscall.Write.

The f.fd == badFd check returns os.ErrClosed, while
syscall.Write returned a syscall.ErrorString error.

TestCloseError was failing because it expected a
syscall.ErrorString error.

We add a case in parseCloseError to handle the
os.ErrClosed case.

Fixes #17569.

Change-Id: I6b4d956d18ed6d3c2ac5211ffd50a4888f7521e1
Reviewed-on: https://go-review.googlesource.com/31872
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 22:35:03 +00:00
Josh Bleecher Snyder
1fcad29341 cmd/compile: remove OREGISTER, Node.Reg
OREGISTER is unused.

All remaining uses of Node.Reg use REGSP.

Change-Id: I51cf06826867e576baabd568e04f96d2634f5cad
Reviewed-on: https://go-review.googlesource.com/31856
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-24 22:30:17 +00:00
Russ Cox
28269796c8 cmd/internal/objfile: remove debugging print
Crept into CL 9682, committed last week.

Change-Id: I5b8e9119dbfeb0bc3005623ab74dbd29311d17ae
Reviewed-on: https://go-review.googlesource.com/31814
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-24 20:38:04 +00:00
Russ Cox
aeb8b9591c encoding/json: fix bad formatting introduced in CL 20356
Change-Id: I39a8b543e472e5ec5d4807a9b7f61657465c5ce5
Reviewed-on: https://go-review.googlesource.com/31816
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-24 20:37:52 +00:00
Michael Fraenkel
a7cad4110a net/http/httputil: log err encountered during reverseproxy body copying
Fixes #16659

Change-Id: I13dd797e93e0b572eaf8726f1be594870d40183b
Reviewed-on: https://go-review.googlesource.com/30692
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 20:25:09 +00:00
Lynn Boger
95f3e47456 cmd/compile: add rule to use ANDN for a&^b on ppc64x
Adds a rule to generate ANDN for AND x ^y.

Fixes #17567

Change-Id: I3b978058d5663f32c42b1af19bb207eac5622615
Reviewed-on: https://go-review.googlesource.com/31769
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-10-24 19:51:44 +00:00
Matthew Dempsky
7124056f7e cmd/internal/obj: drop Addr's Gotype field
The Gotype field is only used for ATYPE instructions. Instead of
specially storing the Go type symbol in From.Gotype, just store it in
To.Sym like any other 2-argument instruction would.

Modest reduction in allocations:

name       old alloc/op    new alloc/op    delta
Template      42.0MB ± 0%     41.8MB ± 0%  -0.40%         (p=0.000 n=9+10)
Unicode       34.3MB ± 0%     34.1MB ± 0%  -0.48%         (p=0.000 n=9+10)
GoTypes        122MB ± 0%      122MB ± 0%  -0.14%         (p=0.000 n=9+10)
Compiler       518MB ± 0%      518MB ± 0%  -0.04%         (p=0.000 n=9+10)

Passes toolstash -cmp.

Change-Id: I0e603266b5d7d4e405106a26369e22773a0d3a91
Reviewed-on: https://go-review.googlesource.com/31850
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 19:29:18 +00:00
Alan Donovan
07a22dbd34 cmd/vet: cgo: emit no error for calls to C.CBytes
Fixes issue golang/go#17563

Change-Id: Ibb41ea9419907193526cc601f6afd07d8689b1fe
Reviewed-on: https://go-review.googlesource.com/31810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-24 19:05:50 +00:00
Russ Cox
2a3db5c017 cmd/cgo: document C.malloc behavior
Fixes #16309.

Change-Id: Ifcd28b0746e1af30e2519a7b118485aecfb12396
Reviewed-on: https://go-review.googlesource.com/31811
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-24 18:11:55 +00:00
Mohit Agarwal
a6141ebd3f math/big: fix alignment in Float.Parse docs
Leading spaces in a couple of lines instead of tabs cause those to be
misaligned (as seen on <https://golang.org/pkg/math/big/#Float.Parse>):

<<<
	number   = [ sign ] [ prefix ] mantissa [ exponent ] | infinity .
	sign     = "+" | "-" .
     prefix   = "0" ( "x" | "X" | "b" | "B" ) .
	mantissa = digits | digits "." [ digits ] | "." digits .
	exponent = ( "E" | "e" | "p" ) [ sign ] digits .
	digits   = digit { digit } .
	digit    = "0" ... "9" | "a" ... "z" | "A" ... "Z" .
     infinity = [ sign ] ( "inf" | "Inf" ) .
>>>

Replace the leading spaces with tabs so that those align well.

Change-Id: Ibba6cd53f340001bbd929067dc587feb071dc3bd
Reviewed-on: https://go-review.googlesource.com/31830
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 17:59:42 +00:00
Alexander Döring
0fff67d191 database/sql: fix possible context leak in test
Fixes #17560

Change-Id: I96fcdec87220391ef5432571b5c090b5be27491a
Reviewed-on: https://go-review.googlesource.com/31771
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-24 17:56:11 +00:00
Josh Bleecher Snyder
accf5cc386 all: minor vet fixes
Change-Id: I22f0f3e792052762499f632571155768b4052bc9
Reviewed-on: https://go-review.googlesource.com/31759
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 17:27:37 +00:00
Dan Caddigan
212d2f82e0 os: add ErrClosed, return for use of closed File
This is clearer than syscall.EBADF.

Fixes #17320.

Change-Id: I14c6a362f9a6044c9b07cd7965499f4a83d2a860
Reviewed-on: https://go-review.googlesource.com/30614
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-24 16:41:29 +00:00
Russ Cox
452bbfc179 path/filepath: fix match of \\?\c:\* on Windows
\\?\c:\ is a "root directory" that is not subject to further matching,
but the ? makes it look like a pattern, which was causing an
infinite recursion. Make sure the code understands the ? is not a pattern.

Fixes #15879.

Change-Id: I3a4310bbc398bcae764b9f8859c875317345e757
Reviewed-on: https://go-review.googlesource.com/31460
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 16:24:20 +00:00
Russ Cox
c5ccbdd22b net/url: reject colon in first segment of relative path in Parse
RFC 3986 §3.3 disallows relative URL paths in which the first segment
contains a colon, presumably to avoid confusion with scheme:foo syntax,
which is exactly what happened in #16822.

Fixes #16822.

Change-Id: Ie4449e1dd21c5e56e3b126e086c3a0b05da7ff24
Reviewed-on: https://go-review.googlesource.com/31582
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 16:04:47 +00:00
Russ Cox
afe675c2fa doc/faq: mention that copying discussion is semantics, not implementation
Fixes #17181.

Change-Id: If7cc4865e391acf76512f7ec7167d5a31377b598
Reviewed-on: https://go-review.googlesource.com/31574
Reviewed-by: Rob Pike <r@golang.org>
2016-10-24 16:02:09 +00:00
Russ Cox
39690beb58 runtime: fix invariant comment in chan.go
Change-Id: Ic6317f186d0ee68ab1f2d15be9a966a152f61bfb
Reviewed-on: https://go-review.googlesource.com/31610
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-10-24 15:59:28 +00:00
Russ Cox
2693fa15ee html/template: add test case for unbounded template expansion
Fixed by CL 31092 already, but that change is a few steps away
from the problem observed here, so add an explicit test.

Fixes #17019.

Change-Id: If4ece1418e6596b1976961347889ce12c5969637
Reviewed-on: https://go-review.googlesource.com/31466
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:44:30 +00:00
Russ Cox
604146ce89 html/template, text/template: docs and fixes for template redefinition
All prior versions of Go have allowed redefining empty templates
to become non-empty. Unfortunately, that has never consistently
taken effect in html/template after the first execution:

	// define and execute
	t := template.New("root")
	t.Parse(`{{define "T"}}{{end}}<a href="{{template "T"}}">`)
	t.Execute(w, nil) // <a href="">

	// redefine
	t.Parse(`{{define "T"}}my.url{{end}}`) // succeeds, but ignored
	t.Execute(w, nil) // <a href="">

When Go 1.6 added {{block...}} to text/template, that loosened the
redefinition rules to allow redefinition at any time. The loosening was
undone a bit in html/template, although inconsistently:

	// define and execute
	t := template.New("root")
	t.Parse(`{{define "T"}}body{{end}}`)
	t.Lookup("T").Execute(ioutil.Discard, nil)

	// attempt to redefine
	t.Parse(`{{define "T"}}body{{end}}`) // rejected in all Go versions
	t.Lookup("T").Parse("body") // OK as of Go 1.6, likely unintentionally

Like in the empty->non-empty case, whether future execution takes
notice of a redefinition basically can't be explained without going into
the details of the template escape analysis.

Address both the original inconsistencies in whether a redefinition
would have any effect and the new inconsistencies about whether a
redefinition is allowed by adopting a new rule: no parsing or modifying
any templates after the first execution of any template in the same set.
Template analysis begins at first execution, and once template analysis
has begun, we simply don't have the right logic to update the analysis
for incremental modifications (and never have).

If this new rule breaks existing uses of templates that we decide need
to be supported, we can try to invalidate all escape analysis for the
entire set after any modifications. But let's wait on that until we know
we need to and why.

Also fix documentation of text/template redefinition policy
(redefinition is always OK).

Fixes #15761.

Change-Id: I7d58d7c08a7d9df2440ee0d651a5b2ecaff3006c
Reviewed-on: https://go-review.googlesource.com/31464
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-10-24 15:43:24 +00:00
Russ Cox
fa90f9b909 net: there are no invalid domain names anymore
The Go resolver reports invalid domain name for '!!!.local',
but that is allowed by multicast DNS. In general we can't predict
what future relaxations might come along, and libc resolvers
do not distinguish 'no such host' from 'invalid name', so stop
making that distinction here too. Always use 'no such host'.

Fixes #12421.

Change-Id: I8f22604767ec9e270434e483da52b337833bad71
Reviewed-on: https://go-review.googlesource.com/31468
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-24 15:37:26 +00:00
Russ Cox
157ce90abe go/build: allow % in ${SRCDIR} expansion for Jenkins
Fixes #16959.

Change-Id: Ibbb28fdf26c53788a0edb3e3ea54ec030fa2a8cf
Reviewed-on: https://go-review.googlesource.com/31611
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-24 15:35:01 +00:00
Russ Cox
86324f29c6 go/build: do not record go:binary-only-package if build tags not satisfied
This is the documented (and now implemented) behavior.

Fixes #16841.

Change-Id: Ic75adc5ba18303ed9578e04284f32933f905d6a3
Reviewed-on: https://go-review.googlesource.com/31577
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:34:34 +00:00
Russ Cox
ee4b58df61 log: document that log messages end in newlines
Fixes #16564.

Change-Id: Idd7b3c8f1d8415acd952d1efb6dc35ba4191805d
Reviewed-on: https://go-review.googlesource.com/31578
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:32:38 +00:00
Russ Cox
fc88a0f4ce net/mail: expose ParseDate, for use parsing Resent-Date headers
Fixes #16657.

Change-Id: I9425af91a48016b1d7465b9f43cafa792bc00bb3
Reviewed-on: https://go-review.googlesource.com/31581
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:32:28 +00:00
Quentin Smith
699fb0fc5b cmd/doc: continue searching after error reading directory
If a directory in GOPATH is unreadable, we should keep looking for other
packages. Otherwise we can give the misleading error "no buildable Go
source files".

Fixes #16240

Change-Id: I38e1037f56ec463d3c141f0508fb74211cb90f13
Reviewed-on: https://go-review.googlesource.com/31713
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-10-24 15:25:33 +00:00
Russ Cox
8419c85eaa runtime, cmd/link: fix netbsd/arm EABI support
Fixes reported by oshimaya (see #13806).

Fixes #13806.

Change-Id: I9b659ab918a34bc5f7c58f3d7f59058115b7f776
Reviewed-on: https://go-review.googlesource.com/31651
Reviewed-by: Minux Ma <minux@golang.org>
2016-10-24 15:23:13 +00:00
Russ Cox
19adf8aeaa reflect: fix DeepEqual for some cyclic corner cases
Fixes #15610.

Change-Id: Idbc8a9b328b92034d53b8009471678a166d5cf3f
Reviewed-on: https://go-review.googlesource.com/31588
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:20:23 +00:00
Russ Cox
17ad60b8a4 cmd/go: fix test for moved package in go get -u
What matters during go get -u is not whether there is an import comment
but whether we resolved the path by an HTML <meta> tag.

Fixes #16471.

Change-Id: I6b194a3f73a7962a0170b4d5cf51cfed74e02c00
Reviewed-on: https://go-review.googlesource.com/31658
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:17:47 +00:00
Russ Cox
f3b4abd806 cmd/go: allow 'go generate' even if imports do not resolve
Maybe the go generate is generating the imports,
or maybe there's some other good reason the code
is incomplete.

The help text already says:

	Note that go generate does not parse the file, so lines that look
	like directives in comments or multiline strings will be treated
	as directives.

We'll still reject Go source files that don't begin with a package statement
or have a syntax error in the import block, but those are I think more
defensible rejections.

Fixes #16307.

Change-Id: I4f8496c02fdff993f038adfed2df4db7f067dc06
Reviewed-on: https://go-review.googlesource.com/31659
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-10-24 15:17:32 +00:00
Russ Cox
9575882461 cmd/go: document that cmd/foo is only in Go repo, never GOPATH
It's always been like this, so document it.

Fixes #14351.

Change-Id: Ic6a7c44881bac0209fa6863a487fabec5ec0214e
Reviewed-on: https://go-review.googlesource.com/31663
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:17:07 +00:00
Russ Cox
a1813fcb83 cmd/go: referee another vendor vs symlink fight
Avoid crash in the specific case reported in #15201 but also
print more useful error message, avoiding slice panic.

Fixes #15201.
Fixes #16167.
Fixes #16566.

Change-Id: I66499621e9678a05bc9b12b0da77906cd7027bdd
Reviewed-on: https://go-review.googlesource.com/31665
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-24 15:16:08 +00:00
Quentin Smith
0eaa8fe03f bufio: remove unnecessary "continue"
After resizing the scan buffer, we can immediately read into the
newly-resized buffer since we know there is now space.

Fixes #15712.

Change-Id: I56fcfaeb67045ee753a012c37883aa7c81b6e877
Reviewed-on: https://go-review.googlesource.com/31715
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-24 14:49:44 +00:00
Martin Möhrmann
7ff0c8267f cmd/compile: replace ANDL with MOV?ZX
According to "Intel 64 and IA-32 Architectures Optimization Reference
Manual" Section: "3.5.1.13 Zero-Latency MOV Instructions"
MOV?ZX instructions have zero latency on newer processors.

during make.bash:
(ANDLconst [0xFF] x) -> (MOVBQZX x)
applies 422 times
(ANDLconst [0xFFFF] x) -> (MOVWQZX x)
applies 114 times

Updates #15105

Change-Id: I10933af599de3c26449c52f4b5cd859331028f39
Reviewed-on: https://go-review.googlesource.com/31639
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
2016-10-24 14:12:19 +00:00
Alex Brainman
9ac60181e2 runtime/cgo: do not link math lib by default on windows
Makes windows same as others.

Change-Id: Ib4651e06d0bd37473ac345d36c91f39aa8f5e662
Reviewed-on: https://go-review.googlesource.com/31791
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-24 08:09:57 +00:00
Austin Clements
3cbfcaa4ba runtime: make mspan.isFree do what's on the tin
Currently mspan.isFree technically returns whether the object was not
allocated *during this cycle*. Fix it so it actually returns whether
or not the object is allocated so the method is more generally useful
(especially for debugging).

It has one caller, which is carefully written to be insensitive to
this distinction, but this lets us simplify this caller.

Change-Id: I9d79cf784a56015e434961733093c1d8d03fc091
Reviewed-on: https://go-review.googlesource.com/30145
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-10-24 02:33:39 +00:00
Austin Clements
bf9c71cb43 runtime: make morestack less subtle
morestack writes the context pointer to gobuf.ctxt, but since
morestack is written in assembly (and has to be very careful with
state), it does *not* invoke the requisite write barrier for this
write. Instead, we patch this up later, in newstack, where we invoke
an explicit write barrier for ctxt.

This already requires some subtle reasoning, and it's going to get a
lot hairier with the hybrid barrier.

Fix this by simplifying the whole mechanism. Instead of writing
gobuf.ctxt in morestack, just pass the value of the context register
to newstack and let it write it to gobuf.ctxt. This is a normal Go
pointer write, so it gets the normal Go write barrier. No subtle
reasoning required.

Updates #17503.

Change-Id: Ia6bf8459bfefc6828f53682ade32c02412e4db63
Reviewed-on: https://go-review.googlesource.com/31550
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-10-24 02:23:16 +00:00