]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agodatabase/sql: fix driver Conn refcounting with prepared statements
Brad Fitzpatrick [Thu, 25 Apr 2013 21:45:56 +0000 (14:45 -0700)]
database/sql: fix driver Conn refcounting with prepared statements

The refcounting of driver Conns was completedly busted and
would leak (be held open forever) with any reasonable
load. This was a significant regression from Go 1.0.

The core of this patch is removing one line:

     s.db.addDep(dc, s)

A database conn (dc) is a resource that be re-created any time
(but cached for speed) should not be held open forever with a
dependency refcount just because the Stmt (s) is alive (which
typically last for long periods of time, like forever).

The meat of the patch is new tests. In fixing the real issue,
a lot of tests then failed due to the fakedb_test.go's paranoia
about closing a fakeConn while it has open fakeStmts on it. I
could've ignored that, but that's been a problem in the past for
other bugs.

Instead, I now track per-Conn open statements and close them
when the the conn closes.  The proper way to do this would've
been making *driverStmt a finalCloser and using the dep mechanism,
but it was much more invasive. Added a TODO instead.

I'd like to give a way for drivers to opt-out of caring about
driver.Stmt closes before a driver.Conn close, but that's a TODO
for the future, and that TODO is added in this CL.

I know this is very late for Go 1.1, but database/sql is
currently nearly useless without this.

I'd like to believe all these database/sql bugs in the past
release cycle are the result of increased usage, number of
drivers, and good feedback from increasingly-capable Go
developers, and not the result of me sucking.  It's also hard
with all the real drivers being out-of-tree, so I'm having to
add more and more hooks to fakedb_test.go to simulate things
which real drivers end up doing.

Fixes #5323

R=golang-dev, snaury, gwenn.kahz, google, r
CC=golang-dev
https://golang.org/cl/8836045

12 years agocmd/gc: initialize t->width in dgcsym() if required
Jan Ziak [Thu, 25 Apr 2013 16:47:12 +0000 (18:47 +0200)]
cmd/gc: initialize t->width in dgcsym() if required

Update #5291.

R=golang-dev, daniel.morsing, iant, r
CC=golang-dev
https://golang.org/cl/8663052

12 years agoundo CL 8954044 / ad3c2ffb16d7
Jan Ziak [Thu, 25 Apr 2013 16:12:09 +0000 (18:12 +0200)]
undo CL 8954044 / ad3c2ffb16d7

It works on i386, but fails on amd64 and arm.

««« original CL description
runtime: prevent the GC from seeing the content of a frame in runfinq()

Fixes #5348.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8954044
»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8695051

12 years agoruntime: prevent the GC from seeing the content of a frame in runfinq()
Jan Ziak [Thu, 25 Apr 2013 11:39:09 +0000 (13:39 +0200)]
runtime: prevent the GC from seeing the content of a frame in runfinq()

Fixes #5348.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8954044

12 years agonet: deflake raw IP protocol entry test on Windows
Mikio Hara [Thu, 25 Apr 2013 04:23:24 +0000 (13:23 +0900)]
net: deflake raw IP protocol entry test on Windows

Update #5344

R=golang-dev, dave, r, alex.brainman
CC=golang-dev
https://golang.org/cl/8934043

12 years agocmd/vet: clean up the test
Rob Pike [Wed, 24 Apr 2013 17:40:29 +0000 (10:40 -0700)]
cmd/vet: clean up the test
- clean up the notypes version of the test so it's quiet
- change the package in the buildtag test to avoid confusing godoc

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/8671049

12 years agocmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks
Ian Lance Taylor [Wed, 24 Apr 2013 15:13:01 +0000 (08:13 -0700)]
cmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks

R=r, ken, khr, daniel.morsing
CC=dsymonds, golang-dev, rickyz
https://golang.org/cl/8925043

12 years agonet: add missing File method document
Mikio Hara [Tue, 23 Apr 2013 23:32:11 +0000 (08:32 +0900)]
net: add missing File method document

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8698049

12 years agocmd/dist: fix line numbers in goc2c generated files
Anthony Martin [Tue, 23 Apr 2013 23:02:50 +0000 (16:02 -0700)]
cmd/dist: fix line numbers in goc2c generated files

We have to reset the global lineno variable before
processing each file otherwise line numbers will be
offset by the number of lines in the previous file.

