]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agonet: add test case for SplitHostPort with zone
Russ Cox [Thu, 29 Nov 2012 20:43:05 +0000 (15:43 -0500)]
net: add test case for SplitHostPort with zone

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

12 years agospec: clarify use of built-ins in go/defer statements
Robert Griesemer [Thu, 29 Nov 2012 19:46:25 +0000 (11:46 -0800)]
spec: clarify use of built-ins in go/defer statements

1) Built-ins are restricted like for expression statements.
   This documents the status quo.

2) Calls cannot be parenthesized. The spec is not clear. gccgo
   permits it already, gc doesn't. Be explicit in the spec.

 Fixes #4462.

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

12 years agocodereview: always use HTTPS
Brad Fitzpatrick [Thu, 29 Nov 2012 19:19:55 +0000 (11:19 -0800)]
codereview: always use HTTPS

The new version of rietveld pushed 1.5 hours ago
requires HTTPS now, otherwise it issues a 301
to HTTPS which we barfed on.

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

12 years agoexp/types: various missing checks for array/slice composite literals
Robert Griesemer [Thu, 29 Nov 2012 17:57:37 +0000 (09:57 -0800)]
exp/types: various missing checks for array/slice composite literals

- check indices of array/slice composite literals
- handle [...]T
- also: go/defer statements

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

12 years agogo/parser: permit [...]T where array types are permitted
Robert Griesemer [Thu, 29 Nov 2012 00:03:34 +0000 (16:03 -0800)]
go/parser: permit [...]T where array types are permitted

More lenient parsing with better error recovery.
It's easier for the type check to pick up the slack.

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

12 years agoos: include 0111 in directory file mode on windows
Alex Brainman [Wed, 28 Nov 2012 06:01:59 +0000 (17:01 +1100)]
os: include 0111 in directory file mode on windows

Fixes #4444.

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

12 years agoexp/winfsnotify: fix data race in TestNotifyClose
Alex Brainman [Wed, 28 Nov 2012 06:01:22 +0000 (17:01 +1100)]
exp/winfsnotify: fix data race in TestNotifyClose

Fixes #4342.

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

12 years agonet/http: fix broken TestIssue4191_InfiniteGetToPutTimeout
Alex Brainman [Wed, 28 Nov 2012 06:00:50 +0000 (17:00 +1100)]
net/http: fix broken TestIssue4191_InfiniteGetToPutTimeout

Test creates 2 tcp connections for put and get. Make sure
these are closed properly after test is over, otherwise
server hangs waiting for connection to be closed.

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

12 years agonet: move deadline logic into pollServer
Dave Cheney [Wed, 28 Nov 2012 00:29:25 +0000 (11:29 +1100)]
net: move deadline logic into pollServer

Update #4434.

The proposal attempts to reduce the number of places where fd,{r,w}deadline is checked and updated in preparation for issue 4434. In doing so the deadline logic is simplified by letting the pollster return errTimeout from netFD.Wait{Read,Write} as part of the wakeup logic.

The behaviour of setting n = 0 has been restored to match rev 2a55e349097f, which was the previous change to fd_unix.go before CL 6851096.

R=jsing, bradfitz, mikioh.mikioh, rsc
CC=fullung, golang-dev
https://golang.org/cl/6850110

12 years agonet: fix ResolveIPAddr
Mikio Hara [Tue, 27 Nov 2012 23:45:23 +0000 (08:45 +0900)]
net: fix ResolveIPAddr

Fixes misedit in CL 6842053.

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

12 years agonet: fix intermittent TestAddFDReturnsError failure
Dave Cheney [Tue, 27 Nov 2012 23:08:59 +0000 (10:08 +1100)]
net: fix intermittent TestAddFDReturnsError failure

A fix similar to CL 6859043 was effective in resolving the intermittent failure.

Fixes #4423.

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

12 years agonet: consoldate literal target address into IP address functions
Mikio Hara [Tue, 27 Nov 2012 21:36:05 +0000 (06:36 +0900)]
net: consoldate literal target address into IP address functions

This CL continues with introducing IPv6 scoped addressing capability
into the net package.

Update #4234.

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

12 years agocmd/5g, cmd/8g: fix internal error on 64-bit indices statically bounded
Rémy Oudompheng [Tue, 27 Nov 2012 20:37:38 +0000 (21:37 +0100)]
cmd/5g, cmd/8g: fix internal error on 64-bit indices statically bounded

Fixes #4448.

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

12 years agogo/format: Package format implements standard formatting of Go source.
Robert Griesemer [Tue, 27 Nov 2012 18:29:49 +0000 (10:29 -0800)]
go/format: Package format implements standard formatting of Go source.

