]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoruntime/race: update runtime to r170112.
Dmitriy Vyukov [Fri, 14 Dec 2012 09:23:43 +0000 (13:23 +0400)]
runtime/race: update runtime to r170112.
This includes GORACE history_size and log_path flags.

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

12 years agocmd/go: handle os signals
Alex Brainman [Fri, 14 Dec 2012 06:33:59 +0000 (17:33 +1100)]
cmd/go: handle os signals

Ignore signals during "go run" and wait for running child
process to exit. Stop executing further tests during "go test",
wait for running tests to exit and report error exit code.

Original CL 6351053 by dfc.

Fixes #3572.
Fixes #3581.

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

12 years agotest: s/float/float32/
Ian Lance Taylor [Thu, 13 Dec 2012 23:11:31 +0000 (15:11 -0800)]
test: s/float/float32/

I just committed a patch to gccgo that notices that float was
never defined, causing an additional unmatched error message.
Rename the type to avoid that message.

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

12 years agoos: Improve the accuracy of os.Chtimes
Nick Craig-Wood [Thu, 13 Dec 2012 21:02:39 +0000 (13:02 -0800)]
os: Improve the accuracy of os.Chtimes

I've been writing some code which involves syncing files (like
rsync) and it became apparent that under Linux I could read
modification times (os.Lstat) with nanosecond precision but
only write them with microsecond precision.  This difference
in precision is rather annoying when trying to discover
whether files need syncing or not!

I've patched syscall and os to increases the accuracy of of
os.Chtimes for Linux and Windows.  This involved exposing the
utimensat system call under Linux and a bit of extra code
under Windows.  I decided not to expose the "at" bit of the
system call as it is impossible to replicate under Windows, so
the patch adds syscall.Utimens() to all architectures along
with a ImplementsUtimens flag.

If the utimensat syscall isn't available (utimensat was added
to Linux in 2.6.22, Released, 8 July 2007) then it silently
falls back to the microsecond accuracy version it uses now.
The improved accuracy for Windows should be good for all
versions of Windows.

Unfortunately Darwin doesn't seem to have a utimensat system
call that I could find so I couldn't implement it there.  The
BSDs do, but since they share their syscall implementation
with Darwin I couldn't figure out how to define a syscall for
*BSD and not Darwin.  I've left this as a TODO in the code.

In the process I implemented the missing methods for Timespec
under Windows which I needed which just happened to round out
the Timespec API for all platforms!

------------------------------------------------------------

Test code: http://play.golang.org/p/1xnGuYOi4b

Linux Before (1000 ns precision)

$ ./utimetest.linux.before z
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST
Reading mtime 1344937903123457000: 2012-08-14 10:51:43.123457 +0100 BST

Linux After (1 ns precision)

$ ./utimetest.linux.after z
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST
Reading mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 BST

Windows Before (1000 ns precision)

X:\>utimetest.windows.before.exe c:\Test.txt
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 GMTDT
Reading mtime 1344937903123456000: 2012-08-14 10:51:43.123456 +0100 GMTDT

Windows After (100 ns precision)

X:\>utimetest.windows.after.exe c:\Test.txt
Setting mtime 1344937903123456789: 2012-08-14 10:51:43.123456789 +0100 GMTDT
Reading mtime 1344937903123456700: 2012-08-14 10:51:43.1234567 +0100 GMTDT

R=golang-dev, alex.brainman, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6905057

12 years agoA+C: Nick Craig-Wood (individual CLA)
Brad Fitzpatrick [Thu, 13 Dec 2012 20:59:11 +0000 (12:59 -0800)]
A+C: Nick Craig-Wood (individual CLA)

Generated by addca.

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

12 years agotest: move map delete test to nil.go
Ian Lance Taylor [Thu, 13 Dec 2012 20:11:24 +0000 (12:11 -0800)]
test: move map delete test to nil.go

No need for a separate test for this.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6941045

12 years agocmd/{5,6,8}g: reduce size of Prog and Addr
Dave Cheney [Thu, 13 Dec 2012 19:20:24 +0000 (06:20 +1100)]
cmd/{5,6,8}g: reduce size of Prog and Addr

5g: Prog went from 128 bytes to 88 bytes
6g: Prog went from 174 bytes to 144 bytes
8g: Prog went from 124 bytes to 92 bytes

There may be a little more that can be squeezed out of Addr, but alignment will be a factor.

All: remove the unused pun field from Addr

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6922048

12 years agotest/nil.go: delete on nil maps no longer panics
Shenghou Ma [Thu, 13 Dec 2012 18:19:33 +0000 (02:19 +0800)]
test/nil.go: delete on nil maps no longer panics
Fix the build.

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

