]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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

12 years agotest: add test for unused calls to builtin functions
Ian Lance Taylor [Tue, 4 Dec 2012 02:49:47 +0000 (18:49 -0800)]
test: add test for unused calls to builtin functions

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

12 years agotest: add test for issue 4468 (go/defer expr may not be parenthesized)
Ian Lance Taylor [Tue, 4 Dec 2012 02:49:14 +0000 (18:49 -0800)]
test: add test for issue 4468 (go/defer expr may not be parenthesized)

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

12 years agoA+C: Egon Elbre (individual CLA)
Andrew Gerrand [Mon, 3 Dec 2012 23:14:21 +0000 (10:14 +1100)]
A+C: Egon Elbre (individual CLA)

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

12 years agospec: channel operations are restricted by the channel direction
Robert Griesemer [Mon, 3 Dec 2012 22:23:41 +0000 (14:23 -0800)]
spec: channel operations are restricted by the channel direction

Also:
- 'for' statements with a range clause do not accept send-only
   channels
- '_, _ = range ch' is not equivalent to "_ = range ch" if ch
   is a channel (rewriting the latter to the former leads to
   an invalid range clause).

These clarifications document the status quo.

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

12 years agocmd/dist: support building on debian/kFreeBSD
Dave Cheney [Mon, 3 Dec 2012 21:27:30 +0000 (08:27 +1100)]
cmd/dist: support building on debian/kFreeBSD

The debian/kFreeBSD project uses the FreeBSD kernel and the debian userspace. From our point of view, this is freebsd not linux as GOOS talks about the kernel syscall interface, not the userspace (although cgo alters that). As debian/kFreeBSD is experimental at this time, I do not think it is worth the effort of duplicating all the freebsd specific code so this is proposal represents a reasonable workaround.

Currently cgo is not supported, make.bash will detect this and disable cgo automatically during the build.

dfc@debian:~/go/src$ uname -a
GNU/kFreeBSD debian 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386 Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz GNU/kFreeBSD
dfc@debian:~/go/src$ ../bin/go version
go version devel +d05272f402ec Sat Dec 01 15:15:14 2012 -0800

Tested with GOOS=freebsd GOARCH=386

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

12 years agobytes: avoid duplicate malloc/copy in Buffer.ReadString
Rémy Oudompheng [Mon, 3 Dec 2012 13:04:18 +0000 (14:04 +0100)]
bytes: avoid duplicate malloc/copy in Buffer.ReadString

Twice faster and twice less garbage.

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

12 years agocmd/gc: fix inlining internal error with T.Method calls.
Rémy Oudompheng [Mon, 3 Dec 2012 12:39:40 +0000 (13:39 +0100)]
cmd/gc: fix inlining internal error with T.Method calls.

The compiler was confused when inlining a T.Method(f()) call
where f returns multiple values: support for this was marked
as TODO.

Variadic calls are not supported but are not inlined either.
Add a test preventively for that case.

Fixes #4167.

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

12 years agonet: simplify ListenTCP
Mikio Hara [Mon, 3 Dec 2012 11:00:50 +0000 (20:00 +0900)]
net: simplify ListenTCP

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

12 years agoencoding/gob: Fix typo in doc.go
Luit van Drongelen [Sat, 1 Dec 2012 23:15:14 +0000 (15:15 -0800)]
encoding/gob: Fix typo in doc.go

Exactly how I find minute details like this is beyond me.

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

12 years agomath/rand: remove noop iteration in Perm
Johan Euphrosine [Sat, 1 Dec 2012 22:11:46 +0000 (14:11 -0800)]
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

12 years agocrypto/tls: fix loading keys labeled just "PRIVATE KEY"
Brad Fitzpatrick [Sat, 1 Dec 2012 19:02:08 +0000 (11:02 -0800)]
crypto/tls: fix loading keys labeled just "PRIVATE KEY"

Worked in Go 1, broken in f440e65f93fe.

Fixes #4477

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

12 years agonet: remove unnecessary Close contention.
Rémy Oudompheng [Sat, 1 Dec 2012 08:26:07 +0000 (09:26 +0100)]
net: remove unnecessary Close contention.

Contention profile in BenchmarkTCPOneShot (Core 2 Quad):

Before
Total: 80.285 seconds
44.743  55.7%  55.7%   44.743  55.7% runtime.chanrecv1
31.995  39.9%  95.6%   31.995  39.9% sync.(*Mutex).Lock
 3.547   4.4% 100.0%    3.547   4.4% runtime.chansend1