The following examples are from the beginning of the
ztime_linux_amd64.c file which is generated from
time.goc in the runtime package.

Before:
    #line 2483 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 2492 "/home/apm/src/go/src/pkg/runtime/time.goc"

After:
    #line 16 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 25 "/home/apm/src/go/src/pkg/runtime/time.goc"

R=golang-dev, minux.ma, iant, r, adg
CC=golang-dev
https://golang.org/cl/8653045

12 years agoall: fix typos
Shenghou Ma [Tue, 23 Apr 2013 20:46:14 +0000 (04:46 +0800)]
all: fix typos

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8896045

12 years agodoc/code.html: remove doubled word; modify the tab to space.
Oling Cat [Tue, 23 Apr 2013 20:13:51 +0000 (13:13 -0700)]
doc/code.html: remove doubled word; modify the tab to space.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8919043

12 years agodoc: fix typo in race_detector.html
Jeremy Jackins [Tue, 23 Apr 2013 20:11:58 +0000 (13:11 -0700)]
doc: fix typo in race_detector.html

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8625044

12 years agodoc/effective_go.html: fix syntax error in code example
Shenghou Ma [Tue, 23 Apr 2013 19:51:31 +0000 (03:51 +0800)]
doc/effective_go.html: fix syntax error in code example
Fixes #5333.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8698046

12 years agonet: fix protocol number for IPv6 test
Mikio Hara [Tue, 23 Apr 2013 11:30:42 +0000 (20:30 +0900)]
net: fix protocol number for IPv6 test

The protocol number of ICMP for IPv6 is 58, not 1.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8663048

12 years agotime: fix typo in comment
Christian Himpel [Tue, 23 Apr 2013 05:09:11 +0000 (22:09 -0700)]
time: fix typo in comment

R=r
CC=golang-dev
https://golang.org/cl/8889045

12 years agolib/time: update to IANA 2013c
Rob Pike [Mon, 22 Apr 2013 23:28:42 +0000 (16:28 -0700)]
lib/time: update to IANA 2013c
This should do it for the release.
There was a new data set pushed out a couple of days ago.

Fixes #4553.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8621044

12 years agotime: fix typo in comment
Rob Pike [Mon, 22 Apr 2013 22:41:06 +0000 (15:41 -0700)]
time: fix typo in comment

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8915043

12 years agomisc/cgo/testso: enable test on windows
Shenghou Ma [Mon, 22 Apr 2013 20:42:04 +0000 (04:42 +0800)]
misc/cgo/testso: enable test on windows
Depends on CL 8715043 and CL 8676050.
Fixes #5273.

R=alex.brainman, r
CC=gobot, golang-dev
https://golang.org/cl/8764043

12 years agotime: improve the explanation of the working of Format and Parse
Rob Pike [Mon, 22 Apr 2013 18:36:17 +0000 (11:36 -0700)]
time: improve the explanation of the working of Format and Parse
Change the term 'standard time', which already means something,
to 'reference time', and add a couple of sentences and clarifications.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8799047

12 years agonet/http: make CloseNotifier channel buffered to not leak goroutines
Brad Fitzpatrick [Mon, 22 Apr 2013 17:32:10 +0000 (10:32 -0700)]
net/http: make CloseNotifier channel buffered to not leak goroutines

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8911044

12 years agodoc: fix typo in Effective Go
Andrew Gerrand [Mon, 22 Apr 2013 14:57:23 +0000 (16:57 +0200)]
doc: fix typo in Effective Go

Fixes #5329.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8897044

12 years agodoc: add missing <code> to go1.1.html
Jonathan Rudenberg [Sun, 21 Apr 2013 11:10:19 +0000 (13:10 +0200)]
doc: add missing <code> to go1.1.html

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8880043

12 years agoapi: update next.txt; add io.ErrNoProgress
Brad Fitzpatrick [Sun, 21 Apr 2013 00:20:58 +0000 (17:20 -0700)]
api: update next.txt; add io.ErrNoProgress

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8887043

12 years agosort: don't depend on math
Brad Fitzpatrick [Sun, 21 Apr 2013 00:20:41 +0000 (17:20 -0700)]
sort: don't depend on math

No reason to pull in math just for x != x.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8886043

12 years agonet/http: fix a panic in Redirect
Brad Fitzpatrick [Sun, 21 Apr 2013 00:20:14 +0000 (17:20 -0700)]
net/http: fix a panic in Redirect

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/8721045