12 years agoruntime: deletion on nil maps is a no-op now
Shenghou Ma [Thu, 13 Dec 2012 15:48:48 +0000 (23:48 +0800)]
runtime: deletion on nil maps is a no-op now
Fixes #4535.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6942044

12 years agolib/godoc/example.html: htmlify the play code
Shenghou Ma [Thu, 13 Dec 2012 11:08:51 +0000 (19:08 +0800)]
lib/godoc/example.html: htmlify the play code
Fixes #4539.

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

12 years agoio: SectionReader.ReadAt should return EOF when buf is not fully read
Shenghou Ma [Thu, 13 Dec 2012 10:36:24 +0000 (18:36 +0800)]
io: SectionReader.ReadAt should return EOF when buf is not fully read
Fixes #4392.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6858062

12 years agonet: make TestDialTimeoutFDLeak a bit robust
Mikio Hara [Thu, 13 Dec 2012 07:21:25 +0000 (16:21 +0900)]
net: make TestDialTimeoutFDLeak a bit robust

TestDialTimeoutFDLeak will fail when system state somaxconn is
greater than expected fixed value.

Fixes #4384 (again).

R=fullung, dave, rsc
CC=golang-dev
https://golang.org/cl/6873069

12 years agoruntime/race: fix test for GOMAXPROCS>1
Albert Strasheim [Thu, 13 Dec 2012 06:14:32 +0000 (10:14 +0400)]
runtime/race: fix test for GOMAXPROCS>1

Fixes #4530.

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

12 years ago database/sql: Alter *DB.begin to return driver.ErrBadConn when driver.Conn.Begin...
James David Chalfant [Thu, 13 Dec 2012 06:04:55 +0000 (22:04 -0800)]
database/sql: Alter *DB.begin to return driver.ErrBadConn when driver.Conn.Begin returns driver.ErrBadConn
Fixes #4433

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

12 years agoA+C: James David Chalfant (individual CLA)
Brad Fitzpatrick [Thu, 13 Dec 2012 06:04:24 +0000 (22:04 -0800)]
A+C: James David Chalfant (individual CLA)

Generated by addca.

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

12 years agolog/syslog: fix flakey test on slow hosts
Dave Cheney [Thu, 13 Dec 2012 05:26:20 +0000 (16:26 +1100)]
log/syslog: fix flakey test on slow hosts

Fixes #4467.

The syslog tests can fail if the timeout fires before the data arrives at the mock server. Moving the timeout onto the goroutine that is calling ReadFrom() and always processing the data returned before handling the error should improve the reliability of the test.

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

12 years agogo/doc: hide "Program exited." message from front page playground output
Andrew Gerrand [Thu, 13 Dec 2012 04:35:38 +0000 (15:35 +1100)]
go/doc: hide "Program exited." message from front page playground output

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

12 years agodoc/play: sync playground.js with go-playground repo
Andrew Gerrand [Thu, 13 Dec 2012 03:32:03 +0000 (14:32 +1100)]
doc/play: sync playground.js with go-playground repo

Also add style for "Program exited." message.

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

12 years agospec: more explicit comments for constant expression examples
Robert Griesemer [Wed, 12 Dec 2012 22:25:40 +0000 (14:25 -0800)]
spec: more explicit comments for constant expression examples

Fixes #3814.

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

12 years agospec: calling delete on a nil map is a no-op
Robert Griesemer [Wed, 12 Dec 2012 21:08:35 +0000 (13:08 -0800)]
spec: calling delete on a nil map is a no-op

This is language change. It is a backward-compatible
change but for code that relies on a run-time panic
when calling delete on a nil map (unlikely).

Fixes #4253.

R=rsc, r, iant, ken, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6909060

12 years agonet/http: return nicer error when Client request Host is blank
Brad Fitzpatrick [Wed, 12 Dec 2012 20:23:01 +0000 (12:23 -0800)]
net/http: return nicer error when Client request Host is blank

Update #4271

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6931052

12 years agonet/http: remove a stale cookie TODO comment, add a test
Brad Fitzpatrick [Wed, 12 Dec 2012 19:36:44 +0000 (11:36 -0800)]
net/http: remove a stale cookie TODO comment, add a test

Fixes #4528

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6922054

12 years agomisc/dashboard: don't email about netbsd failures
Brad Fitzpatrick [Wed, 12 Dec 2012 19:33:03 +0000 (11:33 -0800)]
misc/dashboard: don't email about netbsd failures

Too flaky.

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