After
Total: 48.341 seconds
45.810  94.8%  94.8%   45.810  94.8% runtime.chanrecv1
 2.530   5.2% 100.0%    2.530   5.2% runtime.chansend1
 0.001   0.0% 100.0%    0.001   0.0% sync.(*Mutex).Lock

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

12 years agonet: allow "" as a hint wildcard to Resolve{IP,UDP,TCP}Addr
Mikio Hara [Sat, 1 Dec 2012 05:49:54 +0000 (14:49 +0900)]
net: allow "" as a hint wildcard to Resolve{IP,UDP,TCP}Addr

Also fixes comments on ResolveIPAddr.

Fixes #4476.

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

12 years agotest: add a test that caused gccgo to crash
Ian Lance Taylor [Fri, 30 Nov 2012 22:14:51 +0000 (14:14 -0800)]
test: add a test that caused gccgo to crash

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

12 years agonet: update docs and sync API for Plan 9
Anthony Martin [Fri, 30 Nov 2012 19:41:50 +0000 (11:41 -0800)]
net: update docs and sync API for Plan 9

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

12 years agocmd/godoc: fix `godoc net/http` on windows
Shenghou Ma [Fri, 30 Nov 2012 16:42:50 +0000 (00:42 +0800)]
cmd/godoc: fix `godoc net/http` on windows
`godoc net/http` used to complain "/target contains more than one package: http, main"

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

12 years agoall: set GOMAXPROCS to 1 when counting mallocs
Shenghou Ma [Fri, 30 Nov 2012 16:38:01 +0000 (00:38 +0800)]
all: set GOMAXPROCS to 1 when counting mallocs
also fix an annoying test that relies on $GOROOT be set.
Fixes #3690.

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

12 years agoundo CL 6855110 / 869253ef7009
Dave Cheney [Fri, 30 Nov 2012 09:02:30 +0000 (20:02 +1100)]
undo CL 6855110 / 869253ef7009

64bit atomics are broken on 32bit systems. This is issue 599.

linux/arm builders all broke with this change, I am concerned that the other 32bit builders are silently impacted.

««« original CL description
net: fix data races on deadline vars

Fixes #4434.

R=mikioh.mikioh, bradfitz, dvyukov, alex.brainman
CC=golang-dev
https://golang.org/cl/6855110
»»»

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

12 years agonet: fix data races on deadline vars
Dave Cheney [Fri, 30 Nov 2012 07:26:51 +0000 (18:26 +1100)]
net: fix data races on deadline vars

Fixes #4434.

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

12 years agoruntime: better stack traces in race reports
Dmitriy Vyukov [Fri, 30 Nov 2012 06:29:41 +0000 (10:29 +0400)]
runtime: better stack traces in race reports
When a race happens inside of runtime (chan, slice, etc),
currently reports contain only user file:line.
If the line contains a complex expression,
it's difficult to figure out where the race exactly.
This change adds one more top frame with exact
runtime function (e.g. runtime.chansend, runtime.mapaccess).

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

12 years agocmd/gc: racewalk: collect stack traces in sync and sync/atomic
Dmitriy Vyukov [Fri, 30 Nov 2012 06:27:43 +0000 (10:27 +0400)]
cmd/gc: racewalk: collect stack traces in sync and sync/atomic
W/o this change stack traces do not show from where sync.Once()
or atomic.XXX was called.
This change add funcenter/exit instrumentation to sync/sync.atomic
packages.

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

12 years agoos: check only user attributes in TestStatDirModeExec
Alex Brainman [Fri, 30 Nov 2012 05:10:45 +0000 (16:10 +1100)]
os: check only user attributes in TestStatDirModeExec

Some have their system setup in a particular way,
see http://golang.org/issue/4444#c3.

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

12 years agonet/http: don't send chunked encoding on 204 responses
Brad Fitzpatrick [Fri, 30 Nov 2012 02:00:51 +0000 (18:00 -0800)]
net/http: don't send chunked encoding on 204 responses

RFC 2616: "The 204 response MUST NOT include a message-body,
and thus is always terminated by the first empty line after
the header fields."

Previously we'd trigger chunked encoding by default on
responses, and then when finishing the request we'd write the
chunk trailers, which counted as a message-body.

Fixes #4454

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

12 years agogo spec: receiver, parameter, and result names must always be unique
Robert Griesemer [Thu, 29 Nov 2012 22:47:47 +0000 (14:47 -0800)]
go spec: receiver, parameter, and result names must always be unique

Fixes #4450.

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

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