12 years agocmd/ld: do not relocate ignored PE sections
Alex Brainman [Sat, 20 Apr 2013 07:42:14 +0000 (17:42 +1000)]
cmd/ld: do not relocate ignored PE sections

This should have been part of CL8715043.

Update #5106

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/8676050

12 years agonet: enable test for runtime.PollDesc leak
Mikio Hara [Sat, 20 Apr 2013 00:04:20 +0000 (09:04 +0900)]
net: enable test for runtime.PollDesc leak

Update #5219.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/8602047

12 years agodoc: fix another broken link
Brad Fitzpatrick [Fri, 19 Apr 2013 19:00:40 +0000 (12:00 -0700)]
doc: fix another broken link

Fixes #5316

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/8871043

12 years agocmd/ld: don't show cursym in gcc invocation failure message
Shenghou Ma [Fri, 19 Apr 2013 18:44:16 +0000 (02:44 +0800)]
cmd/ld: don't show cursym in gcc invocation failure message
before:
fmt.statictmp_0731:/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100
now:
/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8827045

12 years agobufio.Scan: don't stop after Read returns 0, nil
Rob Pike [Fri, 19 Apr 2013 00:37:21 +0000 (17:37 -0700)]
bufio.Scan: don't stop after Read returns 0, nil
But stop eventually if the reader misbehaves.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8757045

12 years agodoc/go1.1.html: document io.ErrNoProgress
Rob Pike [Fri, 19 Apr 2013 00:37:09 +0000 (17:37 -0700)]
doc/go1.1.html: document io.ErrNoProgress

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8833050

12 years agoio: explain what (0,nil) means from Read
Rob Pike [Fri, 19 Apr 2013 00:36:25 +0000 (17:36 -0700)]
io: explain what (0,nil) means from Read
Also add a new variable ErrNoProgress that io.Readers can use to
report ineffectual Read calls.
Fixes #5310.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/8845043

12 years agodoc: fix another broken link
Brad Fitzpatrick [Thu, 18 Apr 2013 21:48:54 +0000 (14:48 -0700)]
doc: fix another broken link

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8763045

12 years agobuiltin: document true and false.
Robert Griesemer [Thu, 18 Apr 2013 21:36:08 +0000 (14:36 -0700)]
builtin: document true and false.

Fixes #5315.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8841048

12 years agodoc: misc tweaks, new links, fix broken links
Brad Fitzpatrick [Thu, 18 Apr 2013 19:43:23 +0000 (12:43 -0700)]
doc: misc tweaks, new links, fix broken links

I read docs and wrote a crawler + link checker on the plane,
which also checks for #fragments. I'll send that out later
when it's less gross.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8729050

12 years agomisc/dashboard/builder: always do a native build
Dave Cheney [Thu, 18 Apr 2013 06:42:56 +0000 (16:42 +1000)]
misc/dashboard/builder: always do a native build

https://golang.org/cl/8134043 disabled cgo when cross compiling, this means builders which compile for both amd64 and 386 will be compiling the latter with cgo disabled.

This proposal modifies the builder to mirror the dist tool by always doing a native build.

Tested on my darwin/amd64 builder and confirmed the result when building darwin/386 is a native 386 build with cgo enabled.

R=bradfitz, dsymonds, r, adg
CC=golang-dev
https://golang.org/cl/8842044

12 years agocrypto/rand: better panic message for invalid Int argument.
Rémy Oudompheng [Thu, 18 Apr 2013 06:21:15 +0000 (23:21 -0700)]
crypto/rand: better panic message for invalid Int argument.

Also document the panic to be consistent with math/rand.

Fixes #5187.

R=golang-dev, dave, bradfitz, r
CC=golang-dev
https://golang.org/cl/8303043

12 years agomime/multipart: don't strip leading space/tab in quoted-printable decoding
Brad Fitzpatrick [Thu, 18 Apr 2013 03:04:58 +0000 (20:04 -0700)]
mime/multipart: don't strip leading space/tab in quoted-printable decoding

Late bug fix, but this is arguably a regression from Go 1.0,
since we added this transparent decoding since then. Without
this fix, Go 1.0 users could decode this correctly, but Go 1.1
users would not be able to.

The newly added test is from the RFC itself.