12 years agonet/http: follow certain redirects after POST requests
Brad Fitzpatrick [Wed, 12 Dec 2012 19:09:55 +0000 (11:09 -0800)]
net/http: follow certain redirects after POST requests

Fixes #4145

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6923055

12 years agospec: index and array/slice size constants must fit into an int
Robert Griesemer [Wed, 12 Dec 2012 19:06:26 +0000 (11:06 -0800)]
spec: index and array/slice size constants must fit into an int

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6903048

12 years agodoc/gopher: add high-resolution pencil sketches
Rob Pike [Wed, 12 Dec 2012 18:51:13 +0000 (10:51 -0800)]
doc/gopher: add high-resolution pencil sketches
These are higher-resolution scans of the little
drawings used as clip art on golang.org

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

12 years agocmd/gc: Give better line numbers for errors in composite literals.
Daniel Morsing [Wed, 12 Dec 2012 15:43:54 +0000 (16:43 +0100)]
cmd/gc: Give better line numbers for errors in composite literals.

Credit to Russ for suggesting this fix.

Fixes #3925.

R=golang-dev, franciscossouza, rsc
CC=golang-dev
https://golang.org/cl/6920051

12 years agogo/build: give better explanation for "cannot find package"
Dave Cheney [Wed, 12 Dec 2012 10:38:52 +0000 (21:38 +1100)]
go/build: give better explanation for "cannot find package"

Fixes #4079.

Some example output:

% go install foo/bar
can't load package: package foo/bar: cannot find package "foo/bar" in any of:
        /home/dfc/go/src/pkg/foo/bar (from $GOROOT)
        /home/dfc/src/foo/bar (from $GOPATH)
        /home/dfc/src2/src/foo/bar

% GOPATH= go install foo/bar
can't load package: package foo/bar: cannot find package "foo/bar" in any of:
/home/dfc/go/src/pkg/foo/bar (from $GOROOT)
($GOPATH not set)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6899057

12 years agocmd/5g: avoid temporary during OMINUS
Dave Cheney [Wed, 12 Dec 2012 08:25:22 +0000 (19:25 +1100)]
cmd/5g: avoid temporary during OMINUS

Saves one MOVW and one register during the fast div/mod introduced in CL 6819123.

linux/arm (armv5)

benchmark               old ns/op    new ns/op    delta
BenchmarkInt64Mod1             12           12   +7.50%
BenchmarkUint16Mod2             7            7   +0.28%
BenchmarkUint16Mod4             7            7   -0.28%
BenchmarkUint64Mod1            15           11  -23.72%
BenchmarkInt8Neg                8            7  -17.66%
BenchmarkInt16Neg               8            7  -17.66%
BenchmarkInt32Neg               5            5   -9.04%
BenchmarkUint8Neg               7            6  -14.35%
BenchmarkUint16Neg              8            7  -17.66%
BenchmarkUint32Neg              5            5   -9.04%

R=rsc
CC=golang-dev
https://golang.org/cl/6842045

12 years agocmd/gc: don't import the same package multiple times.
Rémy Oudompheng [Wed, 12 Dec 2012 07:47:09 +0000 (08:47 +0100)]
cmd/gc: don't import the same package multiple times.

Implementation suggested by DMorsing.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6903059

12 years agocmd/6g, cmd/8g: simplify integer division code.
Rémy Oudompheng [Wed, 12 Dec 2012 07:35:08 +0000 (08:35 +0100)]
cmd/6g, cmd/8g: simplify integer division code.

Change suggested by iant. The compiler generates
special code for a/b when a is -0x80...0 and b = -1.
A single instruction can cover the case where b is -1,
so only one comparison is needed.

Fixes #3551.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6922049

12 years agonet: TestDialTimeoutFDLeak failure
Dave Cheney [Tue, 11 Dec 2012 20:25:07 +0000 (07:25 +1100)]
net: TestDialTimeoutFDLeak failure

Fixes #4384.

Implments the suggestion by rsc in comment 15, http://code.google.com/p/go/issues/detail?id=4384#c15

An alternate suggestion would be to temporarily set GOMAXPROCS to 1 during this test.

R=fullung, rsc
CC=golang-dev
https://golang.org/cl/6923046

12 years agolib/codereview: suggest argument to hg mail / hg submit
Russ Cox [Tue, 11 Dec 2012 18:36:55 +0000 (13:36 -0500)]
lib/codereview: suggest argument to hg mail / hg submit

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

12 years agodoc/contribute: mention 'hg help codereview'
Russ Cox [Tue, 11 Dec 2012 18:36:43 +0000 (13:36 -0500)]
doc/contribute: mention 'hg help codereview'

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