Package format is a utility package that takes care of
parsing, sorting of imports, and formatting of .go source
using the canonical gofmt formatting parameters.

Use go/format in various clients instead of the lower-level components.

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

12 years agoruntime: use reflect·call() to enter the function gc()
Jan Ziak [Tue, 27 Nov 2012 18:04:59 +0000 (13:04 -0500)]
runtime: use reflect·call() to enter the function gc()

Garbage collection code (to be merged later) is calling functions
which have many local variables. This increases the probability that
the stack capacity won't be big enough to hold the local variables.
So, start gc() on a bigger stack to eliminate a potentially large number
of calls to runtime·morestack().

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

12 years agoruntime/race: add test case for issue 4453
Dmitriy Vyukov [Tue, 27 Nov 2012 17:59:08 +0000 (21:59 +0400)]
runtime/race: add test case for issue 4453

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

12 years agoregexp: add Split
Rick Arnold [Tue, 27 Nov 2012 17:58:27 +0000 (12:58 -0500)]
regexp: add Split

As discussed in issue 2672 and on golang-nuts, this CL adds a Split() method
to regexp. It is based on returning the "opposite" of FindAllString() so that
the returned substrings are everything not matched by the expression.

See: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/xodBZh9Lh2E

Fixes #2762.

R=remyoudompheng, r, rsc
CC=golang-dev
https://golang.org/cl/6846048

12 years agomisc/emacs: fix go-mode hang
Russ Cox [Tue, 27 Nov 2012 17:21:10 +0000 (12:21 -0500)]
misc/emacs: fix go-mode hang

Fix suggested by serbaut.

Fixes #4445.

R=sameer
CC=golang-dev, serbaut
https://golang.org/cl/6842102

12 years agoregexp: add examples
Volker Dobler [Tue, 27 Nov 2012 15:33:15 +0000 (10:33 -0500)]
regexp: add examples

Update #4125

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

12 years agolog/syslog: correct message format
John Graham-Cumming [Tue, 27 Nov 2012 15:21:43 +0000 (10:21 -0500)]
log/syslog: correct message format

The syslog implementation was not correctly implementing the
traditional syslog format because it had a confused notion of
'priority'.  syslog priority is not a single number but is, in
fact, the combination of a facility number and a severity. The
previous Go syslog implementation had a single Priority that
appeared to be the syslog severity and no way of setting the
facility.  That meant that all syslog messages from Go
programs appeared to have a facility of 0 (LOG_KERN) which
meant they all appeared to come from the kernel.

Also, the 'prefix' was in fact the syslog tag (changed the
internal name for clarity as the term tag is more widely used)
and the timestamp and hostname values were missing from
messages.

With this change syslog messages are generated in the correct
format with facility and severity combined into a priority,
the timestamp in RFC3339 format, the hostname, the tag (with
the PID in [] appened) and the message.

The format is now:

   <PRI>1 TIMESTAMP HOSTNAME TAG[PID]: MSG

The TIMESTAMP, HOSTNAME and PID fields are filled in
automatically by the package. The TAG and the MSG are supplied
by the user. This is what rsyslogd calls TraditionalFormat and
should be compatible with multiple systems.

R=rsc, jgc, 0xjnml, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/6782118

12 years agoruntime/race: add unit tests for race detector
Dmitriy Vyukov [Tue, 27 Nov 2012 11:04:48 +0000 (15:04 +0400)]
runtime/race: add unit tests for race detector

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

12 years agonet: fix flaky test
Dmitriy Vyukov [Tue, 27 Nov 2012 08:18:54 +0000 (12:18 +0400)]
net: fix flaky test
The test failed on one of the builders with:
timeout_test.go:594:  ln.Accept: accept tcp 127.0.0.1:19373: use of closed network connection
http://build.golang.org/log/e83f4a152b37071b9d079096e15913811ad296b5

R=golang-dev, bradfitz, dave, mikioh.mikioh, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6859043

12 years agoexp/cookiejar: new package.
Nigel Tao [Tue, 27 Nov 2012 07:20:44 +0000 (18:20 +1100)]
exp/cookiejar: new package.

This CL defines the API. Implementation will come in follow-up CLs.

Update #1960.

R=bradfitz, dr.volker.dobler, rsc
CC=golang-dev
https://golang.org/cl/6849092

12 years agoCONTRIBUTORS: Add Jonathan Hseu (Google CLA)
Brad Fitzpatrick [Tue, 27 Nov 2012 05:21:07 +0000 (21:21 -0800)]
CONTRIBUTORS: Add Jonathan Hseu (Google CLA)

Part of merging goprotobuf's A+C into Go's.

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