The updated tests had the wrong "want" values before. They
were there to test \r\n vs \n equivalence (which is
unchanged), not leading whitespace.

The skipWhite decoder struct field was added in the battles of
Issue 4771 in revision b3bb265bfecf. It was just a wrong
strategy, from an earlier round of attempts in
https://golang.org/cl/7300092/

Update #4771
Fixes #5295

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8536045

12 years agomisc/dashboard/builder: include $USER in build environment.
David Symonds [Thu, 18 Apr 2013 01:04:20 +0000 (11:04 +1000)]
misc/dashboard/builder: include $USER in build environment.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8821046

12 years agodoc/go1.1.html, mime/multipart: document quoted-printable decoding
Brad Fitzpatrick [Wed, 17 Apr 2013 20:25:28 +0000 (13:25 -0700)]
doc/go1.1.html, mime/multipart: document quoted-printable decoding

Fixes #5293

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8840043

12 years agoarchive/zip: add docs on type of slashes in paths
Brad Fitzpatrick [Wed, 17 Apr 2013 20:25:12 +0000 (13:25 -0700)]
archive/zip: add docs on type of slashes in paths

Fixes #5307

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8676046

12 years agogo/token: fix grammar for precedence consts
Alexei Sholik [Wed, 17 Apr 2013 18:46:30 +0000 (11:46 -0700)]
go/token: fix grammar for precedence consts

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8662045

12 years agomisc/cgo/test: fix a gcc warning
Shenghou Ma [Wed, 17 Apr 2013 18:33:55 +0000 (02:33 +0800)]
misc/cgo/test: fix a gcc warning
See https://code.google.com/p/go/issues/detail?id=5227#c16.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8833044

12 years agodoc: more doubled words
Rob Pike [Tue, 16 Apr 2013 21:20:06 +0000 (14:20 -0700)]
doc: more doubled words
I wrote a tool.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8695047

12 years agodoc/effective_go: another doubled word
Rob Pike [Tue, 16 Apr 2013 20:59:10 +0000 (13:59 -0700)]
doc/effective_go: another doubled word
It's clear that that should never happen.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8798045

12 years agodoc/effective_go.html: fix typo
Shenghou Ma [Tue, 16 Apr 2013 20:41:28 +0000 (04:41 +0800)]
doc/effective_go.html: fix typo
Fixes #5296.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8682044

12 years agocmd/dist, make.bash: pass -mmacosx-version-min=10.6 to gcc on Darwin
Shenghou Ma [Tue, 16 Apr 2013 20:30:52 +0000 (13:30 -0700)]
cmd/dist, make.bash: pass -mmacosx-version-min=10.6 to gcc on Darwin
Fixes #5261.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8798044

12 years agoruntime: if span was scavenged, mark it as needing to be zeroed
Ian Lance Taylor [Tue, 16 Apr 2013 16:08:06 +0000 (09:08 -0700)]
runtime: if span was scavenged, mark it as needing to be zeroed

Update #4979.

R=dvyukov, r, bradfitz
CC=golang-dev
https://golang.org/cl/8697045

12 years agodatabase/sql: close driver Stmt before releasing Conn
Brad Fitzpatrick [Mon, 15 Apr 2013 21:06:41 +0000 (14:06 -0700)]
database/sql: close driver Stmt before releasing Conn

From the issue, which describes it as well as I could:

database/sql assumes that driver.Stmt.Close does not need the
connection.

see database/sql/sql.go:1308:

This puts the Rows' connection back into the idle pool, and
then calls the driver.Stmt.Close method of the Stmt it belongs
to.  In the postgresql driver implementation
(https://github.com/lib/pq), Stmt.Close communicates with the
server (on the connection that was just put back into the idle
pool).  Most of the time, this causes no problems, but if
another goroutine makes a query at the right (wrong?) time,
chaos results.

In any case, traffic is being sent on "free" connections
shortly after they are freed, leading to race conditions that
kill the driver code.

Fixes #5283

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8633044

12 years agodoc/reference.html: update list of sub-repositories.
Shenghou Ma [Mon, 15 Apr 2013 20:31:25 +0000 (04:31 +0800)]
doc/reference.html: update list of sub-repositories.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8766043

12 years agonet/http/cookiejar: mention go.net/publicsuffix.
Shenghou Ma [Mon, 15 Apr 2013 20:29:55 +0000 (04:29 +0800)]
net/http/cookiejar: mention go.net/publicsuffix.

R=golang-dev, r, gary.burd, dr.volker.dobler
CC=golang-dev
https://golang.org/cl/8660046

12 years agotest/stress: start of a runtime stress program
Brad Fitzpatrick [Mon, 15 Apr 2013 18:50:14 +0000 (11:50 -0700)]
test/stress: start of a runtime stress program

Runs forever, stressing the runtime in various ways.

It should never terminate.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/8583047

12 years agocmd/ld: ignore PE sections that are not code or data
Ian Lance Taylor [Mon, 15 Apr 2013 17:35:37 +0000 (10:35 -0700)]
cmd/ld: ignore PE sections that are not code or data

Update #5106
Update #5273

R=minux.ma, r
CC=golang-dev
https://golang.org/cl/8715043

12 years agoruntime: fix build on openbsd/386
Joel Sing [Mon, 15 Apr 2013 17:20:24 +0000 (10:20 -0700)]
runtime: fix build on openbsd/386

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8569043

12 years agocrypto/ecdsa: doc cleanup
Brad Fitzpatrick [Sun, 14 Apr 2013 06:09:08 +0000 (23:09 -0700)]
crypto/ecdsa: doc cleanup

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/8592044

12 years agodoc: fix typo
Stefan Nilsson [Sat, 13 Apr 2013 23:22:57 +0000 (09:22 +1000)]
doc: fix typo

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8729045

12 years agocmd/gc: disable inlining of method values
Daniel Morsing [Sat, 13 Apr 2013 06:22:16 +0000 (08:22 +0200)]
cmd/gc: disable inlining of method values

They caused internal compiler errors and they're expensive enough that inlining them doesn't make sense.

Fixes #5259.

R=golang-dev, r, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/8636043

12 years agogo/scanner: reject BOMs that are not at the beginning
Robert Griesemer [Sat, 13 Apr 2013 04:28:38 +0000 (21:28 -0700)]
go/scanner: reject BOMs that are not at the beginning

For compliance with gc. See also issue 5265.
Not Go1.1 critical, but harmless.

R=r
CC=golang-dev
https://golang.org/cl/8736043

12 years agotesting/iotest: rephrase DataErrReader's description
Alexei Sholik [Fri, 12 Apr 2013 23:08:56 +0000 (16:08 -0700)]
testing/iotest: rephrase DataErrReader's description

R=r
CC=golang-dev
https://golang.org/cl/8650044

12 years agotest: make goprint.go wait longer for go its routine to execute
Carl Shapiro [Fri, 12 Apr 2013 23:04:19 +0000 (16:04 -0700)]
test: make goprint.go wait longer for go its routine to execute

Update #5281

R=golang-dev, r, bradfitz, cshapiro
CC=golang-dev
https://golang.org/cl/8631047

12 years agotest: raise the allocation threshold for chan/select2.go failure
Carl Shapiro [Fri, 12 Apr 2013 22:58:34 +0000 (15:58 -0700)]
test: raise the allocation threshold for chan/select2.go failure

Updates #5282

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8718045

12 years agocmd/go: quote command line arguments in debug output
Volker Dobler [Fri, 12 Apr 2013 21:05:14 +0000 (14:05 -0700)]
cmd/go: quote command line arguments in debug output

Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043

12 years agocmd/go: quote command line arguments in debug output
Volker Dobler [Fri, 12 Apr 2013 21:04:00 +0000 (14:04 -0700)]
cmd/go: quote command line arguments in debug output

Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043

12 years agocmd/ld: always do external link for -linkmode=external
Ian Lance Taylor [Fri, 12 Apr 2013 20:21:17 +0000 (13:21 -0700)]
cmd/ld: always do external link for -linkmode=external

There are tests in run.bash for -linkmode=external.

Fixes #5238.

R=golang-dev, bradfitz, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/8716044

12 years agocmd/ld: if we fail from an unexpected PE flags value, print it
Ian Lance Taylor [Fri, 12 Apr 2013 14:58:50 +0000 (07:58 -0700)]
cmd/ld: if we fail from an unexpected PE flags value, print it

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8709043

12 years agoruntime: add a hook to disable precise GC
Ian Lance Taylor [Fri, 12 Apr 2013 12:23:38 +0000 (05:23 -0700)]
runtime: add a hook to disable precise GC

This will let us ask people to rebuild the Go system without
precise GC, and then rebuild and retest their program, to see
if precise GC is causing whatever problem they are having.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8700043

12 years agoruntime: use UMTX_OP_WAIT_UINT on FreeBSD
Ian Lance Taylor [Fri, 12 Apr 2013 12:20:15 +0000 (05:20 -0700)]
runtime: use UMTX_OP_WAIT_UINT on FreeBSD

UMTX_OP_WAIT expects that the address points to a uintptr, but
the code in lock_futex.c uses a uint32.  UMTX_OP_WAIT_UINT is
just like UMTX_OP_WAIT, but the address points to a uint32.
This almost certainly makes no difference on a little-endian
system, but since the kernel supports it we should do the
right thing.  And, who knows, maybe it matters.

R=golang-dev, bradfitz, r, ality
CC=golang-dev
https://golang.org/cl/8699043

12 years agomisc/dist/darwin: add execute bit to preinstall
Rob Pike [Thu, 11 Apr 2013 20:40:14 +0000 (13:40 -0700)]
misc/dist/darwin: add execute bit to preinstall
Fixes #5258.

R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/8682043

12 years agoencoding/json: documentation regarding anonymous fields.
Rob Pike [Thu, 11 Apr 2013 19:46:23 +0000 (12:46 -0700)]
encoding/json: documentation regarding anonymous fields.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8545046

12 years agogc: escape unicode BOM in exported string literals
Volker Dobler [Thu, 11 Apr 2013 18:45:18 +0000 (11:45 -0700)]
gc: escape unicode BOM in exported string literals

Fixes #5260.

R=golang-dev, minux.ma, 0xjnml, r
CC=golang-dev
https://golang.org/cl/8658043

12 years agospec: add another sentence about BOMs
Rob Pike [Thu, 11 Apr 2013 18:33:25 +0000 (11:33 -0700)]
spec: add another sentence about BOMs
Although one may argue that they should be legal, gc (at least)
disallows byte order marks that are not the first code point
in the file. Added a sentence to the "Implementation restriction"
clause in the "Source code representation" section to document
this better.

Lifting this restriction (again - the rule has changed at least
twice already) would not break any existing programs, should
we later decide yet again to fiddle the rules about these little
fly specks.

R=golang-dev, dsymonds, gri
CC=golang-dev
https://golang.org/cl/8649043

12 years ago cmd/cgo, cmd/go: remove #cgo directive parsing from cmd/cgo
Andrew Wilkins [Thu, 11 Apr 2013 04:41:54 +0000 (21:41 -0700)]
cmd/cgo, cmd/go: remove #cgo directive parsing from cmd/cgo

This change removes processing of #cgo directives from cmd/cgo,
pushing the onus back on cmd/go to pass all necessary flags.

Fixes #5224. See comments for rationale.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8610044

12 years agobufio/Scan: fix error handling at EOF
Rob Pike [Thu, 11 Apr 2013 03:58:19 +0000 (20:58 -0700)]
bufio/Scan: fix error handling at EOF
Fixes #5268.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/8646045

12 years agocmd/ld: fix scope of static objects in symbol table
Anthony Martin [Thu, 11 Apr 2013 01:47:58 +0000 (18:47 -0700)]
cmd/ld: fix scope of static objects in symbol table

All symbols are currently marked with global scope.
The correct behavior was lost when the symbol table
format was changed.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8625043

12 years agofmt: tweak the explanation of Stringer to be more correct and less specific
Rob Pike [Wed, 10 Apr 2013 21:05:34 +0000 (14:05 -0700)]
fmt: tweak the explanation of Stringer to be more correct and less specific
The String method is called whenever the printing operation wants a string,
not just for %s and %v.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8638043

12 years agogo/ast: distinguish between methods and functions in filtering
Robert Griesemer [Wed, 10 Apr 2013 20:39:20 +0000 (13:39 -0700)]
go/ast: distinguish between methods and functions in filtering

Go1.1 harmless, but not critical.

Fixes #5249.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8609043

12 years agoencoding/json: different decision on tags and shadowing
Rob Pike [Wed, 10 Apr 2013 20:05:34 +0000 (13:05 -0700)]
encoding/json: different decision on tags and shadowing
If there are no tags, the rules are the same as before.
If there is a tagged field, choose it if there is exactly one
at the top level of all fields.
More tests. The old tests were clearly inadequate, since
they all pass as is. The new tests only work with the new code.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8617044

12 years agocmd/ld: fix argument passing in doc.go
Shenghou Ma [Wed, 10 Apr 2013 20:04:02 +0000 (04:04 +0800)]
cmd/ld: fix argument passing in doc.go

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8622043

12 years agocmd/ld: fix inconsistency in internal linking of common symbols.
Rémy Oudompheng [Wed, 10 Apr 2013 05:15:49 +0000 (07:15 +0200)]
cmd/ld: fix inconsistency in internal linking of common symbols.

Some variables declared in C could end up as undefined symbols
in the final binary and have null address.

Fixes #5114.
Fixes #5227.

R=golang-dev, iant, ajstarks, dave, r
CC=golang-dev
https://golang.org/cl/8602044

12 years agoencoding/json: fix handling of anonymous fields
Rob Pike [Tue, 9 Apr 2013 22:00:21 +0000 (15:00 -0700)]
encoding/json: fix handling of anonymous fields
The old code was incorrect and also broken. It passed the tests by accident.
The new algorithm is:
        1) Sort the fields in order of names.
        2) For all fields with the same name, sort in increasing depth.
        3) Choose the single field with shortest depth.