12 years agoencoding/csv: add Error method to Writer
Ryan Slade [Tue, 11 Dec 2012 18:29:13 +0000 (13:29 -0500)]
encoding/csv: add Error method to Writer

Fixed issue 3931

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

12 years agoA+C: Ryan Slade (individual CLA)
Russ Cox [Tue, 11 Dec 2012 18:28:44 +0000 (13:28 -0500)]
A+C: Ryan Slade (individual CLA)

Generated by addca.

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

12 years agoexp/types: filling in more blanks
Robert Griesemer [Tue, 11 Dec 2012 18:17:33 +0000 (10:17 -0800)]
exp/types: filling in more blanks

- implemented built-in complex()
- implemented missing expression switch checks

R=rsc
CC=golang-dev
https://golang.org/cl/6920046

12 years agocmd/gc: merge casep and casee labels
Miquel Sabaté Solà [Tue, 11 Dec 2012 17:23:04 +0000 (12:23 -0500)]
cmd/gc: merge casep and casee labels

The code inside the casee and casep labels can perfectly be merged since
they essentially do the same. The character to be stored where cp points is
just the character contained by the c variable.

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

12 years agoregexp: re-enable TestBadCompile
Russ Cox [Tue, 11 Dec 2012 17:19:39 +0000 (12:19 -0500)]
regexp: re-enable TestBadCompile

The code that was commented out was for the old regexp package.
In the new one the errors and the space of valid regexps are different.

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

12 years agomath/big: add SetUint64 and Uint64 functions to *Int
Luit van Drongelen [Tue, 11 Dec 2012 17:19:10 +0000 (12:19 -0500)]
math/big: add SetUint64 and Uint64 functions to *Int

Implementation is mostly identical to passing a non-negative int64 to
SetInt64, and calling Int64 with a non-negative value in the *Int.
Fixes #4389.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6929048

12 years agospec: Correct typo in method expressions example.
Robin Eklind [Tue, 11 Dec 2012 17:17:53 +0000 (12:17 -0500)]
spec: Correct typo in method expressions example.

Also, remove unnecessary whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6928045

12 years agonet/http, net/url: permit Request-URI "*"
Brad Fitzpatrick [Tue, 11 Dec 2012 17:07:27 +0000 (12:07 -0500)]
net/http, net/url: permit Request-URI "*"

Also, implement a global OPTIONS * handler, like Apache.

Permit sending "*" requests to handlers, but not path-based
(ServeMux) handlers.  That means people can go out of their
way to support SSDP or SIP or whatever, but most users will be
unaffected.

See RFC 2616 Section 5.1.2 (Request-URI)
See RFC 2616 Section 9.2 (OPTIONS)

Fixes #3692

R=rsc
CC=golang-dev
https://golang.org/cl/6868095

12 years agosyscall: let mkall.sh work on multiarch systems (like Precise)
Brad Fitzpatrick [Tue, 11 Dec 2012 17:03:18 +0000 (12:03 -0500)]
syscall: let mkall.sh work on multiarch systems (like Precise)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6912063

12 years agoregexp/syntax: export ErrUnexpectedParen
Brian Ketelsen [Tue, 11 Dec 2012 17:02:14 +0000 (12:02 -0500)]
regexp/syntax: export ErrUnexpectedParen

Fixes #3712

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

12 years agoA+C: Brian Ketelsen and Miquel Sabaté Solà (individual CLA × 2)
Russ Cox [Tue, 11 Dec 2012 17:02:07 +0000 (12:02 -0500)]
A+C: Brian Ketelsen and Miquel Sabaté Solà (individual CLA × 2)

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

12 years agofmt: fix %v of complex slice
Russ Cox [Tue, 11 Dec 2012 16:49:41 +0000 (11:49 -0500)]
fmt: fix %v of complex slice

Fixes #4525.

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

12 years agoencoding/base64: new example for NewEncoder with emphasis on Close
Shenghou Ma [Tue, 11 Dec 2012 16:49:02 +0000 (11:49 -0500)]
encoding/base64: new example for NewEncoder with emphasis on Close
Fixes #4394.

R=iant, bradfitz, rsc, remigius.gieben
CC=golang-dev
https://golang.org/cl/6847125

12 years agocmd/gc: remove bad check for BADWIDTH
Daniel Morsing [Tue, 11 Dec 2012 16:36:10 +0000 (17:36 +0100)]
cmd/gc: remove bad check for BADWIDTH

This check for BADWIDTH might happen while in defercheckwidth, making it raise errors for non-erroneous situations.

Fixes #4495.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6927043

12 years agonet/url: fix handling of relative paths in ResolveReference.
Rick Arnold [Tue, 11 Dec 2012 16:06:07 +0000 (11:06 -0500)]
net/url: fix handling of relative paths in ResolveReference.