12 years agogo/ast: minor cleanup
Robert Griesemer [Tue, 27 Nov 2012 01:17:49 +0000 (17:17 -0800)]
go/ast: minor cleanup

It's better to use IsValid() then checking a (possibly
partially set up) position against NoPos directly.

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

12 years agoos/user: update stub documentation
Anthony Martin [Tue, 27 Nov 2012 00:02:08 +0000 (16:02 -0800)]
os/user: update stub documentation

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

12 years agoos: move Plan 9 directory marshaling code to syscall
Anthony Martin [Mon, 26 Nov 2012 23:26:46 +0000 (15:26 -0800)]
os: move Plan 9 directory marshaling code to syscall

The API additions to syscall are in dir_plan9.go.

R=seed, rsc, rminnich, mirtchovski, dave
CC=golang-dev, lucio.dere
https://golang.org/cl/6157045

12 years agocmd/gc: add division rewrite to walk pass.
Rémy Oudompheng [Mon, 26 Nov 2012 22:45:22 +0000 (23:45 +0100)]
cmd/gc: add division rewrite to walk pass.

This allows 5g and 8g to benefit from the rewrite as shifts
or magic multiplies. The 64-bit arithmetic is not handled there,
and left in 6g.

Update #2230.

R=golang-dev, dave, mtj, iant, rsc
CC=golang-dev
https://golang.org/cl/6819123

12 years agogo/printer: don't use 'infinity' value when it might lead to int32 overflow
Robert Griesemer [Mon, 26 Nov 2012 22:20:05 +0000 (14:20 -0800)]
go/printer: don't use 'infinity' value when it might lead to int32 overflow

Fixes 386 build breakage.

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

12 years agonet/http: fix Transport races & deadlocks
Brad Fitzpatrick [Mon, 26 Nov 2012 21:31:02 +0000 (13:31 -0800)]
net/http: fix Transport races & deadlocks

Thanks to Dustin Sallings for exposing the most frustrating
bug ever, and for providing repro cases (which formed the
basis of the new tests in this CL), and to Dave Cheney and
Dmitry Vyukov for help debugging and fixing.