If any of the fields of a given name has a tag, do the above using
tagged fields of that name only.
Fixes #5245.

R=iant
CC=golang-dev
https://golang.org/cl/8583044

12 years agoio: document non-guarantees of io.Closer
Brad Fitzpatrick [Tue, 9 Apr 2013 17:17:35 +0000 (10:17 -0700)]
io: document non-guarantees of io.Closer

R=r, golang-dev
CC=golang-dev
https://golang.org/cl/8575043

12 years agolib9: add newline to exec error message
Ian Lance Taylor [Tue, 9 Apr 2013 17:03:14 +0000 (10:03 -0700)]
lib9: add newline to exec error message

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8573043

12 years agodist: add .exe extension to tour.exe
Andrew Gerrand [Tue, 9 Apr 2013 08:17:55 +0000 (18:17 +1000)]
dist: add .exe extension to tour.exe

Fixes #5246.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8558044

12 years agodist: include js directory in misc/tour in binary distros
Andrew Gerrand [Tue, 9 Apr 2013 07:51:55 +0000 (17:51 +1000)]
dist: include js directory in misc/tour in binary distros

R=campoy, dsymonds
CC=golang-dev
https://golang.org/cl/8564043

12 years agonet: fix possible runtime.PollDesc leak when connect or listen fails
Mikio Hara [Tue, 9 Apr 2013 03:41:58 +0000 (12:41 +0900)]
net: fix possible runtime.PollDesc leak when connect or listen fails