Fixes #3560.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6886047

12 years agogodoc: move example list into index section
Russ Cox [Tue, 11 Dec 2012 01:20:00 +0000 (20:20 -0500)]
godoc: move example list into index section

Putting it before the Index (where it is now) is wrong:
we don't even know what's in the package yet.

Fixes #4484.

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

12 years agodoc/go1.1.html: add warning about net.ResolveTCPAddr error checking
Russ Cox [Mon, 10 Dec 2012 23:08:07 +0000 (18:08 -0500)]
doc/go1.1.html: add warning about net.ResolveTCPAddr error checking

Suggested by Paul Borman.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6930043

12 years agobufio: minor fixes
Russ Cox [Mon, 10 Dec 2012 22:25:31 +0000 (17:25 -0500)]
bufio: minor fixes

* note end-of-line and EOF behavior for ReadLine
* diagnose broken Readers

Fixes #3825.
Fixes #4276.

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

12 years agopprof: fix https URLs and 'profiler in use' errors
Russ Cox [Mon, 10 Dec 2012 22:06:30 +0000 (17:06 -0500)]
pprof: fix https URLs and 'profiler in use' errors

Fixes #3666.
Fixes #3680.

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

12 years agomime/multipart: allow setting the Writer boundary
Brad Fitzpatrick [Mon, 10 Dec 2012 21:30:42 +0000 (16:30 -0500)]
mime/multipart: allow setting the Writer boundary

Fixes #4490

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6924044

12 years agospec: consistently use "indices" (rather than "indexes")
Robert Griesemer [Mon, 10 Dec 2012 19:55:57 +0000 (11:55 -0800)]
spec: consistently use "indices" (rather than "indexes")

We have been using all three terms "indices", "indexes",
and "index expressions" indiscriminatly for index values.
With this change, "index" refers to an index value,
"indices" is the plural of "index", and "index expression"
refers to an array, slice, or map indexed by an index: a[x].

R=r, rsc, iant, ken, mtj
CC=golang-dev
https://golang.org/cl/6912056

12 years agoCONTRIBUTORS: add sledbetter (Google Corporate CLA).
Adam Langley [Mon, 10 Dec 2012 17:38:20 +0000 (12:38 -0500)]
CONTRIBUTORS: add sledbetter (Google Corporate CLA).

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

12 years agosyscall: add type for struct tcp_info
Brad Fitzpatrick [Mon, 10 Dec 2012 16:32:07 +0000 (11:32 -0500)]
syscall: add type for struct tcp_info

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6900050

12 years agoencoding/xml: fix typo in Marshal documentation
Francisco Souza [Mon, 10 Dec 2012 15:59:15 +0000 (10:59 -0500)]
encoding/xml: fix typo in Marshal documentation

Fixes #4512.

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

12 years agonet/rpc: document that Register logs to standard error
Russ Cox [Mon, 10 Dec 2012 06:42:53 +0000 (01:42 -0500)]
net/rpc: document that Register logs to standard error
Also fix spurious & in example.

Fixes #4349.
Fixes #4489.

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

12 years agonet/http: fix text for ErrBodyReadAfterClose
Russ Cox [Mon, 10 Dec 2012 06:42:10 +0000 (01:42 -0500)]
net/http: fix text for ErrBodyReadAfterClose

Can happen in both request and response.
Also use it in one place that wasn't.

Fixes #3997.

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

12 years agocmd/go: add GOOS/GOARCH to go version output
Dave Cheney [Sun, 9 Dec 2012 20:05:17 +0000 (07:05 +1100)]
cmd/go: add GOOS/GOARCH to go version output

Fixes #4492.

% go version
go version devel +6b602ab487d6 Sat Dec 08 14:43:00 2012 +0100 linux/amd64

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6906058

12 years agocmd/gc: prevent ngotype from allocating.
Rémy Oudompheng [Sun, 9 Dec 2012 18:27:23 +0000 (19:27 +0100)]
cmd/gc: prevent ngotype from allocating.

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

12 years agocmd/[568]g: recycle ONAME nodes used in regopt to denote registers.
Rémy Oudompheng [Sun, 9 Dec 2012 18:10:52 +0000 (19:10 +0100)]
cmd/[568]g: recycle ONAME nodes used in regopt to denote registers.

The reported decrease in memory usage is about 5%.

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

12 years agotime: add Round and Truncate
Russ Cox [Sun, 9 Dec 2012 08:59:33 +0000 (03:59 -0500)]
time: add Round and Truncate