This CL depends on submited pollster CLs ffd1e075c260 (Unix)
and 14b544194509 (Windows), as well as unsubmitted 6852085.
Some operating systems (OpenBSD, NetBSD, ?) may still require
more pollster work, fixing races (Issue 4434 and
http://goo.gl/JXB6W).

Tested on linux-amd64 and darwin-amd64, both with GOMAXPROCS 1
and 4 (all combinations of which previously failed differently)

Fixes #4191
Update #4434 (related fallout from this bug)

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

12 years agocmd/gc: Make sure bools lose idealness when used with logical operators.
Daniel Morsing [Mon, 26 Nov 2012 21:23:13 +0000 (22:23 +0100)]
cmd/gc: Make sure bools lose idealness when used with logical operators.

Bools from comparisons can be assigned to all bool types, but this idealness would propagate through logical operators when the result should have been lowered to a non-ideal form.

Fixes #3924.

R=golang-dev, remyoudompheng, r, rsc, mtj
CC=golang-dev
https://golang.org/cl/6855061

12 years agogo/printer: some internal cleanups
Robert Griesemer [Mon, 26 Nov 2012 21:20:30 +0000 (13:20 -0800)]
go/printer: some internal cleanups

Cleanups introduced originally by now abandoned
https://golang.org/cl/6846078/ .

Includes additional test cases for 'if' and 'for'
statements.

No formatting changes.

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

12 years agogo/printer: Permit declaration and statement lists as input.
Robert Griesemer [Mon, 26 Nov 2012 21:14:04 +0000 (13:14 -0800)]
go/printer: Permit declaration and statement lists as input.

Also: Can set base indentation in printer.Config: all code
is going to be indented by at least that amount (except for
raw string literals spanning multiple lines, since their
values must not change).

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

12 years agodoc/play: don't use println in examples
Brad Fitzpatrick [Mon, 26 Nov 2012 21:05:18 +0000 (13:05 -0800)]
doc/play: don't use println in examples

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

12 years agocmd/6l, cmd/8l: emit no-ops to separate zero-stack funcs from nosplits.
Rémy Oudompheng [Mon, 26 Nov 2012 20:51:48 +0000 (21:51 +0100)]
cmd/6l, cmd/8l: emit no-ops to separate zero-stack funcs from nosplits.

The stack overflow checker in the linker uses the spadj field
to determine whether stack space will be large enough or not.
When spadj=0, the checker treats the function as a nosplit
and emits an error although the program is correct.

Also enable the stack checker in 8l.

Fixes #4316.

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

12 years agoexp/types: fixed field/method lookup
Robert Griesemer [Mon, 26 Nov 2012 20:49:04 +0000 (12:49 -0800)]
exp/types: fixed field/method lookup

also:

- composite literal checking close to complete
- cleaned up parameter, method, field checking
- don't let panics escape type checker
- more TODOs eliminated

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

12 years agospec: add () to method calls in examples
Russ Cox [Mon, 26 Nov 2012 20:43:32 +0000 (15:43 -0500)]
spec: add () to method calls in examples

Since p.M is rejected (must call methods), use p.M(),
to keep the examples compiling.

Fixes #4441.

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

12 years agocmd/8l: fix data corruption for MULB SI,
Rémy Oudompheng [Mon, 26 Nov 2012 20:31:42 +0000 (21:31 +0100)]
cmd/8l: fix data corruption for MULB SI,

The 8l linker automatically inserts XCHG instructions
to support otherwise impossible byte registers
(only available on AX, BX, CX, DX).

Sometimes AX or DX is needed (for MUL and DIV) so
we need to avoid clobbering them.

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

12 years agolibmach, cmd/cc, cmd/cov, cmd/ld, cmd/prof: check malloc return value
Shenghou Ma [Mon, 26 Nov 2012 19:05:46 +0000 (03:05 +0800)]
libmach, cmd/cc, cmd/cov, cmd/ld, cmd/prof: check malloc return value

Update #4415.

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

12 years agocrypto/tls: use 1/n-1 record splitting to protect against BEAST
Anthony Martin [Mon, 26 Nov 2012 18:56:39 +0000 (10:56 -0800)]
crypto/tls: use 1/n-1 record splitting to protect against BEAST

This requires rebasing the block-mode test scripts.
I used GnuTLS version 3.1.4.

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

12 years agonet: add deadline prolongation test
Dmitriy Vyukov [Mon, 26 Nov 2012 18:28:39 +0000 (22:28 +0400)]
net: add deadline prolongation test
Currently the test exposes data races on deadline vars.

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

12 years agocnd/gc: fix build
Dmitriy Vyukov [Mon, 26 Nov 2012 18:14:43 +0000 (22:14 +0400)]
cnd/gc: fix build

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

12 years agocmd/go: racewalk: fix nested struct handling
Dmitriy Vyukov [Mon, 26 Nov 2012 18:11:05 +0000 (22:11 +0400)]
cmd/go: racewalk: fix nested struct handling
Fixes #4424.
Fixes #4425.

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

12 years agocmd/gc: fix invalid indirect error at statement level
Shenghou Ma [Mon, 26 Nov 2012 17:46:54 +0000 (01:46 +0800)]
cmd/gc: fix invalid indirect error at statement level
Fixes #4429.

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

12 years agoruntime: duplicate code for runtime.nanotime to avoid stack overflow in vDSO clock_ge...
Shenghou Ma [Mon, 26 Nov 2012 17:42:01 +0000 (01:42 +0800)]
runtime: duplicate code for runtime.nanotime to avoid stack overflow in vDSO clock_gettime
Fixes #4402.

R=remyoudompheng, shivakumar.gn, random0x00, rsc
CC=golang-dev
https://golang.org/cl/6842063

12 years agotest: add test for floating point rounding of constants
Ian Lance Taylor [Mon, 26 Nov 2012 16:31:15 +0000 (08:31 -0800)]
test: add test for floating point rounding of constants

Failed with gccgo.

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

12 years agoruntime: re-format comments.
Oling Cat [Mon, 26 Nov 2012 15:53:11 +0000 (10:53 -0500)]
runtime: re-format comments.
add necessary newlines.

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

12 years agonet, cmd/fix: add IPv6 scoped addressing zone to INET, INET6 address structs
Mikio Hara [Mon, 26 Nov 2012 15:45:42 +0000 (00:45 +0900)]
net, cmd/fix: add IPv6 scoped addressing zone to INET, INET6 address structs

This CL starts to introduce IPv6 scoped addressing capability
into the net package.

The Public API changes are:
+pkg net, type IPAddr struct, Zone string
+pkg net, type IPNet struct, Zone string
+pkg net, type TCPAddr struct, Zone string
+pkg net, type UDPAddr struct, Zone string

Update #4234.

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

12 years agoruntime: regenerate defs-files for freebsd
Mikio Hara [Mon, 26 Nov 2012 12:29:13 +0000 (21:29 +0900)]
runtime: regenerate defs-files for freebsd

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

12 years agonet/http: clarify docs of ParseForm and mention ParseForm in docs for FormValue
Shenghou Ma [Mon, 26 Nov 2012 12:03:24 +0000 (20:03 +0800)]
net/http: clarify docs of ParseForm and mention ParseForm in docs for FormValue
while we're at it, also fix a return value stutter in ParseForm.

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

12 years agoruntime: implement SysUnused for netbsd
Joel Sing [Mon, 26 Nov 2012 11:34:01 +0000 (22:34 +1100)]
runtime: implement SysUnused for netbsd

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

12 years agoruntime: implement SysUnused for openbsd
Joel Sing [Mon, 26 Nov 2012 11:32:59 +0000 (22:32 +1100)]
runtime: implement SysUnused for openbsd

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

12 years agocmd/gc: check malloc return value
Joel Sing [Mon, 26 Nov 2012 11:03:31 +0000 (22:03 +1100)]
cmd/gc: check malloc return value

Check the return value from malloc - do not assume that we were
allocated memory just because we asked for it.

Update #4415.

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

12 years agonet: never return -1 bytes read from netFD.Read
Dave Cheney [Sun, 25 Nov 2012 23:59:43 +0000 (10:59 +1100)]
net: never return -1 bytes read from netFD.Read

If the a network read would block, and a packet arrived just before the timeout expired, then the number of bytes from the previous (blocking) read, -1, would be returned.

This change restores the previous logic, where n would be unconditionally set to 0 if err != nil, but was skipped due to a change in CL 6851096.

The test for this change is CL 6851061.

R=bradfitz, mikioh.mikioh, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/6852085

12 years agonet/http/httptest: protect against port reuse
Brad Fitzpatrick [Sun, 25 Nov 2012 23:23:20 +0000 (15:23 -0800)]
net/http/httptest: protect against port reuse

Should make BSDs more reliable. (they seem to reuse ports
quicker than Linux)

Tested by hand with local modifications to force reuse on
Linux. (net/http tests failed before, pass now) Details in the
issue.

Fixes #4436

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

12 years agobytes, strings: fix Reader WriteTo return value on 0 bytes copied
Brad Fitzpatrick [Sun, 25 Nov 2012 17:04:13 +0000 (09:04 -0800)]
bytes, strings: fix Reader WriteTo return value on 0 bytes copied

Fixes #4421

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

12 years agoruntime: fix madvise for freebsd/amd64
Mikio Hara [Sun, 25 Nov 2012 09:46:41 +0000 (18:46 +0900)]
runtime: fix madvise for freebsd/amd64

Make use of carry clear condition instead of low or same.

R=minux.ma, jsing, dave
CC=golang-dev
https://golang.org/cl/6844080

12 years agonet: add unit tests for read/write deadlines
Dmitriy Vyukov [Sun, 25 Nov 2012 09:27:32 +0000 (13:27 +0400)]
net: add unit tests for read/write deadlines
The tests verify that deadlines are "persistent",
read/write deadlines do not interfere, can be reset,
read deadline can be set with both SetDeadline()
and SetReadDeadline(), etc.

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

12 years agotest: add bug469, a case where gccgo gaves an incorrect error
Ian Lance Taylor [Sun, 25 Nov 2012 00:53:08 +0000 (16:53 -0800)]
test: add bug469, a case where gccgo gaves an incorrect error

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

12 years agotime: add Now()/UnixNano() malloc tests
Dave Cheney [Sun, 25 Nov 2012 00:29:06 +0000 (11:29 +1100)]
time: add Now()/UnixNano() malloc tests

The fix for issue 4403 may include more calls to time.Now().UnixNano(). I was concerned that if this function allocated it would cause additional garbage on the heap. It turns out that it doesn't, which is a nice surprise.

Also add benchmark for Now().UnixNano()

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

12 years agonet: do not start io if deadline has passed
Alex Brainman [Sat, 24 Nov 2012 23:02:57 +0000 (10:02 +1100)]
net: do not start io if deadline has passed

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

12 years agohttp/transport.go: trivial comment error.
Caine Tighe [Sat, 24 Nov 2012 21:08:17 +0000 (05:08 +0800)]
http/transport.go: trivial comment error.

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

12 years agocmd/go: fix typo in comment
Ian Lance Taylor [Sat, 24 Nov 2012 19:25:17 +0000 (11:25 -0800)]
cmd/go: fix typo in comment

Fixes #4432.

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

12 years agonet: check read and write deadlines before doing syscalls
Brad Fitzpatrick [Sat, 24 Nov 2012 06:15:26 +0000 (22:15 -0800)]
net: check read and write deadlines before doing syscalls

Otherwise a fast sender or receiver can make sockets always
readable or writable, preventing deadline checks from ever
occuring.

Update #4191 (fixes it with other CL, coming separately)
Fixes #4403

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

12 years agoruntime: implement runtime.SysUnused on FreeBSD
John Graham-Cumming [Sat, 24 Nov 2012 04:55:19 +0000 (15:55 +1100)]
runtime: implement runtime.SysUnused on FreeBSD

madvise was missing so implement it in assembler. This change
needs to be extended to the other BSD variantes (Net and Open)

Without this change the scavenger will attempt to pass memory back
to the operating system when it has become idle, but the memory is
not returned and for long running Go processes the total memory used
can grow until OOM occurs.

I have only been able to test the code on FreeBSD AMD64. The ARM
platforms needs testing.

R=golang-dev, mikioh.mikioh, dave, jgc, minux.ma
CC=golang-dev
https://golang.org/cl/6850081

12 years agonet/http/httptest: fix possible race on historyListener.history
Dave Cheney [Sat, 24 Nov 2012 04:50:43 +0000 (15:50 +1100)]
net/http/httptest: fix possible race on historyListener.history

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

12 years agoA+C: Add John Graham-Cumming (Individual CLA)
Brad Fitzpatrick [Sat, 24 Nov 2012 04:30:03 +0000 (20:30 -0800)]
A+C: Add John Graham-Cumming (Individual CLA)

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

12 years agocmd/go: fix data race on cgoLibGccFile
Shenghou Ma [Fri, 23 Nov 2012 11:58:46 +0000 (19:58 +0800)]
cmd/go: fix data race on cgoLibGccFile
Fixes #4426.

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

12 years agocmd/go: show -race if necessary when giving "go test -i" hint
Shenghou Ma [Fri, 23 Nov 2012 11:29:22 +0000 (19:29 +0800)]
cmd/go: show -race if necessary when giving "go test -i" hint

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

12 years agospec: be clearer about the scope of a package name
Robert Griesemer [Wed, 21 Nov 2012 22:40:50 +0000 (14:40 -0800)]
spec: be clearer about the scope of a package name

We have the notion of a PackageName, not package identifier.
As is, it could construed that imports that rename a package
don't have an "imported package identifier" but a local one.

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

12 years agodashboard/builder: pass $CC to builder if set
Dave Cheney [Wed, 21 Nov 2012 21:41:02 +0000 (08:41 +1100)]
dashboard/builder: pass $CC to builder if set

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

12 years agonet/http: use runtime.Stack instead of runtime/debug.Stack
Dave Cheney [Wed, 21 Nov 2012 21:18:45 +0000 (08:18 +1100)]
net/http: use runtime.Stack instead of runtime/debug.Stack

Fixes #4060.

2012/11/21 19:51:34 http: panic serving 127.0.0.1:47139: Kaaarn!
goroutine 7 [running]:
net/http.func·004(0x7f330807ffb0, 0x7f330807f100)
/home/dfc/go/src/pkg/net/http/server.go:615 +0xa7
----- stack segment boundary -----
main.(*httpHandler).ServeHTTP()
/home/dfc/src/httppanic.go:16 +0x53
net/http.(*conn).serve(0xc200090240, 0x0)
/home/dfc/go/src/pkg/net/http/server.go:695 +0x55d
created by net/http.(*Server).Serve
/home/dfc/go/src/pkg/net/http/server.go:1119 +0x36d

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

12 years agocmd/cgo: fix alignment of bool.
Vladimir Nikishenko [Wed, 21 Nov 2012 21:04:38 +0000 (13:04 -0800)]
cmd/cgo: fix alignment of bool.
Fixes #4417.

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

12 years agoall: fix the the typos
Shenghou Ma [Wed, 21 Nov 2012 18:58:24 +0000 (02:58 +0800)]
all: fix the the typos
Fixes #4420.

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

12 years agoA+C: Add Vladimir Nikishenko (Individual CLA)
Brad Fitzpatrick [Wed, 21 Nov 2012 18:40:14 +0000 (10:40 -0800)]
A+C: Add Vladimir Nikishenko (Individual CLA)

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

12 years agoruntime: update openbsd runtime to use new tfork syscall
Joel Sing [Wed, 21 Nov 2012 14:25:53 +0000 (01:25 +1100)]
runtime: update openbsd runtime to use new tfork syscall

Update OpenBSD runtime to use the new version of the sys___tfork
syscall and switch TLS initialisation from sys_arch to sys___set_tcb
(note that both of these syscalls are available in OpenBSD 5.2).

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

12 years agocmd/8g: fix erroneous LEAL nil.
Rémy Oudompheng [Wed, 21 Nov 2012 07:39:45 +0000 (08:39 +0100)]
cmd/8g: fix erroneous LEAL nil.

Fixes #4399.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6845053

12 years agonet: remove another unguarded sysfile == nil check
Dave Cheney [Wed, 21 Nov 2012 04:04:22 +0000 (15:04 +1100)]
net: remove another unguarded sysfile == nil check

Putting aside the unguarded access to fd.sysfile, the condition will never be true as fd.incref above handles the closed condition.

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

12 years agonet/http, net/http/httputil: fix TestChunkReaderAllocs failure when GOMAXPROCS > 1
Shenghou Ma [Tue, 20 Nov 2012 18:18:34 +0000 (02:18 +0800)]
net/http, net/http/httputil: fix TestChunkReaderAllocs failure when GOMAXPROCS > 1

R=fullung, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6846081

12 years agoexp/types: don't test importing types if using gccgo
Ian Lance Taylor [Tue, 20 Nov 2012 05:56:24 +0000 (21:56 -0800)]
exp/types: don't test importing types if using gccgo

The exp/types packages does not support the gccgo export data
format.  At some point it should, but not yet.

R=gri, bradfitz, r, iant, dsymonds
CC=golang-dev
https://golang.org/cl/6854068

12 years agonet/http/cgi: another attempt to fix windows tests
Alex Brainman [Tue, 20 Nov 2012 05:24:12 +0000 (16:24 +1100)]
net/http/cgi: another attempt to fix windows tests

Also enables TestDirWindows test on windows.

Fixes #4401.

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

12 years agonet/http: remove more garbage from chunk reading
Brad Fitzpatrick [Tue, 20 Nov 2012 03:50:42 +0000 (19:50 -0800)]
net/http: remove more garbage from chunk reading

Noticed this while closing tabs. Yesterday I thought I could
ignore this garbage and hope that a fix for issue 2205 handled
it, but I just realized that's the opposite case,
string->[]byte, whereas this is []byte->string.  I'm having a
hard time convincing myself that an Issue 2205-style fix with
static analysis and faking a string header would be safe in
all cases without violating the memory model (callee assumes
frozen memory; are there non-racy ways it could keep being
modified?)

R=dsymonds
CC=dave, gobot, golang-dev
https://golang.org/cl/6850067

12 years agomime/multipart: transparently decode quoted-printable transfer encoding
Brad Fitzpatrick [Tue, 20 Nov 2012 03:50:19 +0000 (19:50 -0800)]
mime/multipart: transparently decode quoted-printable transfer encoding

Fixes #4411

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

12 years agocmd/api: speed up API check by 2x, caching parser.ParseFile calls
Brad Fitzpatrick [Mon, 19 Nov 2012 21:50:20 +0000 (13:50 -0800)]
cmd/api: speed up API check by 2x, caching parser.ParseFile calls

Saves 5 seconds on my machine. If Issue 4380 is fixed this
clone can be removed.

Update #4380

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

12 years agogo/printer: simply ignore filename changes in position information
Robert Griesemer [Mon, 19 Nov 2012 21:23:32 +0000 (13:23 -0800)]
go/printer: simply ignore filename changes in position information

There's no good reason to make any printer state adjustments
simply because the file name in node position information has
changed. Eliminate the relevant code.

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

12 years agodoc/articles/wiki: fix racy test
Brad Fitzpatrick [Mon, 19 Nov 2012 20:36:15 +0000 (12:36 -0800)]
doc/articles/wiki: fix racy test

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

12 years agonet/http/cgi: more windows perl test work
Brad Fitzpatrick [Mon, 19 Nov 2012 18:40:13 +0000 (10:40 -0800)]
net/http/cgi: more windows perl test work

Don't rely on finding cmd.exe in a particular spot.

Fixes #4401

R=golang-dev, krautz
CC=golang-dev
https://golang.org/cl/6842066

12 years agoruntime: gdb support: use parse_and_eval to get the goroutine id
Christian Himpel [Mon, 19 Nov 2012 18:22:47 +0000 (10:22 -0800)]
runtime: gdb support: use parse_and_eval to get the goroutine id

This enables to loop over some goroutines, e.g. to print the
backtrace of goroutines 1 to 9:

        set $i = 1
        while $i < 10
        printf "backtrace of goroutine %d:\n", $i
        goroutine $i++ bt
        end

R=lvd, lvd
CC=golang-dev
https://golang.org/cl/6843071

12 years agocmd/gc: complain about invalid whitespace chars
Robert Griesemer [Mon, 19 Nov 2012 17:09:04 +0000 (09:09 -0800)]
cmd/gc: complain about invalid whitespace chars

Fixes #4405.

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

12 years agonet/http/cgi: make test more robust for Windows perl
Brad Fitzpatrick [Mon, 19 Nov 2012 16:25:51 +0000 (08:25 -0800)]
net/http/cgi: make test more robust for Windows perl

Update #4401

R=golang-dev, mattn.jp
CC=golang-dev
https://golang.org/cl/6853067

12 years agonet: fix data race on fd.sysfd
Dave Cheney [Sun, 18 Nov 2012 19:53:58 +0000 (06:53 +1100)]
net: fix data race on fd.sysfd

Fixes #4369.

Remove the check for fd.sysfd < 0, the first line of fd.accept() tests if the fd is open correctly and will handle the fd being closed during accept.

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

12 years agonet: remove unused nil check
Dave Cheney [Sun, 18 Nov 2012 04:31:26 +0000 (15:31 +1100)]
net: remove unused nil check

This is part 1 of a series of proposals to fix issue 4369.

In resolving issue 3507 it was decided not to nil out the inner conn.fd field to avoid a race. This implies the checks for fd == nil inside incref/decref are never true.

Removing this logic removes one source of errClosing error values, which affects issue 4373 and moves towards bradfitz's request that fd.accept() return io.EOF when closed concurrently.

Update #4369.
Update #4373.

R=mikioh.mikioh, bradfitz, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/6852057

12 years agoruntime/cgo: enable warnings and treat as errors
Dave Cheney [Sat, 17 Nov 2012 21:58:54 +0000 (08:58 +1100)]
runtime/cgo: enable warnings and treat as errors

Enable warnings as errors during the cgo portion of runtime/cgo. iant requested that the list of flags match cmd/dist/build.c, but I would like to avoid the set of disabled warnings if possible.

ref: https://groups.google.com/d/topic/golang-nuts/TrCoVzIIG4M/discussion

requires: 6843061

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

12 years agospec: fix constant expression example
Robert Griesemer [Sat, 17 Nov 2012 19:16:07 +0000 (11:16 -0800)]
spec: fix constant expression example

Fixes #4400.

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

12 years agoruntime: don't assume AT_RANDOM provide 4-byte aligned ptr
Shenghou Ma [Sat, 17 Nov 2012 18:47:17 +0000 (02:47 +0800)]
runtime: don't assume AT_RANDOM provide 4-byte aligned ptr

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

12 years agogo/doc: fix identifier blank import handling for examples
Robert Griesemer [Sat, 17 Nov 2012 18:40:11 +0000 (10:40 -0800)]
go/doc: fix identifier blank import handling for examples

Replacement CL for 6813061; thanks to minux for prototyping.

Fixes #4300.

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

12 years agolib/godoc/codewalk.html: remove duplicate jquery inclusion
Shenghou Ma [Sat, 17 Nov 2012 18:28:54 +0000 (02:28 +0800)]
lib/godoc/codewalk.html: remove duplicate jquery inclusion
now we load jquery in its parent--godoc.html.

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

12 years agocrypto/md5: speed up aligned writes and test/bench unaligned writes
Shenghou Ma [Sat, 17 Nov 2012 18:23:34 +0000 (02:23 +0800)]
crypto/md5: speed up aligned writes and test/bench unaligned writes
Write() can safely use uint32 loads when input is aligned.
Also add test and benchmarks for unaligned writes.

Benchmark result obtained by Dave Cheney on ARMv5TE @ 1.2GHz:
benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                  4104         3417  -16.74%
BenchmarkHash1K                     22061        11208  -49.20%
BenchmarkHash8K                    146630        65148  -55.57%
BenchmarkHash8BytesUnaligned         4128         3436  -16.76%
BenchmarkHash1KUnaligned            22054        21473   -2.63%
BenchmarkHash8KUnaligned           146658       146909   +0.17%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                  1.95         2.34    1.20x
BenchmarkHash1K                     46.42        91.36    1.97x
BenchmarkHash8K                     55.87       125.74    2.25x
BenchmarkHash8BytesUnaligned         1.94         2.33    1.20x
BenchmarkHash1KUnaligned            46.43        47.69    1.03x
BenchmarkHash8KUnaligned            55.86        55.76    1.00x

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

12 years agoruntime/cgo: fix compilation on Windows with CFLAGS -Wall -Werror
Shenghou Ma [Sat, 17 Nov 2012 18:06:08 +0000 (02:06 +0800)]
runtime/cgo: fix compilation on Windows with CFLAGS -Wall -Werror
also fix one out-of-date comment in cmd/ld/pe.c as well.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/6843061

12 years agoarchive/zip: handle extra data headers with no body
Dave Cheney [Sat, 17 Nov 2012 13:45:47 +0000 (00:45 +1100)]
archive/zip: handle extra data headers with no body

Fixes #4393.

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