1
0
mirror of https://github.com/golang/go synced 2024-10-04 04:31:21 -06:00
Commit Graph

14851 Commits

Author SHA1 Message Date
James David Chalfant
19e2f26b21 database/sql: adds test for fix in issue 4433.
Tests that here should be automatic retries if a database
driver's connection returns ErrBadConn on Begin. See
"TestTxErrBadConn" in sql_test.go

R=golang-dev
CC=golang-dev
https://golang.org/cl/6942050
2012-12-14 09:00:33 -08:00
Dmitriy Vyukov
10b3e310e2 runtime/race: update runtime to r170112.
This includes GORACE history_size and log_path flags.

This change is actually an addition to:
https://golang.org/cl/6947046

race_linux_amd64.syso somehow fall out of it.

R=minux.ma
CC=golang-dev
https://golang.org/cl/6946051
2012-12-14 13:40:59 +04:00
Dmitriy Vyukov
a719700e89 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
2012-12-14 13:23:43 +04:00
Alex Brainman
04f0d148e9 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
2012-12-14 17:33:59 +11:00
Ian Lance Taylor
cc5682dcc5 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
2012-12-13 15:11:31 -08:00
Nick Craig-Wood
473441fc30 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
2012-12-13 13:02:39 -08:00
Brad Fitzpatrick
7b4bb04884 A+C: Nick Craig-Wood (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/6938051
2012-12-13 12:59:11 -08:00
Ian Lance Taylor
9509cbf203 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
2012-12-13 12:11:24 -08:00
Dave Cheney
b2797f2ae0 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
2012-12-14 06:20:24 +11:00
Shenghou Ma
0df58a4b50 test/nil.go: delete on nil maps no longer panics
Fix the build.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6946044
2012-12-14 02:19:33 +08:00
Shenghou Ma
28a50c7f51 runtime: deletion on nil maps is a no-op now
Fixes #4535.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6942044
2012-12-13 23:48:48 +08:00
Shenghou Ma
e470b3354c lib/godoc/example.html: htmlify the play code
Fixes #4539.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6942043
2012-12-13 19:08:51 +08:00
Shenghou Ma
31eedd7f3e 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
2012-12-13 18:36:24 +08:00
Mikio Hara
feb509c794 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
2012-12-13 16:21:25 +09:00
Albert Strasheim
b978995f5d runtime/race: fix test for GOMAXPROCS>1
Fixes #4530.

R=dvyukov, dave
CC=golang-dev
https://golang.org/cl/6933052
2012-12-13 10:14:32 +04:00
James David Chalfant
309eae1923 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
2012-12-12 22:04:55 -08:00
Brad Fitzpatrick
7571d23c19 A+C: James David Chalfant (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/6939043
2012-12-12 22:04:24 -08:00
Dave Cheney
ae12e96350 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
2012-12-13 16:26:20 +11:00
Andrew Gerrand
641d152935 go/doc: hide "Program exited." message from front page playground output
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6934049
2012-12-13 15:35:38 +11:00
Andrew Gerrand
c8ce844d5a 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
2012-12-13 14:32:03 +11:00
Robert Griesemer
462860bd8d spec: more explicit comments for constant expression examples
Fixes #3814.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6920057
2012-12-12 14:25:40 -08:00
Robert Griesemer
a9a49fe962 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
2012-12-12 13:08:35 -08:00
Brad Fitzpatrick
f85b94aa85 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
2012-12-12 12:23:01 -08:00
Brad Fitzpatrick
be5ce4e027 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
2012-12-12 11:36:44 -08:00
Brad Fitzpatrick
a257c753ac misc/dashboard: don't email about netbsd failures
Too flaky.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/6925056
2012-12-12 11:33:03 -08:00
Brad Fitzpatrick
08ce7f1d5c net/http: follow certain redirects after POST requests
Fixes #4145

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6923055
2012-12-12 11:09:55 -08:00
Robert Griesemer
3906706297 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
2012-12-12 11:06:26 -08:00
Rob Pike
17b3766d18 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
2012-12-12 10:51:13 -08:00
Daniel Morsing
bf59aafddc 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
2012-12-12 16:43:54 +01:00
Dave Cheney
11d96dd7f5 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
2012-12-12 21:38:52 +11:00
Dave Cheney
5bdf40dcca 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
2012-12-12 19:25:22 +11:00
Rémy Oudompheng
11999306df 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
2012-12-12 08:47:09 +01:00
Rémy Oudompheng
a617d06252 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
2012-12-12 08:35:08 +01:00
Dave Cheney
4766a35e7c 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
2012-12-12 07:25:07 +11:00
Russ Cox
c3d881b361 lib/codereview: suggest argument to hg mail / hg submit
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6924050
2012-12-11 13:36:55 -05:00
Russ Cox
111fcf1579 doc/contribute: mention 'hg help codereview'
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6932053
2012-12-11 13:36:43 -05:00
Ryan Slade
9a12a9c594 encoding/csv: add Error method to Writer
Fixed issue 3931

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6923049
2012-12-11 13:29:13 -05:00
Russ Cox
c69445738d A+C: Ryan Slade (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/6924049
2012-12-11 13:28:44 -05:00
Robert Griesemer
1a6f8dcbaf 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
2012-12-11 10:17:33 -08:00
Miquel Sabaté Solà
0dd0e1ad0c 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
2012-12-11 12:23:04 -05:00
Russ Cox
3c6c88319e 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
2012-12-11 12:19:39 -05:00
Luit van Drongelen
f4fc163d17 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
2012-12-11 12:19:10 -05:00
Robin Eklind
1d46fc44b7 spec: Correct typo in method expressions example.
Also, remove unnecessary whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6928045
2012-12-11 12:17:53 -05:00
Brad Fitzpatrick
a6701f2699 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
2012-12-11 12:07:27 -05:00
Brad Fitzpatrick
fc3936380b syscall: let mkall.sh work on multiarch systems (like Precise)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6912063
2012-12-11 12:03:18 -05:00
Brian Ketelsen
1b46e4cd9a regexp/syntax: export ErrUnexpectedParen
Fixes #3712

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6902069
2012-12-11 12:02:14 -05:00
Russ Cox
b979b192b2 A+C: Brian Ketelsen and Miquel Sabaté Solà (individual CLA × 2)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6923051
2012-12-11 12:02:07 -05:00
Russ Cox
07cc05864c fmt: fix %v of complex slice
Fixes #4525.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6929049
2012-12-11 11:49:41 -05:00
Shenghou Ma
15353d2114 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
2012-12-11 11:49:02 -05:00
Daniel Morsing
0d22573f6e 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
2012-12-11 17:36:10 +01:00