New in Go 1 will be nanosecond precision in the result of time.Now on Linux.
This will break code that stores time in external formats at microsecond
precision, reads it back, and expects to get exactly the same time.

Code like that can be fixed by using time.Now().Round(time.Microsecond)
instead of time.Now() in those contexts.

R=golang-dev, bradfitz, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/6903050

12 years agocmd/gc: do not export useless private symbols.
Rémy Oudompheng [Sat, 8 Dec 2012 13:43:00 +0000 (14:43 +0100)]
cmd/gc: do not export useless private symbols.

Fixes #4252.

R=rsc, golang-dev, mirtchovski, daniel.morsing, dave, lvd
CC=golang-dev
https://golang.org/cl/6856126

12 years agomath/rand: fix typo in example comment.
David Symonds [Sat, 8 Dec 2012 08:20:38 +0000 (19:20 +1100)]
math/rand: fix typo in example comment.

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

12 years agomath/rand: add example / regression test
Russ Cox [Fri, 7 Dec 2012 16:58:59 +0000 (11:58 -0500)]
math/rand: add example / regression test

This makes sure the outputs do not change for a fixed seed.
See also https://golang.org/cl/6905049.

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

12 years agoundo CL 6845121 / 79603a5e4cda
Russ Cox [Fri, 7 Dec 2012 16:58:44 +0000 (11:58 -0500)]
undo CL 6845121 / 79603a5e4cda

This changes the output of

rand.Seed(0)
perm := rand.Perm(100)

When giving the same seeds to Go 1.0 and Go 1.1 programs
I would like them to generate the same random numbers.

««« original CL description
math/rand: remove noop iteration in Perm

The first iteration always do `m[0], m[0] = m[0], m[0]`, because
`rand.Intn(1)` is 0.

fun note: IIRC in TAOCP version of this algorithm, `i` goes
backward (n-1->1), meaning that the "already" shuffled part of the
array is never altered betweens iterations, while in the current
implementation the "not-yet" shuffled part of the array is
conserved between iterations.

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

»»»

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

12 years agofix build: remove a flaky test for now
Robert Griesemer [Thu, 6 Dec 2012 17:47:12 +0000 (09:47 -0800)]
fix build: remove a flaky test for now

R=rsc
CC=golang-dev
https://golang.org/cl/6889052

12 years agospec: receiver types in method expressions can be parenthesized
Robert Griesemer [Thu, 6 Dec 2012 17:31:42 +0000 (09:31 -0800)]
spec: receiver types in method expressions can be parenthesized

Fixes #4457.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6862046

12 years agoexp/gotype: added many more tests
Robert Griesemer [Thu, 6 Dec 2012 17:23:13 +0000 (09:23 -0800)]
exp/gotype: added many more tests

gotype can now handle much of the standard library.

- marked packages which have type checker issues
- this CL depends on CL 6846131

R=rsc
CC=golang-dev
https://golang.org/cl/6850130

12 years agoexp/types: checking of type switches and range clauses
Robert Griesemer [Thu, 6 Dec 2012 17:21:30 +0000 (09:21 -0800)]
exp/types: checking of type switches and range clauses

Also:
- better handling of type assertions
- implemented built-in error type
- first cut at handling variadic function signatures
- several bug fixes

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/6846131

12 years agogofmt: test rewrite of (x.(type)) -> x.(type)
Robert Griesemer [Thu, 6 Dec 2012 17:20:03 +0000 (09:20 -0800)]
gofmt: test rewrite of (x.(type)) -> x.(type)

R=rsc
CC=golang-dev
https://golang.org/cl/6867062

12 years agospec: type assertions and type switches must be valid
Robert Griesemer [Thu, 6 Dec 2012 17:17:20 +0000 (09:17 -0800)]
spec: type assertions and type switches must be valid

The spec didn't preclude invalid type assertions and
type switches, i.e., cases where a concrete type doesn't
implement the interface type in the assertion in the first
place. Both, the gc and gccgo compiler exclude these cases.
This is documenting the status quo.

Also:
- minor clean up of respective examples
- added sentence about default case in select statements

Fixes #4472.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6869050

12 years agocmd/gc: do not overflow parser stack on a long chain of else if.
Rémy Oudompheng [Thu, 6 Dec 2012 07:09:17 +0000 (08:09 +0100)]
cmd/gc: do not overflow parser stack on a long chain of else if.

Fixes #2615.

R=dave, minux.ma, iant, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/6847078

12 years agonet/http: populate ContentLength in HEAD responses
Brad Fitzpatrick [Thu, 6 Dec 2012 06:36:23 +0000 (22:36 -0800)]
net/http: populate ContentLength in HEAD responses

