1
0
mirror of https://github.com/golang/go synced 2024-09-24 17:10:13 -06:00
Commit Graph

14543 Commits

Author SHA1 Message Date
Rémy Oudompheng
bcea0dd1d0 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
2012-12-03 13:39:40 +01:00
Mikio Hara
19d793a327 net: simplify ListenTCP
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6875044
2012-12-03 20:00:50 +09:00
Luit van Drongelen
882953f62c 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
2012-12-01 15:15:14 -08:00
Johan Euphrosine
d7b0f2a524 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
2012-12-01 14:11:46 -08:00
Brad Fitzpatrick
444b7b53e0 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
2012-12-01 11:02:08 -08:00
Rémy Oudompheng
b18a7c7cae 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
2012-12-01 09:26:07 +01:00
Mikio Hara
e3e885bb48 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
2012-12-01 14:49:54 +09:00
Ian Lance Taylor
0304a48595 test: add a test that caused gccgo to crash
R=golang-dev
CC=golang-dev
https://golang.org/cl/6849129
2012-11-30 14:14:51 -08:00
Anthony Martin
253ed02918 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
2012-11-30 11:41:50 -08:00
Shenghou Ma
279199ebcc 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
2012-12-01 00:42:50 +08:00
Shenghou Ma
9e30b708a1 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
2012-12-01 00:38:01 +08:00
Dave Cheney
5b425cc3ab 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
2012-11-30 20:02:30 +11:00
Dave Cheney
be0d84e335 net: fix data races on deadline vars
Fixes #4434.

R=mikioh.mikioh, bradfitz, dvyukov, alex.brainman
CC=golang-dev
https://golang.org/cl/6855110
2012-11-30 18:26:51 +11:00
Dmitriy Vyukov
0ce96f9ef4 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
2012-11-30 10:29:41 +04:00
Dmitriy Vyukov
c3c107f67c 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
2012-11-30 10:27:43 +04:00
Alex Brainman
902af974cb 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
2012-11-30 16:10:45 +11:00
Brad Fitzpatrick
9c2f410206 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
2012-11-29 18:00:51 -08:00
Robert Griesemer
85e451e2fe go spec: receiver, parameter, and result names must always be unique
Fixes #4450.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6845104
2012-11-29 14:47:47 -08:00
Russ Cox
6d622416f1 net: add test case for SplitHostPort with zone
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6854119
2012-11-29 15:43:05 -05:00
Robert Griesemer
25dd00295c 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
2012-11-29 11:46:25 -08:00
Brad Fitzpatrick
372cf8fe87 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
2012-11-29 11:19:55 -08:00
Robert Griesemer
521f11de6b 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
2012-11-29 09:57:37 -08:00
Robert Griesemer
305d7ada2b 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
2012-11-28 16:03:34 -08:00
Alex Brainman
5b65023563 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
2012-11-28 17:01:59 +11:00
Alex Brainman
16a5934540 exp/winfsnotify: fix data race in TestNotifyClose
Fixes #4342.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6850080
2012-11-28 17:01:22 +11:00
Alex Brainman
b5aa4789f9 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
2012-11-28 17:00:50 +11:00
Dave Cheney
28b599425d 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
2012-11-28 11:29:25 +11:00
Mikio Hara
da803e5cd3 net: fix ResolveIPAddr
Fixes misedit in CL 6842053.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6849115
2012-11-28 08:45:23 +09:00
Dave Cheney
d244dd09f3 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
2012-11-28 10:08:59 +11:00
Mikio Hara
4f74bbd24c 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
2012-11-28 06:36:05 +09:00
Rémy Oudompheng
f134742f24 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
2012-11-27 21:37:38 +01:00
Robert Griesemer
e781b20ac9 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
2012-11-27 10:29:49 -08:00
Jan Ziak
51b8edcb37 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
2012-11-27 13:04:59 -05:00
Dmitriy Vyukov
58ce93b6bf runtime/race: add test case for issue 4453
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6854103
2012-11-27 21:59:08 +04:00
Rick Arnold
94b3f6d728 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
2012-11-27 12:58:27 -05:00
Russ Cox
a93b15cad9 misc/emacs: fix go-mode hang
Fix suggested by serbaut.

Fixes #4445.

R=sameer
CC=golang-dev, serbaut
https://golang.org/cl/6842102
2012-11-27 12:21:10 -05:00
Volker Dobler
b46de71457 regexp: add examples
Update #4125

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6847107
2012-11-27 10:33:15 -05:00
John Graham-Cumming
4228eb7915 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
2012-11-27 10:21:43 -05:00
Dmitriy Vyukov
908e1b5ea1 runtime/race: add unit tests for race detector
R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6525052
2012-11-27 15:04:48 +04:00
Dmitriy Vyukov
d6fd52c088 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
2012-11-27 12:18:54 +04:00
Nigel Tao
478aff3d4d 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
2012-11-27 18:20:44 +11:00
Brad Fitzpatrick
d729be730f 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
2012-11-26 21:21:07 -08:00
Robert Griesemer
bb7c3c6803 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
2012-11-26 17:17:49 -08:00
Anthony Martin
178c8578d5 os/user: update stub documentation
R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6844088
2012-11-26 16:02:08 -08:00
Anthony Martin
4ce3df5074 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
2012-11-26 15:26:46 -08:00
Rémy Oudompheng
4cc9de9147 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
2012-11-26 23:45:22 +01:00
Robert Griesemer
4a1b814668 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
2012-11-26 14:20:05 -08:00
Brad Fitzpatrick
127d2bf785 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
2012-11-26 13:31:02 -08:00
Daniel Morsing
5188c0b59c 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
2012-11-26 22:23:13 +01:00
Robert Griesemer
9a61c0412c 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
2012-11-26 13:20:30 -08:00