Makes it possible to return the spent runtime.PollDesc to
runtime.pollcache descriptor pool when netFD.connect or
syscall.Listen fails.

Fixes #5219.

R=dvyukov, dave, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8318044

12 years agoA+C: Nicholas Presta (individual CLA)
Andrew Gerrand [Tue, 9 Apr 2013 03:12:31 +0000 (13:12 +1000)]
A+C: Nicholas Presta (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/8556044

12 years agorun.bat: make windows runtime test timeout same as other os
Alex Brainman [Tue, 9 Apr 2013 03:01:09 +0000 (13:01 +1000)]
run.bat: make windows runtime test timeout same as other os

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8551043

12 years agomisc/dashboard/builder: add -race builder support
Dave Cheney [Tue, 9 Apr 2013 02:48:04 +0000 (12:48 +1000)]
misc/dashboard/builder: add -race builder support

If the build key contains -race, the builder will invoke to the race.{bat,bash} build command. This allows {darwin,linux,windows}-amd64 builders to do race and non race builds in sequence.

R=adg, dvyukov, fullung
CC=golang-dev
https://golang.org/cl/8266046

12 years agoruntime: fix integer overflow in hashmap
Dmitriy Vyukov [Tue, 9 Apr 2013 01:56:38 +0000 (18:56 -0700)]
runtime: fix integer overflow in hashmap
The test is problematic, because it requires 8GB+ of RAM.
Fixes #5239.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8550043

12 years agonet: add test for runtime.PollDesc leak
Dave Cheney [Tue, 9 Apr 2013 01:14:22 +0000 (11:14 +1000)]
net: add test for runtime.PollDesc leak

See 8318044

R=bradfitz
CC=golang-dev
https://golang.org/cl/8547043

12 years agocmd/cgo: record CGO_LDFLAGS env var in _cgo_flags
Andrew Wilkins [Mon, 8 Apr 2013 23:35:06 +0000 (07:35 +0800)]
cmd/cgo: record CGO_LDFLAGS env var in _cgo_flags

cgo stores cgo LDFLAGS in _cgo_flags and _cgo_defun.c.
The _cgo_defun.c records the flags via
"#pragma cgo_ldflag <flag>", which external linking
relies upon for passing libraries (and search paths)
to the host linker.

The go command will allow LDFLAGS for cgo to be passed
through the environment (CGO_LDFLAGS); cgo ignores
this environment variable, and so its value doesn't
make it into the above mentioned files. This CL changes
cgo to record CGO_LDFLAGS also.

Fixes #5205.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/8465043

12 years agosync, sync/atomic: do not corrupt race detector after a nil dereference.
Rémy Oudompheng [Mon, 8 Apr 2013 21:46:54 +0000 (23:46 +0200)]
sync, sync/atomic: do not corrupt race detector after a nil dereference.

The race detector uses a global lock to analyze atomic
operations. A panic in the middle of the code leaves the
lock acquired.

Similarly, the sync package may leave the race detectro
inconsistent when methods are called on nil pointers.

R=golang-dev, r, minux.ma, dvyukov, rsc, adg
CC=golang-dev
https://golang.org/cl/7981043

12 years agoruntime: poor man's heap type info checker
Dmitriy Vyukov [Mon, 8 Apr 2013 20:36:35 +0000 (13:36 -0700)]
runtime: poor man's heap type info checker
It's not trivial to make a comprehensive check
due to inferior pointers, reflect, gob, etc.
But this is essentially what I've used to debug
the GC issues.
Update #5193.

R=golang-dev, iant, 0xe2.0x9a.0x9b, r
CC=golang-dev
https://golang.org/cl/8455043

12 years agotest: fix mapnan.go build tag
Brad Fitzpatrick [Mon, 8 Apr 2013 07:09:35 +0000 (00:09 -0700)]
test: fix mapnan.go build tag

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8491044

12 years agocmd/gc: properly set variadic flag on method values.
Rémy Oudompheng [Mon, 8 Apr 2013 06:59:33 +0000 (08:59 +0200)]
cmd/gc: properly set variadic flag on method values.

Fixes #5231.

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/8275044

12 years agocmd/go: fix a misleading sentence
Rob Pike [Mon, 8 Apr 2013 06:27:26 +0000 (23:27 -0700)]
cmd/go: fix a misleading sentence
Apologies for not reviewing the previous CL; I was on the road.
The text was misleading; execution is no more separate than with
any other test. Rewritten. Dropped the odd adverb.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8439045

12 years agocmd/go: clarify what "pkg.test" means wrt the -c flag
Andrew Gerrand [Mon, 8 Apr 2013 06:03:19 +0000 (16:03 +1000)]
cmd/go: clarify what "pkg.test" means wrt the -c flag

Fixes #5230.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8507043

12 years agoarchive/zip: handle trailing data after the end of directory header
Andrew Gerrand [Mon, 8 Apr 2013 05:38:06 +0000 (15:38 +1000)]
archive/zip: handle trailing data after the end of directory header

The spec doesn't explicitly say that trailing data is okay, but a lot
of people do this and most unzippers will handle it just fine. In any
case, this makes the package more useful, and led me to make the
directory parsing code marginally more robust.

Fixes #5228.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8504044

12 years agocmd/go: document usage of external test packages
Kamil Kisiel [Mon, 8 Apr 2013 04:42:06 +0000 (14:42 +1000)]
cmd/go: document usage of external test packages

Fixes #5144

R=golang-dev, r, dave, adg
CC=golang-dev
https://golang.org/cl/8171044

12 years agodoc: fix typos in go1.1.html
Jonathan Rudenberg [Mon, 8 Apr 2013 02:04:50 +0000 (12:04 +1000)]
doc: fix typos in go1.1.html

R=golang-dev, adg, adg
CC=golang-dev
https://golang.org/cl/8488047