Also fixes a necessary TODO in the process.

Fixes #4126

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6869053

12 years agocmd/8a: support XMM registers.
Rémy Oudompheng [Thu, 6 Dec 2012 06:27:38 +0000 (07:27 +0100)]
cmd/8a: support XMM registers.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6884046

12 years agocmd/6c, cmd/8c: add fixjmp step to regopt.
Rémy Oudompheng [Thu, 6 Dec 2012 06:20:03 +0000 (07:20 +0100)]
cmd/6c, cmd/8c: add fixjmp step to regopt.

The fixjmp step eliminates redundant chains of JMP
instructions that are produced by the compiler during
code generation.

It is already implemented in gc, and can be adapted to 6c/8c with
the exception that JMPs refer to destination by pc instead of by
pointer. The algorithm is modified to operate on Regs instead of Progs
for this reason. The pcs are already restored later by regopt.

R=goalng-dev, rsc
CC=golang-dev
https://golang.org/cl/6865046

12 years agocmd/5g: fix fixedtests/issue4396b.go test failure on arm5
Dave Cheney [Thu, 6 Dec 2012 05:52:16 +0000 (16:52 +1100)]
cmd/5g: fix fixedtests/issue4396b.go test failure on arm5

Add missing file that should have been included in CL 6854063 / 5eac1a2d6fc3

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6891049

12 years agocmd/ld: skip 0-length write in cwrite
Russ Cox [Thu, 6 Dec 2012 05:00:20 +0000 (00:00 -0500)]
cmd/ld: skip 0-length write in cwrite

The 0-length part is fine, but some callers that write 0 bytes
also pass nil as the data pointer, and the Plan 9 kernel kills the
process with 'invalid address in sys call' in that case.

R=ken2
CC=golang-dev
https://golang.org/cl/6862051

12 years agotest: add some tests where go/defer arg starts with parenthesis
Ian Lance Taylor [Thu, 6 Dec 2012 04:32:12 +0000 (20:32 -0800)]
test: add some tests where go/defer arg starts with parenthesis

R=gri
CC=golang-dev
https://golang.org/cl/6890047

12 years agonet: document that File reverts connection to blocking mode.
Rick Arnold [Thu, 6 Dec 2012 04:31:35 +0000 (23:31 -0500)]
net: document that File reverts connection to blocking mode.

Fixes #2458.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6869054

12 years agovet: be less strict about number of arguments when a ... is present.
David Symonds [Thu, 6 Dec 2012 04:17:31 +0000 (15:17 +1100)]
vet: be less strict about number of arguments when a ... is present.

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

12 years agonet/http: implement CloseNotifier
Brad Fitzpatrick [Thu, 6 Dec 2012 03:25:43 +0000 (19:25 -0800)]
net/http: implement CloseNotifier

Fixes #2510

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6867050

12 years agonet/http: fix bug parsing http_proxy lacking a protocol
Brad Fitzpatrick [Thu, 6 Dec 2012 03:08:42 +0000 (19:08 -0800)]
net/http: fix bug parsing http_proxy lacking a protocol

Per the curl man page, the http_proxy configuration can be
of the form:

   [protocol://]<host>[:port]

And we had a test that <ip>:<port> worked, but if
the host began with a letter, url.Parse parsed the hostname
as the scheme instead, confusing ProxyFromEnvironment.

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

12 years agogc: avoid meaningless constant overflow error for inverted slice range
Ian Lance Taylor [Wed, 5 Dec 2012 23:46:45 +0000 (15:46 -0800)]
gc: avoid meaningless constant overflow error for inverted slice range

Used to say:

issue4251.go:12: inverted slice range
issue4251.go:12: constant -1 overflows uint64
issue4251.go:16: inverted slice range
issue4251.go:16: constant -1 overflows uint64
issue4251.go:20: inverted slice range
issue4251.go:20: constant -1 overflows uint64

With this patch, only gives the "inverted slice range" errors.

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

12 years agocmd/5g: use MOVB for fixed array nil check
Dave Cheney [Wed, 5 Dec 2012 21:01:33 +0000 (08:01 +1100)]
cmd/5g: use MOVB for fixed array nil check

Fixes #4396.

For fixed arrays larger than the unmapped page, agenr would general a nil check by loading the first word of the array. However there is no requirement for the first element of a byte array to be word aligned, so this check causes a trap on ARMv5 hardware (ARMv6 since relaxed that restriction, but it probably still comes at a cost).

Switching the check to MOVB ensures alignment is not an issue. This check is only invoked in a few places in the code where large fixed arrays are embedded into structs, compress/lzw is the biggest offender, and switching to MOVB has no observable performance penalty.

Thanks to Rémy and Daniel Morsing for helping me debug this on IRC last night.

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6854063

12 years agonet: fix data races on deadline vars
Dave Cheney [Wed, 5 Dec 2012 04:59:01 +0000 (15:59 +1100)]
net: fix data races on deadline vars

Fixes #4434.

This proposal replaces the previous CL 6855110. Due to issue 599, 64-bit atomic operations should probably be avoided, so use a sync.Mutex instead.

Benchmark comparisons against 025b9d070a85 on linux/386:

CL 6855110:

benchmark                        old ns/op    new ns/op    delta
BenchmarkTCPOneShot                 710024       727409   +2.45%
BenchmarkTCPOneShotTimeout          758178       768620   +1.38%
BenchmarkTCPPersistent              223464       228058   +2.06%
BenchmarkTCPPersistentTimeout       234494       242600   +3.46%

This proposal:

benchmark                        old ns/op    new ns/op    delta
BenchmarkTCPOneShot                 710024       718492   +1.19%
BenchmarkTCPOneShotTimeout          758178       748783   -1.24%
BenchmarkTCPPersistent              223464       227628   +1.86%
BenchmarkTCPPersistentTimeout       234494       238321   +1.63%

R=rsc, dvyukov, mikioh.mikioh, alex.brainman, bradfitz
CC=golang-dev, remyoudompheng
https://golang.org/cl/6866050

12 years agonet: change windows netFD finalizer to behave similar to unix
Alex Brainman [Wed, 5 Dec 2012 04:26:18 +0000 (15:26 +1100)]
net: change windows netFD finalizer to behave similar to unix

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

12 years agonet/http: clarify DefaultTransport docs
Brad Fitzpatrick [Wed, 5 Dec 2012 04:14:58 +0000 (20:14 -0800)]
net/http: clarify DefaultTransport docs

Fixes #4281

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

12 years agonet: add missing close socket code
Alex Brainman [Wed, 5 Dec 2012 04:13:03 +0000 (15:13 +1100)]
net: add missing close socket code

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

12 years agotest: tweak bug273.go to not have constant len < cap when calling make
Ian Lance Taylor [Wed, 5 Dec 2012 00:51:51 +0000 (16:51 -0800)]
test: tweak bug273.go to not have constant len < cap when calling make

The current spec says that when calling make, if both len and
cap are constant, it is an error if len > cap.  The gc
compiler does not yet implement that, but when it does this
will need to change.  Changing it now for the benefit of
gccgo.

R=gri
CC=golang-dev
https://golang.org/cl/6867064

12 years agocontainer/heap: Simplify the example.
Frithjof Schulze [Tue, 4 Dec 2012 22:11:33 +0000 (14:11 -0800)]
container/heap: Simplify the example.

Using append simplifies the code and makes it work if
the initial capacity of the slice is smaller than the
number of items pushed.

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

12 years agoA+C: adding Frithjof Schulze (individual CLA)
Robert Griesemer [Tue, 4 Dec 2012 22:11:22 +0000 (14:11 -0800)]
A+C: adding Frithjof Schulze (individual CLA)

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

12 years agospec: BuiltinCall syntax must permit "..." for append
Robert Griesemer [Tue, 4 Dec 2012 21:09:02 +0000 (13:09 -0800)]
spec: BuiltinCall syntax must permit "..." for append

Also: fix an incorrect link.

Fixes #4479.
Fixes #4456.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6868062

12 years agotest: add test for invalid nil == nil
Ian Lance Taylor [Tue, 4 Dec 2012 19:30:46 +0000 (11:30 -0800)]
test: add test for invalid nil == nil

R=gri
CC=golang-dev
https://golang.org/cl/6868059

12 years agonet/http: clarify that Request.Host may contain a port number
Brad Fitzpatrick [Tue, 4 Dec 2012 15:09:01 +0000 (07:09 -0800)]
net/http: clarify that Request.Host may contain a port number

Fixes #4172

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

12 years agodoc: clear execute bit
Mikio Hara [Tue, 4 Dec 2012 11:37:19 +0000 (20:37 +0900)]
doc: clear execute bit

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

12 years agodoc/articles/godoc_documenting_go_code: fix some format issues.
Oling Cat [Tue, 4 Dec 2012 06:40:38 +0000 (17:40 +1100)]
doc/articles/godoc_documenting_go_code: fix some format issues.

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

12 years agonet: report Accept error during TestVariousDeadlines1Proc test
Alex Brainman [Tue, 4 Dec 2012 06:00:19 +0000 (17:00 +1100)]
net: report Accept error during TestVariousDeadlines1Proc test

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