1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:41:28 -06:00
Commit Graph

7287 Commits

Author SHA1 Message Date
Nigel Tao
37d92d251b exp/html, exp/html/atom: delete, as they're moving to the go.net
sub-repo.

The matching change is at https://golang.org/cl/7310063

The rationale was discussed at
https://groups.google.com/d/topic/golang-nuts/Qq5hTQyPuLg/discussion

R=adg, dave
CC=golang-dev
https://golang.org/cl/7317043
2013-02-11 11:56:49 +11:00
Volker Dobler
de69401b75 exp/cookiejar: implementation of SetCookies
This CL provides the rest of the SetCookies code as well as
some test infrastructure which will be used to test also
the Cookies method. This test infrastructure is optimized
for readability and tries to make it easy to review table
driven test cases.

Tests for all the different corner cases of SetCookies
will be provided in a separate CL.

R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7306054
2013-02-11 11:47:31 +11:00
Shane Hansen
1068279904 archive/tar: read/write extended pax/gnu tar archives
Support reading pax archives and applying extended attributes
like long names, subsecond mtime resolutions, etc. Default to
writing pax archives for long file and link names.
Support reading gnu archives using the ././@LongLink extended
header for file name and link target.

Fixes #3300

R=dsymonds, dave, rogpeppe, remyoudompheng, chressie, rsc
CC=golang-dev
https://golang.org/cl/6700047
2013-02-11 11:36:29 +11:00
Dave Cheney
6ce3e99af0 net/http: more request benchmarks
Add benchmarks for common http benchmarking tools. The intent is to catch optimisations which favor synthetic benchmarks that do not show improvements for real clients like Chrome.

BenchmarkReadRequestChrome        200000             10133 ns/op          60.29 MB/s        3148 B/op         32 allocs/op
BenchmarkReadRequestCurl          500000              4314 ns/op          18.08 MB/s         905 B/op         15 allocs/op
BenchmarkReadRequestApachebench   500000              4363 ns/op          18.79 MB/s         956 B/op         16 allocs/op
BenchmarkReadRequestSiege         500000              6408 ns/op          24.19 MB/s        1397 B/op         22 allocs/op
BenchmarkReadRequestWrk          1000000              2838 ns/op          14.09 MB/s         757 B/op         11 allocs/op

R=golang-dev, bradfitz
CC=golang-dev, haimuiba
https://golang.org/cl/7300075
2013-02-10 08:18:09 +11:00
Adam Langley
e0791a3adf crypto/x509: disable SCG test with system validation.
On Windows, CryptoAPI is finding an alternative validation path. Since
this is a little non-deterministic, this change disables that test
when using system validation.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7313068
2013-02-09 13:51:39 -05:00
Russ Cox
6600092527 testing: be explicit about use of b.N
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7314071
2013-02-09 13:43:15 -05:00
Adam Langley
e1c309e792 crypto/x509: allow MS/NS SCG key usage as ServerAuth.
By default, crypto/x509 assumes that users wish to validate
certificates for ServerAuth. However, due to historical reasons,
COMODO's intermediates don't specify ServerAuth as an allowed key
usage.

Rather NSS and CryptoAPI both allow these SGC OIDs to be equivalent to
ServerAuth.

R=rsc
CC=golang-dev
https://golang.org/cl/7312070
2013-02-09 13:20:25 -05:00
Shenghou Ma
691e5e3b01 bytes: annotate assembly functions with //go:noescape
R=golang-dev, agl, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7299064
2013-02-10 00:08:30 +08:00
Shenghou Ma
705b4544d6 log/syslog: remove socket files after tests
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7305065
2013-02-09 08:19:09 +08:00
Mikio Hara
a0430dae04 net: fix unixgram
The socket for AF_UNIX domain with SOCK_DGARM type isn't
allowed to work with syscall listen.

R=rsc
CC=golang-dev
https://golang.org/cl/7310068
2013-02-09 08:18:32 +09:00
Jan Ziak
1e01fba2fc runtime: precise garbage collection of hashmaps
R=golang-dev, rsc
CC=dave, dvyukov, golang-dev, minux.ma, remyoudompheng
https://golang.org/cl/7252047
2013-02-08 16:00:33 -05:00
Dave Cheney
cccc96b8e9 net/http: add BenchmarkReadRequest
Add benchmark for request parsing. Fixture data is taken from https://github.com/felixge/node-http-perf

% go version
go version devel +28966b7b2f0c Thu Feb 07 20:26:12 2013 -0800 linux/amd64

% go test -run=nil -bench=ReadRequest -benchtime=10s
PASS
BenchmarkReadRequest     2000000   9900 ns/op   61.71 MB/s   3148 B/op   32 allocs/op
ok      net/http        12.180s

R=golang-dev, bradfitz, minux.ma, haimuiba
CC=golang-dev
https://golang.org/cl/7313048
2013-02-09 07:04:07 +11:00
Péter Surányi
d2252d9b07 syscall: check for invalid characters in Setenv on Unix
On POSIX, '=' in key is explicitly invalid, and '\x00' in key/value is implicitly invalid.

R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/7311061
2013-02-08 10:45:46 -08:00
Kamil Kisiel
f26fc0c017 net/http/httptest: add examples
R=golang-dev, adg, bradfitz
CC=golang-dev
https://golang.org/cl/7314046
2013-02-08 09:20:05 -08:00
Alan Donovan
5fa6721a31 exp/ssa/interp: fix MS Windows breakage.
syscall.{Kill,Write} are not portable to MS Windows, so we
disable them for now.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/7312066
2013-02-08 11:58:24 -05:00
Alan Donovan
c8f2449ea7 exp/ssa: (#5 of 5): the SSA interpreter and 'ssadump' tool.
R=gri, iant
CC=golang-dev
https://golang.org/cl/7226065
2013-02-08 10:43:53 -05:00
Dmitriy Vyukov
0a9f1ab8bb runtime/race: deflake tests
With the new scheduler races in the tests are reported during execution of other tests.
The change joins goroutines started during the tests.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7310066
2013-02-08 19:24:50 +04:00
Dmitriy Vyukov
45636db01b runtime: fix integer overflow
The problem happens when end=0, then end-1 is very big number.
Observed with the new scheduler.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7307073
2013-02-08 19:05:19 +04:00
Mikio Hara
6dfd386005 net: simplify Dial, Listen, ListenPacket and those helpers
R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7300065
2013-02-08 21:53:10 +09:00
Mikio Hara
dc6e51cfd2 net: delete duplicate listenerSockaddr
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7299067
2013-02-08 17:02:08 +09:00
Shenghou Ma
6c54bf9916 runtime: fix build for Linux/ARM
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7299055
2013-02-08 13:24:38 +08:00
Jeremy Schlatter
c94eddd1af io: Simplify CopyN implementation by delegating to Copy.
R=golang-dev, dave, minux.ma, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7312055
2013-02-07 20:26:12 -08:00
Russ Cox
18441e8ade net: do not use RLock around Accept
It might be non-blocking, but it also might be blocking.
Cannot take the chance, as Accept might block indefinitely
and make it impossible to acquire ForkLock exclusively
(during fork+exec).

Fixes #4737.

R=golang-dev, dave, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7309050
2013-02-07 22:45:12 -05:00
Brad Fitzpatrick
30a9957aac bytes: minor optimization to lastIndexFunc
Before and after:
BenchmarkTrimSpace  20000000   81.3 ns/op
BenchmarkTrimSpace  50000000   58.0 ns/op

(most whitespace trimming is ASCII whitespace)

Same optimization appeared a handful of other places
in this file, but not here.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7305063
2013-02-07 16:00:06 -08:00
Ian Lance Taylor
2b44c33b4a crypto/md5: fix for big-endian processors
R=golang-dev, minux.ma, agl
CC=golang-dev
https://golang.org/cl/7305059
2013-02-07 13:31:53 -08:00
Ian Lance Taylor
514f10b9ab net: skip TestMulticastListener on Solaris
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7308060
2013-02-07 09:58:42 -08:00
Péter Surányi
fe7dbea00e os/exec: LookPath on Unix shouldn't look in cwd when PATH is empty
R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7305053
2013-02-07 06:41:35 -08:00
Shenghou Ma
80e1cf73eb crypto/rc4: naïve ARM assembly implementation
On 800MHz Cortex-A8:
benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         9395         2838  -69.79%
BenchmarkRC4_1K         74497        22120  -70.31%
BenchmarkRC4_8K        587243       171435  -70.81%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        13.62        45.09    3.31x
BenchmarkRC4_1K         13.75        46.29    3.37x
BenchmarkRC4_8K         13.79        47.22    3.42x

Result for "OpenSSL 1.0.1c 10 May 2012" from Debian/armhf sid:
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
rc4              39553.81k    46522.39k    49336.11k    50085.63k    50258.06k

R=golang-dev, agl, dave
CC=golang-dev
https://golang.org/cl/7310051
2013-02-07 18:54:21 +08:00
Ian Lance Taylor
0592c44956 net: permit pollster DelFD to return whether to call Wakeup
This is necessary for systems that use select as the pollster,
such as Solaris (supported by gccgo).  It corresponds to the
bool returned by AddFD.  In general it's not clearly defined
what happens when a descriptor used in a select is closed, and
different systems behave differently.  Waking up the select
will cause the right thing to happen: the closed descriptor
will be dropped from the next iteration.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7303056
2013-02-06 17:18:53 -08:00
Gaal Yahas
c2fb6e2c0b sync: improve WaitGroup example by putting the call to Done in a
deferred block. This makes hangs in the waiting code less likely
if a goroutine exits abnormally.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7306052
2013-02-07 00:39:52 +08:00
Albert Strasheim
309d88e28c syscall, net: Fix unix socket autobind on Linux.
R=rsc, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7300047
2013-02-06 06:45:57 -08:00
Volker Dobler
8c6489bc27 exp/cookiejar: infrastructure for upcoming implementation
This CL is the first of a handful of CLs which will provide
the implementation of cookiejar. It contains several helper
functions and the skeleton of Cookies and SetCookies.

Proper host name handling requires the ToASCII transformation
from package idna which currently lives in the go.net
subrepo. This CL thus contains just a TODO for this issue.

R=nigeltao, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7287046
2013-02-06 22:37:34 +11:00
Dmitriy Vyukov
0a40cd2661 runtime/race: switch to explicit race context instead of goroutine id's
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real	0m9.314s
After:  $ time ./flate.test -test.short
real	0m8.958s
Fixes #4286.
The runtime is built from llvm rev 174312.

R=rsc
CC=golang-dev
https://golang.org/cl/7218044
2013-02-06 11:40:54 +04:00
Jeff R. Allen
33995fe59e log/syslog: retry once if write fails
Implements deferred connections + single-attempt automatic
retry. Based on CL 5078042 from kuroneko.

Fixes #2264.

R=mikioh.mikioh, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6782140
2013-02-05 09:54:01 -08:00
Shenghou Ma
7de3d71797 runtime: save LR to stack when panicking to handle leaf function traceback
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7289047
2013-02-06 01:18:37 +08:00
Ian Lance Taylor
da35d42521 exp/inotify: close event channel before file descriptor
Closing the inotify file descriptor can take over a second
when running on Ubuntu Precise in an NFS directory, leading to
the test error in issue 3132.  Closing the event channel first
lets a client that does not care about the error channel move
on.

Fixes #3132.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7300045
2013-02-05 06:11:10 -08:00
Caleb Spare
dff017ea99 container/heap: fix comment typo in example test
This updates a bad reference to a method name in the example priority queue test.

The error was introduced in the example refactoring in rev. 2ea8f07b2ffe.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7279045
2013-02-05 07:06:00 -05:00
Dmitriy Vyukov
6b1b613d6a runtime/race: do not include pthread.h
Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048
2013-02-05 13:08:07 +04:00
David Symonds
e7fe1944ac archive/tar: small simplification using FileMode.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305043
2013-02-05 15:39:55 +11:00
Brad Fitzpatrick
d1e16d06b4 net/http: fix Server blocking after a Handler's Write fails
If a Handle's Write to a ResponseWriter fails (e.g. via a
net.Conn WriteDeadline via WriteTimeout on the Server), the
Server was blocking forever waiting for reads on that
net.Conn, even after a Write failed.

Instead, once we see a Write fail, close the connection,
since it's then dead to us anyway.

Fixes #4741

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7301043
2013-02-04 20:26:25 -08:00
Russ Cox
a60ffed9e7 path/filepath: document that Walk does not follow symlinks
Fixes #4759.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7304043
2013-02-04 22:59:30 -05:00
Anthony Martin
c56bb1d238 syscall: fix marshaling of stat messages on Plan 9
The order of the Qid fields was reversed. Mea culpa.

R=seed
CC=golang-dev
https://golang.org/cl/7231062
2013-02-04 19:47:23 -08:00
Brad Fitzpatrick
92e4645f31 net/http: add Next Protocol Negotation upgrade support to the Server
This provides the mechanism to connect SPDY support to the http
package, without pulling SPDY into the standard library.

R=rsc, agl, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7287045
2013-02-04 13:55:38 -08:00
Mikio Hara
5ae6a23731 syscall: regenerate ztype files for linux
This CL adds TCPInfo struct to linux/386,arm.
It's already added to linux/amd64.

Note that not sure the reason but cgo godefs w/ latest gcc
translates a flexible array member in structures correctly,
handles it as a non-incomplete, non-opaque type, on Go 1.
This CL reverts such changes by hand for the Go 1 contract.

R=minux.ma, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7197046
2013-02-05 06:53:58 +09:00
Brad Fitzpatrick
022504b3ab net/http: fix when server deadlines get extended
Deadlines should be extended at the beginning of
a request, not at the beginning of a connection.

Fixes #4676

R=golang-dev, fullung, patrick.allen.higgins, adg
CC=golang-dev
https://golang.org/cl/7220076
2013-02-04 13:52:45 -08:00
Alan Donovan
c06a5335ba exp/ssa: (#4 of 5): the SSA builder.
R=iant, gri, iant, rogpeppe
CC=golang-dev
https://golang.org/cl/7196053
2013-02-04 12:22:35 -05:00
Alex Brainman
94064548c6 net: use windows sysSocket everywhere
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7273046
2013-02-04 16:03:41 +11:00
Russ Cox
472354f81e runtime/debug: add controls for garbage collector
Fixes #4090.

R=golang-dev, iant, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/7229070
2013-02-04 00:00:55 -05:00
Russ Cox
6b4cf2b367 time: fix error message from Parse
Was incorrectly discarding the offending text in some cases.

Fixes #4493.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7277050
2013-02-04 00:00:36 -05:00
Andrew Gerrand
5fad786452 regexp: update comment on (*Regexp).Longest
Missed this review comment.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7229084
2013-02-04 15:57:32 +11:00
Russ Cox
89a2a8c8df cmd/go, testing: revise docs for test flags
In cmd/go's 'go help testflag':
* Rewrite list of flags to drop test. prefix on every name.
* Sort list of flags.
* Add example of using -bench to match all benchmarks.

In testing:
* Remove mention of undefined 'CPU group' concept.

Fixes #4488.
Fixes #4508.

R=adg
CC=golang-dev
https://golang.org/cl/7288053
2013-02-03 23:47:03 -05:00
Nigel Tao
4e285bac6e container/heap: fix package doc comment about ordering.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/7280044
2013-02-04 15:30:41 +11:00
Andrew Gerrand
f41ffc2bf4 regexp: add (*Regexp).Longest
Fixes #3696.

R=rsc
CC=golang-dev
https://golang.org/cl/7133051
2013-02-04 15:28:55 +11:00
Russ Cox
1d9f67daf0 time: deal a bit better with time zones in Parse
* Document Parse's zone interpretation.
* Add ParseInLocation (API change).
* Recognize "wrong" time zone names, like daylight savings time in winter.
* Disambiguate time zone names using offset (like winter EST vs summer EST in Sydney).

The final two are backwards-incompatible changes, but I believe
they are both buggy behavior in the Go 1.0 versions; the old results
were more wrong than the new ones.

Fixes #3604.
Fixes #3653.
Fixes #4001.

R=adg
CC=golang-dev
https://golang.org/cl/7288052
2013-02-03 23:02:12 -05:00
Russ Cox
6a003d7589 time: handle zone file with no transitions
Code fix by Alex Bramley.

Fixes #4064.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7289049
2013-02-03 22:41:00 -05:00
Andrew Gerrand
0df8c7517e archive/tar: add Copyright notice to example_test.go
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7278050
2013-02-04 14:34:35 +11:00
Alex Brainman
bc9999337b net: prevent races during windows lookup calls
This only affects code (with exception of lookupProtocol)
that is only executed on older versions of Windows.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7293043
2013-02-04 13:05:20 +11:00
Robin Eklind
97916f1154 archive/tar: Add reader and writer code example.
Remove the previous comment examples.

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7220048
2013-02-04 12:37:18 +11:00
Russ Cox
f02067a99a cmd/gc: implement latest rules for checking make sizes
Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047
2013-02-03 14:28:44 -05:00
Shivakumar GN
848d10f06c xml: omit newline at beginning of MarshalIndent output
(Still valid XML.)

Fixes #3354.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7288047
2013-02-03 11:21:07 -05:00
Russ Cox
e87cc3dc5b exp/gotype: disable broken test
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7275045
2013-02-03 01:25:58 -05:00
Russ Cox
2eafbb8878 cmd/gc: elide self-assignment during return
More efficient, less racy code.

Fixes #4014.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7275047
2013-02-03 01:18:28 -05:00
Kyle Lemons
9bfd3c3937 testing: add AllocsPerRun
This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.

Fixes #4461.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7002055
2013-02-02 22:52:29 -05:00
Russ Cox
18178fd138 cmd/go: run examples in source order, not name order
Add Order field to doc.Example and write doc comments there.

Fixes #4662.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7229071
2013-02-02 16:26:12 -05:00
Ian Lance Taylor
e5ea2d5335 runtime: fix windows build
Fixes #4743.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7284044
2013-02-02 11:41:04 -08:00
Shenghou Ma
dcf16bd83d syscall: (*Proc).Call should return nil error when no error occurs
Fixes #4686.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7174047
2013-02-03 01:42:17 +08:00
Russ Cox
b396d1143b reflect: explain StructField.Anonymous field as 'embedded'
The spec mostly uses the term embedded.
It's too late to change the field name but at least fix the docs.

Fixes #4514.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7235080
2013-02-01 21:01:46 -05:00
Russ Cox
2cb8dcea5c testing: SkipNow, FailNow must be called from test goroutine
Impossible for us to check (without sleazily reaching into the
runtime) but at least document it.

Fixes #3800.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7268043
2013-02-01 21:01:32 -05:00
Alex Brainman
6d175e243a net: use windows GetAddrInfoW in LookupPort when possible
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7252045
2013-01-18 17:05:04 +11:00
Elias Naur
44cf814d50 runtime, cmd/ld: make code more position-independent
Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7248048
2013-02-01 11:24:49 -08:00
Robert Daniel Kortschak
11d16dc535 reflect: document that Value.Slice panics on an unaddressable array.
Fixes #4736.

R=rsc
CC=golang-dev
https://golang.org/cl/7239045
2013-02-01 10:02:23 -08:00
Brad Fitzpatrick
2ccd4e9f87 sort: delete now-duplicate example, fix build
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7220075
2013-02-01 09:08:25 -08:00
Miek Gieben
d4cfe28885 sort: add Reverse as a function
This updates: https://golang.org/cl/6909059/
Fixes #4511.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6932054
2013-02-01 08:44:45 -08:00
Brad Fitzpatrick
e515d80d5d bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
2013-02-01 08:41:25 -08:00
Russ Cox
b0a29f393b runtime: cgo-related fixes
* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.

Fixes #3774.
Fixes #3775.
Fixes #3797.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7228081
2013-02-01 08:34:41 -08:00
Volker Dobler
7d8cc587b2 exp/cookiejar: remove external storage
This CL removes the external storage of a cookie jar
and minimized the exported API as discussed in [1].

[1] https://groups.google.com/d/topic/golang-dev/ygDB3nbir00/discussion

Update #1960.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7235065
2013-02-01 10:56:08 +11:00
Russ Cox
31fafa5081 encoding/base64: fix test for ReadFull change
R=golang-dev
CC=golang-dev
https://golang.org/cl/7249045
2013-01-31 14:42:56 -08:00
Russ Cox
662ff54212 io: guarantee err == nil for full reads in ReadFull and ReadAtLeast
This is a backwards compatible API change that fixes broken code.

In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
Most code expects only the former, so do that and document the guarantee.

Code that was correct before is still correct.
Code that was incorrect before, by assuming the guarantee, is now correct too.

The same applies to ReadAtLeast.

Fixes #4544.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7235074
2013-01-31 13:46:12 -08:00
Russ Cox
4085426f7d net/url: normalize scheme to lower case (http not HTTP)
Also document %2f vs / ambiguity in URL.Path.

Fixes #3913.
Fixes #3659.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7225076
2013-01-31 13:45:43 -08:00
Adam Langley
5c659d7362 crypto/x509: test for negative RSA parameters.
Someone found software that generates negative numbers for the RSA
modulus in an X.509 certificate. Our error messages were very poor in
this case so this change improves that.

Update #4728
Return more helpful errors when RSA parameters are negative or zero.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7228072
2013-01-31 12:54:37 -05:00
Russ Cox
8b6534b78a cmd/go: many bug fixes
* Reject import paths of the form cmd/x/y.
* Reject 'go install' of command outside GOPATH
* Clearer error rejecting 'go install' of package outside GOPATH.
* Name temporary binary for first file in 'go run' list or for test.
* Provide a way to pass -ldflags arguments with spaces.
* Pass all Go files (even +build ignored ones) to go fix, go fmt, go vet.
* Reject 'go run foo_test.go'.
* Silence 'exit 1' prints from 'go tool' invocations.
* Make go test -xxxprofile leave binary behind for analysis.
* Reject ~ in GOPATH except on Windows.
* Get a little less confused by symlinks.
* Document that go test x y z runs three test binaries.
* Fix go test -timeout=0.
* Add -tags flag to 'go list'.
* Use pkg/gccgo_$GOOS_$GOARCH for gccgo output.

Fixes #3389.
Fixes #3500.
Fixes #3503.
Fixes #3760.
Fixes #3941.
Fixes #4007.
Fixes #4032.
Fixes #4074.
Fixes #4127.
Fixes #4140.
Fixes #4311.
Fixes #4568.
Fixes #4576.
Fixes #4702.

R=adg
CC=golang-dev
https://golang.org/cl/7225074
2013-01-31 08:06:38 -08:00
Russ Cox
30985c1203 os: use signal strings where possible in ProcessState.String
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228067
2013-01-31 07:53:18 -08:00
Russ Cox
956cd0059c encoding/json: document case-insensitive Unmarshal key matching
Fixes #4664.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7237060
2013-01-31 07:49:23 -08:00
Caleb Spare
0e74f04acc container/heap: split example into two
This adds a simple IntHeap example, and modifies the more complex
PriorityQueue example to make use of the index field it maintains.

Fixes #4331.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/7068048
2013-01-30 23:14:29 -08:00
Alex Brainman
bd75468a08 os: provide access to file LastAccessTime and CreationTime on windows
Fixes #4569.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6972047
2013-01-31 17:17:37 +11:00
Nigel Tao
6799b773eb exp/cookiejar: update PublicSuffixList doc comment to match the
examples at http://publicsuffix.org/.

That website previously listed pvt.k12.wy.us, but that was an error,
as confirmed by correspondance with submissions@publicsuffix.org, and
the website was fixed on 2013-01-23.

R=adg
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7241053
2013-01-31 14:12:43 +11:00
Robert Daniel Kortschak
92bc896909 fmt: improve go syntax handling of byte-derived arrays and slices
Fixes #4685.

R=golang-dev, adg, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7205047
2013-01-30 17:53:53 -08:00
Rick Arnold
eea0f19990 encoding/json: improve performance of Unmarshal on primitive types
Attempt 2. The first fix was much faster but ignored syntax errors.

benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder            74993543     72982390   -2.68%
BenchmarkCodeMarshal            77811181     75610637   -2.83%
BenchmarkCodeDecoder           213337123    190144982  -10.87%
BenchmarkCodeUnmarshal         212180972    190394852  -10.27%
BenchmarkCodeUnmarshalReuse    202113428    182106660   -9.90%
BenchmarkUnmarshalString            1343          919  -31.57%
BenchmarkUnmarshalFloat64           1149          908  -20.97%
BenchmarkUnmarshalInt64              967          778  -19.54%
BenchmarkSkipValue              28851581     28414125   -1.52%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder               25.88        26.59    1.03x
BenchmarkCodeMarshal               24.94        25.66    1.03x
BenchmarkCodeDecoder                9.10        10.21    1.12x
BenchmarkCodeUnmarshal              9.15        10.19    1.11x
BenchmarkSkipValue                 69.05        70.11    1.02x

Fixes #3949.

R=rsc
CC=golang-dev
https://golang.org/cl/7231058
2013-01-30 17:53:48 -08:00
Alan Donovan
19bb42d637 math/big: make tests faster by reducing coverage in --test.short mode.
The time to test all of math/big is now:
 default      => ~3min
 --test.short => 150ms

R=rsc
CC=golang-dev
https://golang.org/cl/7223054
2013-01-30 18:19:58 -05:00
Brad Fitzpatrick
1aa56a2396 net/http: fix race
Fixes #4724

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7225071
2013-01-30 15:10:07 -08:00
Russ Cox
fa2acad603 crypto/cipher: avoid out of bounds error in CryptBlocks
Fixes #4699.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7231065
2013-01-30 12:45:13 -08:00
Marcel van Lohuizen
f5154edc53 exp/locale/collate/tools/colcmp: fixes some discrepancies between
ICU and collate package: ICU requires strings to be in FCD form.
Not all NFC strings are in this form, leading to incorrect results.
Change to NFD instead.

R=rsc
CC=golang-dev
https://golang.org/cl/7201043
2013-01-30 21:19:03 +01:00
Jeff R. Allen
6563d8623d syscall: handle empty address in ReadFrom better
Handle return values from recvfrom correctly when the
kernel decides to not return an address.

Fixes #4636.
Fixes #4352.

R=rsc, mikioh.mikioh, dave
CC=golang-dev
https://golang.org/cl/7058062
2013-01-30 10:02:01 -08:00
Akshat Kumar
fb451490ec os: don't hold ForkLock across opens on Plan 9
If os.OpenFile holds ForkLock on files that block opens,
then threads that simultaneously try to do fork-exec will
get hung up (until the open succeeds). Blocked opens are
common enough on Plan 9 that protecting against fd leaks
into fork-execs means not being able to do fork-execs
properly in the general case. Thus, we forgo taking the
lock.

R=rsc, ality
CC=golang-dev
https://golang.org/cl/7235066
2013-01-30 09:41:16 -08:00
Michael Teichgräber
ad341843a7 net: SplitHostPort: adjust error message for missing port in IPv6 addresses
An hostport of "[::1]" now results in the same error message
"missing port in address" as the hostport value "127.0.0.1",
so SplitHostPort won't complain about "too many colons
in address" anymore for an IPv6 address missing a port.

Added tests checking the error values.

Fixes #4526.

R=dave, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7038045
2013-01-30 09:25:16 -08:00
Andrey Mirtchovski
e579395905 encoding/json: properly unmarshal empty arrays.
The JSON unmarshaller failed to allocate an array when there
are no values for the input causing the `[]` unmarshalled
to []interface{} to generate []interface{}(nil) rather than
[]interface{}{}. This wasn't caught in the tests because Decode()
works correctly and because jsonBig never generated zero-sized
arrays. The modification to scanner_test.go quickly triggers
the error:

without the change to decoder.go, but with the change to scanner_test.go:

$ go test
--- FAIL: TestUnmarshalMarshal (0.10 seconds)
decode_test.go:446:		Marshal jsonBig
scanner_test.go:206:	diverge at 70: «03c1OL6$":null},{"[=» vs «03c1OL6$":[]},{"[=^\»
FAIL
exit status 1
FAIL	encoding/json	0.266s

Also added a simple regression to decode_test.go.

R=adg, dave, rsc
CC=golang-dev
https://golang.org/cl/7196050
2013-01-30 09:10:32 -08:00
Jan Ziak
4da6b36fbf runtime: local allocation in mprof.goc
Binary data in mprof.goc may prevent the garbage collector from freeing
memory blocks. This patch replaces all calls to runtime·mallocgc() with
calls to an allocator private to mprof.goc, thus making the private
memory invisible to the garbage collector. The addrhash variable is
moved outside of the .bss section.

R=golang-dev, dvyukov, rsc, minux.ma
CC=dave, golang-dev, remyoudompheng
https://golang.org/cl/7135063
2013-01-30 09:01:31 -08:00
Adam Langley
475d86b6d9 crypto/rc4: add simple amd64 asm implementation.
(Although it's still half the speed of OpenSSL.)

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         1409          398  -71.75%
BenchmarkRC4_1K         10920         2898  -73.46%
BenchmarkRC4_8K        131323        23083  -82.42%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        90.83       321.43    3.54x
BenchmarkRC4_1K         93.77       353.28    3.77x
BenchmarkRC4_8K         61.65       350.73    5.69x

R=rsc, remyoudompheng
CC=golang-dev, jgrahamc
https://golang.org/cl/7234055
2013-01-30 11:01:19 -05:00
Russ Cox
ee90874826 encoding/xml: add (*Encoder).Indent
Exposing this on the Encoder allows streaming generation of indented XML.

R=golang-dev, rogpeppe
CC=golang-dev
https://golang.org/cl/7221075
2013-01-30 07:57:20 -08:00
Akshat Kumar
c74f3c4576 runtime: add support for panic/recover in Plan 9 note handler
This change also resolves some issues with note handling: we now make
sure that there is enough room at the bottom of every goroutine to
execute the note handler, and the `exitstatus' is no longer a global
entity, which resolves some race conditions.

R=rminnich, npe, rsc, ality
CC=golang-dev
https://golang.org/cl/6569068
2013-01-30 02:53:56 -08:00
Rémy Oudompheng
ccc61eadd5 runtime: implement range access functions in race detector.
Range access functions are already available in TSan library
but were not yet used.

Time for go test -race -short:

Before:
compress/flate 24.244s
exp/norm       >200s
go/printer     78.268s

After:
compress/flate 17.760s
exp/norm        5.537s
go/printer      5.738s

Fixes #4250.

R=dvyukov, golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7229044
2013-01-30 01:55:02 +01:00
Andrew Gerrand
3bf3ba2d81 go/build: clean up after rollback
R=rsc
CC=golang-dev
https://golang.org/cl/7237049
2013-01-30 09:10:58 +11:00
Russ Cox
ad37081b67 encoding/json: add test for Unmarshal of malformed data
Roll back CL making primitive type unmarshal faster,
because it broke the Unmarshal of malformed data.

Add benchmarks for unmarshal of primitive types.

Update #3949.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7228061
2013-01-29 13:34:18 -08:00
Russ Cox
ec1948a44d runtime: clear up lr comments
R=cshapiro
CC=golang-dev
https://golang.org/cl/7230052
2013-01-29 13:12:50 -08:00
Alan Donovan
aa0b573ad6 exp/ssa: make Parameters values, not addresses.
We explicitly spill all parameters to the frame during initial
SSA construction.  (Later passes will remove spills.)
We now properly handle local Allocs escaping via Captures.

Also: allocate BasicBlock.Succs inline.

R=iant, iant
CC=golang-dev
https://golang.org/cl/7231050
2013-01-29 10:49:16 -05:00
Dmitriy Vyukov
81221f512d runtime: dump the full stack of a throwing goroutine
Useful for debugging of runtime bugs.
+ Do not print "stack segment boundary" unless GOTRACEBACK>1.
+ Do not traceback system goroutines unless GOTRACEBACK>1.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7098050
2013-01-29 14:57:11 +04:00
Brad Fitzpatrick
91e99c1345 encoding/json: add Decoder.Buffered accessor to get overread data
Otherwise it's impossible to know how much data from the
json.Decoder's underlying Reader was actually consumed.

The old fix from golang.org/issue/1955 just added docs. This
provides an actual mechanism.

Update #1955

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7181053
2013-01-28 16:31:46 -08:00
Alan Donovan
55cac53952 exp/ssa: fix breakage due to https://code.google.com/p/go/source/detail?r=ca5e5de48173
I don't understand why this didn't show up during my testing.

R=bradfitz
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/7237047
2013-01-28 19:21:25 -05:00
Alan Donovan
3c51a69937 exp/gotype: fix build breakage due to https://code.google.com/p/go/source/detail?r=ca5e5de48173
Add 'math/big' to blacklist of packages that use shift
operations as yet unsupported by go/types.

(The failure was masked due to local bugfixes in my client.)

R=rsc, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/7220057
2013-01-28 18:26:26 -05:00
Alan Donovan
8f90915692 exp/ssa: (#3 of 5): Function, BasicBlock and optimisations
R=gri, iant, iant
CC=golang-dev
https://golang.org/cl/7202051
2013-01-28 18:14:09 -05:00
Alan Donovan
66bf59712e exp/ssa: (#2 of 5): core utilities
This CL includes the implementation of Literal, all the
Value.String and Instruction.String methods, the sanity
checker, and other misc utilities.

R=gri, iant, iant
CC=golang-dev
https://golang.org/cl/7199052
2013-01-28 18:06:14 -05:00
Alan Donovan
961195ae69 math/big: add Rat.{,Set}Float64 methods for IEEE 754 conversions.
Added tests, using input data from strconv.ParseFloat.
Thanks to rsc for most of the test code.

math/big could use some good package-level documentation.

R=remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/6930059
2013-01-28 18:00:15 -05:00
Vega Garcia Luis Alfonso
cf1f542420 xml: differentiate between float32 and float64 for marshalSimple
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7235045
2013-01-28 12:54:27 -05:00
Sébastien Paolacci
09ea3b518e runtime: earlier detection of unused spans.
Mark candidate spans one GC pass earlier.

Move scavenger's code out from mgc0 and constrain it into mheap (where it belongs).

R=rsc, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/7002049
2013-01-28 12:53:35 -05:00
Russ Cox
a8e0a75726 go/build: undo CL 7129048
This broke 'godoc net/http'.

TBR=adg
CC=golang-dev
https://golang.org/cl/7235052
2013-01-28 12:49:26 -05:00
Ian Lance Taylor
2cd5b01454 net: fix windows build
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7229050
2013-01-28 09:37:10 -08:00
Ian Lance Taylor
31f58dce67 net, syscall: use accept4 and SOCK_CLOEXEC on Linux
R=golang-dev, bradfitz, mikioh.mikioh, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7227043
2013-01-28 08:54:15 -08:00
Vega Garcia Luis Alfonso
1da07a783e go/ast: Fix typo for the godoc of ObjKind
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7232045
2013-01-27 21:36:47 -08:00
Ian Lance Taylor
e65c0a82ce runtime: use new CNT_MASK in lfstack
This is for SPARC64, a 64-bit processor that uses all 64-bits
of virtual addresses.  The idea is to use the low order 3 bits
to at least get a small ABA counter.  That should work since
pointers are aligned.  The idea is for SPARC64 to set CNT_MASK
== 7, PTR_BITS == 0, PTR_MASK == 0xffffffffffffff8.

Also add uintptr casts to avoid GCC warnings.  The gccgo
runtime code is compiled with GCC, and GCC warns when casting
between a pointer and a type of a different size.

R=dvyukov
CC=golang-dev
https://golang.org/cl/7225043
2013-01-26 18:16:43 -08:00
Rémy Oudompheng
75104237c8 all: make tests able to run multiple times.
It is now possible to run "go test -cpu=1,2,4 std"
successfully.

Fixes #3185.

R=golang-dev, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7196052
2013-01-27 00:24:09 +01:00
Shenghou Ma
4019d0e424 runtime: avoid defining the same variable in more than one translation unit
For gccgo runtime and Darwin where -fno-common is the default.

R=iant, dave
CC=golang-dev
https://golang.org/cl/7094061
2013-01-26 09:57:06 +08:00
John Graham-Cumming
3c77b8961c net/http: fix Content-Length/Transfer-Encoding on HEAD requests
net/http currently assumes that the response to a HEAD request
    will always have a Content-Length header. This is incorrect.

RFC2616 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response. The
metainformation contained in the HTTP headers in response to a
HEAD request SHOULD be identical to the information sent in
response to a GET request. This method can be used for
obtaining metainformation about the entity implied by the
request without transferring the entity-body itself. This
method is often used for testing hypertext links for validity,
accessibility, and recent modification."

This means that three cases are possible: a Content-Length
header, a Transfer-Encoding header or neither. In the wild the
following sites exhibit these behaviours (curl -I):

HEAD on http://www.google.co.uk/ has Transfer-Encoding: chunked
HEAD on http://www.bbc.co.uk/    has Content-Length: 45247
HEAD on http://edition.cnn.com/  has neither header

This patch does not remove the ErrMissingContentLength error
for compatibility reasons, but it is no longer used.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7182045
2013-01-25 10:20:19 -08:00
Alan Donovan
09899d3b35 exp/ssa: API and documentation.
R=gri, iant, crawshaw, bradfitz, gri, iant
CC=golang-dev
https://golang.org/cl/7071058
2013-01-24 17:21:48 -05:00
Alan Donovan
0cbf289b36 go/types: expose types.IsIdentical, the Type equivalence relation.
This function is absolutely critical for clients such as
exp/ssa, and too complex for clients to duplicate.

As with CL 7200046, gri expressed in the doc below [gophers
only] before going on leave that he intended to expose such a
predicate, though his wording suggests as an interface method
of Type rather than a standalone function.  (My preference is
for binary methods to be standalone; see "On Binary Methods",
Kim Bruce, 1995).  In any case if he wishes to move it that's
easily accommodated by clients.

https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#heading=h.k3bwja7xony9

R=iant, gri, iant
CC=golang-dev
https://golang.org/cl/7203051
2013-01-24 14:22:17 -05:00
Alan Donovan
f8fb95f288 go/types: add String() method to Type interface.
All implementations delegate to typeString.

Though I don't wish to exploit gri's absence to change
his code, this change is pretty low-risk and he assented to it
in the blue ink in the doc below [gophers only].
https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#

R=iant, gri, gri
CC=golang-dev
https://golang.org/cl/7200046
2013-01-24 14:21:51 -05:00
Dmitriy Vyukov
3c25cd2784 runtime: increase stack limit in a test
Otherwise the test is flaky.
Fixes #4698.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7133071
2013-01-24 20:26:08 +04:00
Dave Cheney
6a9e956f19 all: use t.Skip{,f}
Replace various t.Log{,f} ; return checks with t.Skip{,f}.

R=golang-dev, n13m3y3r, bradfitz, adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7193044
2013-01-24 17:32:10 +11:00
Rick Arnold
2e51f78280 go/build: document blank line required after build constraints
Fixes #3539.

R=golang-dev, dave, adg
CC=golang-dev
https://golang.org/cl/7206049
2013-01-24 13:32:46 +11:00
Robert Griesemer
2e15f4b8c4 go/types: typechecking conversions, part 1 (non-constants)
R=adonovan
CC=golang-dev
https://golang.org/cl/7103058
2013-01-23 10:57:18 -08:00
Mikkel Krautz
249af5c85e crypto/x509: skip SystemRootsError test on Windows
On Windows, crypto/x509 passes through to Windows's CryptoAPI
to verify certificate chains. This method can't produce a
SystemRootsError, so make sure we always skip the test on
Windows.

This is needed because testVerify is called in both
TestGoVerify and TestSystemVerify on Windows - one is for
testing the Go verifier, the other one is for testing the
CryptoAPI verifier. The orignal CL tried to sidestep
this issue by setting systemSkip to true, but that only
affected TestSystemVerify.

R=golang-dev, agl, snaury, minux.ma
CC=golang-dev
https://golang.org/cl/7185043
2013-01-24 01:20:17 +08:00
Marcel van Lohuizen
34b533cd81 exp/locale/collate: added functionality for sorting.
Eliminates the need for the user to fiddle with keys.

R=rsc
CC=golang-dev
https://golang.org/cl/7060051
2013-01-23 14:16:22 +01:00
Marcel van Lohuizen
f86ae990e8 exp/locale/collate: preparation for adding Search API. Also changed the collate API
further to how (I believe) it will end up being.
It is nicer to separate search from sorting functionality. Collation needs tables that
are not needed by search and vice-versa.  The common functionality is separated out
in the Weigher interface.  As this interface is very low-level, it will be moved to
a sub package (colltab) in a next CL.
The types that will move to this package are Weigher, Elem, and Level.  The addition
of Elem allows for removing some of the duplicate code between collate and collate/build.
This CL also introduces some stubs for a higher-level API for options. The default
proposed options are quite complex and require the user to have a decent understanding
of Unicode collation.  The new options hide a lot of the complexity.

R=rsc
CC=golang-dev
https://golang.org/cl/7058051
2013-01-23 14:15:51 +01:00
Akshat Kumar
7f0d1652a4 syscall: fix fork-exec/wait inconsistencies for Plan 9
Fixes the fork-exec/wait race condition for ForkExec
as well, by making it use startProcess. This makes the
comment for StartProcess consistent as well.

Further, the passing of Waitmsg data in startProcess
and WaitProcess is protected against possible forks
from outside of ForkExec and StartProcess, which might
cause interference with the Await call.

R=rsc, rminnich, npe, ality
CC=golang-dev
https://golang.org/cl/7128059
2013-01-22 22:42:44 -05:00
Vega Garcia Luis Alfonso
14bd52db3f xml: Support fields not of type []byte when marshaling ",chardata"
Fixes #4506.

R=rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/7106045
2013-01-22 22:13:40 -05:00
Brad Fitzpatrick
379f5fc7f1 go/build: fix TestBogusDirectory format and maybe Windows failure
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7183046
2013-01-22 17:50:12 -08:00
Brad Fitzpatrick
86a8d59a01 time: make TestReset more reliable
Fixes #4690

R=golang-dev, alex.brainman, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7181052
2013-01-22 17:25:58 -08:00
Andrew Gerrand
da82dfaccd net/url: use bytes.Buffer in (*URL).String
BenchmarkString before:

        11990 ns/op            1621 B/op         73 allocs/op

Using bytes.Buffer:

        8774 ns/op            1994 B/op         40 allocs/op

I also tried making a version of escape() that writes directly to the
bytes.Buffer, but it only saved 1 alloc/op and increased CPU time by
about 10%. Didn't seem worth the extra code path.

R=bradfitz
CC=golang-dev
https://golang.org/cl/7182050
2013-01-23 12:17:11 +11:00
Andrew Gerrand
cdd6ae1288 net/url: generate correct Path when hostname empty
Parse("file:///foo") previously returned a URL with Scheme "file"
and Path "///foo". Now it returns a URL with Path "/foo",
such that
        &URL{Scheme: "file", Path: "/foo"}.String() == "file:///foo"

This means that parsing and stringifying the URL "file:/foo"
returns "file:///foo", technically a regression but one that only
affects a corner case.

Fixes #4189.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7135051
2013-01-23 11:37:06 +11:00
Andrew Gerrand
9413a6f660 go/build: ImportDir reject directories that don't exist
Fixes #3428.

R=dave, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7129048
2013-01-23 11:28:32 +11:00
Dave Cheney
f7ea900a7b testing: add Skip/Skipf
This proposal adds two methods to *testing.T, Skip(string) and Skipf(format, args...). The intent is to replace the existing log and return idiom which currently has 97 cases in the standard library. A simple example of Skip would be:

func TestSomethingLong(t *testing.T) {
        if testing.Short() {
                t.Skip("skipping test in short mode.")
                // not reached
        }
        ... time consuming work
}

Additionally tests can be skipped anywhere a *testing.T is present. An example adapted from the go.crypto/ssh/test package would be:

// setup performs some before test action and returns a func()
// which should be defered by the caller for cleanup.
func setup(t *testing.T) func() {
        ...
        cmd := exec.Command("sshd", "-f", configfile, "-i")
        if err := cmd.Run(); err != nil {
                t.Skipf("could not execute mock ssh server: %v", err)
        }
        ...
        return func() {
                // stop subprocess and cleanup
        }
}

func TestDialMockServer(t *testing.T) {
        cleanup := setup(t)
        defer cleanup()
        ...
}

In verbose mode tests that are skipped are now reported as a SKIP, rather than PASS.

Link to discussion: https://groups.google.com/d/topic/golang-nuts/BqorNARzt4U/discussion

R=adg, rsc, r, n13m3y3r
CC=golang-dev, minux.ma
https://golang.org/cl/6501094
2013-01-23 10:22:33 +11:00
Rick Arnold
6e3f3af4e0 encoding/json: ignore unexported fields in Unmarshal
Go 1.0 behavior was to create an UnmarshalFieldError when a json value name matched an unexported field name. This error will no longer be created and the field will be skipped instead.

Fixes #4660.

R=adg, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7139049
2013-01-22 17:49:07 -05:00
Robin Eklind
3692dfdd0a fmt: Remove dead code and make comments and variables consistent.
R=minux.ma, dave, rsc
CC=golang-dev
https://golang.org/cl/7064055
2013-01-22 17:12:45 -05:00
Mikio Hara
12e7397ebb net: don't return nil interface address on netbsd
On NetBSD routing sockaddrs for interface address contain sockaddr_dl.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/7085064
2013-01-23 07:11:22 +09:00
Russ Cox
9114279c66 encoding/xml: simplify copyValue
Delete various complications left over from an earlier reflect API.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7124063
2013-01-22 17:05:45 -05:00
Robin Eklind
a1231839b5 mime, strconv: Make testdata more consistent.
All packages place testdata in a specific directory with the name
"testdata". The mime and strconv packages have been updated to use
the same convention.

mime: Move "mime/test.types" to "mime/testdata/test.types". Update test
code accordingly.

strconv: Move "strconv/testfp.txt" to "strconv/testdata/testfp.txt".
Update test code accordingly.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7098072
2013-01-22 13:44:35 -08:00
Caleb Spare
657168fb17 time: standard time doc fix and format example
This fixes the incorrect unix timestamp of the standard time and adds
an example for (Time) Format to clarify how timezones work in format strings.

Fixes #4364.

R=golang-dev, remyoudompheng, kevlar, rsc
CC=golang-dev
https://golang.org/cl/7069046
2013-01-22 14:44:49 -05:00
Akshat Kumar
85f86399f4 syscall: fix arithmetic errors in assembly for seek function for 64-bit Plan 9
Offsets for return values from seek were miscalculated
and a translation from 32-bit code for error handling
was incorrect.

R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/7181045
2013-01-22 14:03:30 -05:00
Adam Langley
793cbd5b81 crypto/tls: allow the server to enforce its ciphersuite preferences.
Previously, Go TLS servers always took the client's preferences into
account when selecting a ciphersuite. This change adds the option of
using the server's preferences, which can be expressed by setting
tls.Config.CipherSuites.

This mirrors Apache's SSLHonorCipherOrder directive.

R=golang-dev, nightlyone, bradfitz, ality
CC=golang-dev
https://golang.org/cl/7163043
2013-01-22 10:10:38 -05:00
Dmitriy Vyukov
fd32ac4bae runtime: account stop-the-world time in the "other" GOGCTRACE section
Currently it's summed to mark phase.
The change makes it easier to diagnose long stop-the-world phases.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7182043
2013-01-22 13:44:49 +04:00
Shenghou Ma
bee148bf23 text/template/parse: don't show itemType in error messages
so that the user don't need to decipher something like this:
template: main:1: expected %!s(parse.itemType=14) in end; got "|"
now they get this:
template: main:1: unexpected "|" in end

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7128054
2013-01-22 02:48:40 +08:00
Adam Langley
5b5d3efcf3 crypto/x509: return a better error when we fail to load system roots.
R=golang-dev, krautz, rsc
CC=golang-dev
https://golang.org/cl/7157044
2013-01-21 11:25:28 -05:00
Adam Langley
0fb6f5f21b crypto/cipher: don't persist errors in StreamWriter.
I messed this up from the beginning. The receiver isn't a pointer so
setting Err is useless. In order to maintain the API, just remove the
superfluous code.

Fixes #4657.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7161043
2013-01-21 11:22:08 -05:00
Mikio Hara
3454b6bf82 undo CL 5687057 / 58bc8aae4abb
Fortunately we have never seen the panic on sockaddrToTCP
in the past year.

««« original CL description
net: panic if sockaddrToTCP returns nil incorrectly
Part of diagnosing the selfConnect bug
TBR=dsymonds

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

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7137063
2013-01-19 23:13:01 +09:00
Russ Cox
92b2643c92 math/big: fix typo
Fixes #4678.

TBR=gri
CC=golang-dev
https://golang.org/cl/7135059
2013-01-18 17:30:34 -05:00
Kamil Kisiel
4730a226ca encoding/xml: fix decoding of attributes in to pointer fields.
Fixes #3719.

R=anacrolix, rsc
CC=golang-dev
https://golang.org/cl/7131052
2013-01-18 17:07:34 -05:00
Jan Ziak
059fed3dfb runtime: try to determine the actual type during garbage collection
If the scanned block has no typeinfo the garbage collector will attempt
to get the actual type of the block.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7093045
2013-01-18 16:56:17 -05:00
Akshat Kumar
b62847000b syscall, os: fix a fork-exec/wait race in Plan 9.
On Plan 9, only the parent of a given process can enter its wait
queue. When a Go program tries to fork-exec a child process
and subsequently waits for it to finish, the goroutines doing
these two tasks do not necessarily tie themselves to the same
(or any single) OS thread. In the case that the fork and the wait
system calls happen on different OS threads (say, due to a
goroutine being rescheduled somewhere along the way), the
wait() will either return an error or end up waiting for a
completely different child than was intended.

This change forces the fork and wait syscalls to happen in the
same goroutine and ties that goroutine to its OS thread until
the child exits. The PID of the child is recorded upon fork and
exit, and de-queued once the child's wait message has been read.
The Wait API, then, is translated into a synthetic implementation
that simply waits for the requested PID to show up in the queue
and then reads the associated stats.

R=rsc, rminnich, npe, mirtchovski, ality
CC=golang-dev
https://golang.org/cl/6545051
2013-01-18 16:43:25 -05:00
Sébastien Paolacci
d8626ef128 runtime: faster mcentral alloc.
Reduce individual object handling by anticipating how much of them are servable.

Not a chunked transfer cache, but decent enough to make sure the bottleneck is not here.

Mac OSX, median of 10 runs:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5358937333   4892813012   -8.70%
BenchmarkFannkuch11      3257752475   3315436116   +1.77%
BenchmarkGobDecode         23277349     23001114   -1.19%
BenchmarkGobEncode         14367327     14262925   -0.73%
BenchmarkGzip             441045541    440451719   -0.13%
BenchmarkGunzip           139117663    139622494   +0.36%
BenchmarkJSONEncode        45715854     45687802   -0.06%
BenchmarkJSONDecode       103949570    106530032   +2.48%
BenchmarkMandelbrot200      4542462      4548290   +0.13%
BenchmarkParse              7790558      7557540   -2.99%
BenchmarkRevcomp          831436684    832510381   +0.13%
BenchmarkTemplate         133789824    133007337   -0.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            32.82        33.33    1.02x
BenchmarkGobEncode            53.42        53.86    1.01x
BenchmarkGzip                 43.70        44.01    1.01x
BenchmarkGunzip              139.09       139.14    1.00x
BenchmarkJSONEncode           42.69        42.56    1.00x
BenchmarkJSONDecode           18.78        17.91    0.95x
BenchmarkParse                 7.37         7.67    1.04x
BenchmarkRevcomp             306.83       305.70    1.00x
BenchmarkTemplate             14.57        14.56    1.00x

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/7005055
2013-01-18 16:39:22 -05:00
Shenghou Ma
e985d5464b time: add note about Parse()'s choice of default year
R=rsc
CC=golang-dev
https://golang.org/cl/7101046
2013-01-19 04:57:31 +08:00
Raph Levien
ebf35167ee compress/flate: Performance improvement for inflate
Decode as much as possible of a Huffman symbol in a single table
lookup (much like the zlib implementation), filling more bits
(conservatively, so we don't consume past the end of the stream)
when the code prefix indicates more bits are needed. This
results in about a 50% performance gain in speed benchmarks.
The following set is benchcmp done on a retina MacBook Pro:

benchmark                            old MB/s     new MB/s  speedup
BenchmarkDecodeDigitsSpeed1e4           28.41        42.79    1.51x
BenchmarkDecodeDigitsSpeed1e5           30.18        47.62    1.58x
BenchmarkDecodeDigitsSpeed1e6           30.81        48.14    1.56x
BenchmarkDecodeDigitsDefault1e4         30.28        44.61    1.47x
BenchmarkDecodeDigitsDefault1e5         32.18        51.94    1.61x
BenchmarkDecodeDigitsDefault1e6         35.57        53.28    1.50x
BenchmarkDecodeDigitsCompress1e4        30.39        44.83    1.48x
BenchmarkDecodeDigitsCompress1e5        33.05        51.64    1.56x
BenchmarkDecodeDigitsCompress1e6        35.69        53.04    1.49x
BenchmarkDecodeTwainSpeed1e4            25.90        43.04    1.66x
BenchmarkDecodeTwainSpeed1e5            29.97        48.19    1.61x
BenchmarkDecodeTwainSpeed1e6            31.36        49.43    1.58x
BenchmarkDecodeTwainDefault1e4          28.79        45.02    1.56x
BenchmarkDecodeTwainDefault1e5          37.12        55.65    1.50x
BenchmarkDecodeTwainDefault1e6          39.28        58.16    1.48x
BenchmarkDecodeTwainCompress1e4         28.64        44.90    1.57x
BenchmarkDecodeTwainCompress1e5         37.40        55.98    1.50x
BenchmarkDecodeTwainCompress1e6         39.35        58.06    1.48x

R=rsc, dave, minux.ma, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/6872063
2013-01-18 15:09:42 -05:00
Alex Brainman
e0aa26a427 time: Sleep does better job then runtime.Gosched in TestAfterStress
for slow windows-386 builder

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7128053
2013-01-18 15:31:01 +11:00
Andrew Gerrand
e19cdc651c testing: allow examples to pass (fix build)
R=golang-dev
CC=golang-dev
https://golang.org/cl/7132050
2013-01-18 12:25:41 +11:00
Andrew Gerrand
c022943449 html/template: remove noescape support
This was never documented or properly implemented.

Fixes #3528.

R=mikesamuel, rsc
CC=golang-dev
https://golang.org/cl/7142048
2013-01-18 10:30:12 +11:00
Andrew Gerrand
5bd5ed2b57 testing: catch panicking example and report, just like tests
Fixes #4670.

R=rsc
CC=golang-dev
https://golang.org/cl/7148043
2013-01-18 10:28:18 +11:00
Shenghou Ma
d46d0f15a7 all: remove exec bit on files
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7128048
2013-01-18 02:41:17 +08:00
Shenghou Ma
40b3758864 os: use SameFile in TestStartProcess
Fixes #4650.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/7085048
2013-01-17 18:48:11 +08:00
Shenghou Ma
1e095b7622 testing: introduce (*B).ReportAllocs()
Calling it will show memory allocation statistics for that
single benchmark (if -test.benchmem is not provided)

R=golang-dev, rsc, kevlar, bradfitz
CC=golang-dev
https://golang.org/cl/7027046
2013-01-17 18:45:49 +08:00
Volker Dobler
44ff17e664 time: add Timer.Reset
Fixes #4412.

R=adg, rsc, rogpeppe, andrewdg, bradfitz
CC=golang-dev
https://golang.org/cl/7086050
2013-01-17 14:41:53 +11:00
Andrew Balholm
55740f763f exp/html: remove "INCOMPLETE" comment
I think that the parser is complete enough to take that warning out.
It passes the test suite.
There may be incompatible API changes, but being in the exp directory
is warning enough for that.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7131050
2013-01-17 12:06:04 +11:00
Robert Griesemer
5a4a197d7b go/types: correct result type for append (bug fix)
Rewrote existing code to prevent similar mistakes.

R=adonovan
CC=golang-dev
https://golang.org/cl/7129046
2013-01-16 15:08:19 -08:00
Matthew Dempsky
1a03580ef1 net/http: Serve creates service goroutines, not service threads
R=bradfitz
CC=golang-dev
https://golang.org/cl/7132045
2013-01-16 14:05:41 -08:00
Brad Fitzpatrick
3b73aaafdc net/http: fix racy test
We need to wait for the handler to actually finish running,
not almost be done running.

This was always a bug, but now that handler output is buffered
it shows up easily on GOMAXPROCS >1 systems.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7109043
2013-01-15 09:13:05 -08:00
Mikio Hara
6d725e97e3 net: simplify ListenMulticastUDP
R=rsc, iant, dave
CC=golang-dev
https://golang.org/cl/6999053
2013-01-15 08:53:12 +09:00
Mikio Hara
c241f696f8 syscall: simplify socket control messages
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7016044
2013-01-15 08:52:22 +09:00
Robert Griesemer
0822a62cb7 go/types: set type of lhs ident in type switch guards
(bug fix)

R=adonovan
CC=golang-dev
https://golang.org/cl/7098059
2013-01-14 15:25:42 -08:00
Robert Griesemer
5e5c0a9fbb go/types: various minor fixes
- always set the Pkg field in QualifiedIdents
- call Context.Ident for all identifiers in the AST that denote
  a types.Object (bug fix)
- added test that Context.Ident is called for all such identifiers

R=adonovan
CC=golang-dev
https://golang.org/cl/7101054
2013-01-14 15:19:32 -08:00
Brad Fitzpatrick
fd1abac71c time: fix race
Fixes #4622

R=golang-dev, dave, dvyukov
CC=golang-dev
https://golang.org/cl/7103046
2013-01-14 14:09:42 -08:00
Robert Griesemer
6c3736a527 go/types: mark completely imported packages as such
R=adonovan
CC=golang-dev
https://golang.org/cl/7103055
2013-01-14 11:01:27 -08:00
Robert Griesemer
7f18f81192 go/types: callback for *ast.Ident -> Object mapping
Also re-enabled resolver test.

R=adonovan
CC=golang-dev
https://golang.org/cl/7107043
2013-01-14 09:43:27 -08:00
Francesc Campoy
1590be9e6f html/template: Clarifying references to "text/template" in the documentation.
Fixes #4634.

R=adg, kevlar
CC=golang-dev
https://golang.org/cl/7066053
2013-01-14 12:11:22 +00:00
Mikio Hara
a0509d8510 syscall: simplify netlink sockets
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7039044
2013-01-14 19:29:03 +09:00
Rémy Oudompheng
406ca3c2f1 encoding/json: fix panics on type mismatches.
Fixes #4222.
Fixes #4628.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7100049
2013-01-14 08:44:16 +01:00
Alex Brainman
06af0ea3f3 encoding/gob: fix broken test (fix build)
R=golang-dev, kevlar
CC=adg, golang-dev
https://golang.org/cl/7093056
2013-01-14 17:03:19 +11:00
Kyle Lemons
bc1152a32e encoding/gob: handle encoding of different indirects of GobEncoder
Fixes #4647.

R=r, golang-dev
CC=golang-dev
https://golang.org/cl/7085051
2013-01-14 16:07:11 +11:00
Robert Griesemer
94878070af go/types: Moving from *ast.Objects to types.Objects (step 2).
Completely removed *ast.Objects from being exposed by the
types API. *ast.Objects are still required internally for
resolution, but now the door is open for an internal-only
rewrite of identifier resolution entirely at type-check
time. Once that is done, ASTs can be type-checked whether
they have been created via the go/parser or otherwise,
and type-checking does not require *ast.Object or scope
invariants to be maintained externally.

R=adonovan
CC=golang-dev
https://golang.org/cl/7096048
2013-01-13 10:33:08 -08:00
Rémy Oudompheng
c13866db7f cmd/5c: fix handling of side effects when assigning a struct literal.
Also undo revision a5b96b602690 used to workaround the bug.

Fixes #4643.

R=rsc, golang-dev, dave, minux.ma, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/7090043
2013-01-12 09:16:50 +01:00
Caleb Spare
b78f5f0e3a testing: document whitespace trimming of example expected/actual output.
Fixes #4642.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7090044
2013-01-12 11:18:15 +11:00
Kamil Kisiel
ad63c7e50b text/template: Document that range can be used on chan types.
Fixes #4640.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7082044
2013-01-12 11:06:13 +11:00
Ryan Slade
3073a02b19 testing: in example, empty output not distinguished from missing output
Fixes #4485.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7071050
2013-01-12 11:05:53 +11:00
Brad Fitzpatrick
05bf9a456a net/http/cgi: fix test case sensitivity on Windows
Fixes #4645

R=golang-dev, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7105047
2013-01-11 15:11:08 -08:00
Robert Griesemer
8b62f54eb7 go/types: export QualifiedName.IsSame and NamedType.AstObj
R=adonovan
CC=golang-dev
https://golang.org/cl/7103047
2013-01-11 14:55:49 -08:00
Brad Fitzpatrick
20130f141f database/sql: document args, add a couple examples
Fixes #3460

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/7096046
2013-01-11 14:46:49 -08:00
Robert Griesemer
5a9463bda7 go/types: Moving from *ast.Objects to types.Objects (step 1).
The existing type checker was relying on augmenting ast.Object
fields (empty interfaces) for its purposes. While this worked
for some time now, it has become increasingly brittle. Also,
the need for package information for Fields and Methods would
have required a new field in each ast.Object. Rather than making
them bigger and the code even more subtle, in this CL we are moving
away from ast.Objects.

The types packge now defines its own objects for different
language entities (Const, Var, TypeName, Func), and they
implement the types.Object interface. Imported packages
create a Package object which holds the exported entities
in a types.Scope of types.Objects.

For type-checking, the current package is still using ast.Objects
to make this transition manageable. In a next step, the type-
checker will also use types.Objects instead, which opens the door
door to resolving ASTs entirely by the type checker. As a result,
the AST and type checker become less entangled, and ASTs can be
manipulated "by hand" or programmatically w/o having to worry
about scope and object invariants that are very hard to maintain.

(As a consequence, a future parser can do less work, and a
future AST will not need to define objects and scopes anymore.
Also, object resolution which is now split across the parser,
the ast, (ast.NewPackage), and even the type checker (for composite
literal keys) can be done in a single place which will be simpler
and more efficient.)

Change details:
- Check now takes a []*ast.File instead of a map[string]*ast.File.
It's easier to handle (I deleted code at all use sites) and does
not suffer from undefined order (which is a pain for testing).
- ast.Object.Data is now a *types.Package rather then an *ast.Scope
if the object is a package (obj.Kind == ast.Pkg). Eventually this
will go away altogether.
- Instead of an ast.Importer, Check now uses a types.Importer
(which returns a *types.Package).
- types.NamedType has two object fields (Obj Object and obj *ast.Object);
eventually there will be only Obj. The *ast.Object is needed during
this transition since a NamedType may refer to either an imported
(using types.Object) or locally defined (using *ast.Object) type.
- ast.NewPackage is not used anymore - there's a local copy for
package-level resolution of imports.
- struct fields now take the package origin into account.
- The GcImporter is now returning a *types.Package. It cannot be
used with ast.NewPackage anymore. If that functionality is still
used, a copy of the old GcImporter should be made locally (note
that GcImporter was part of exp/types and it's API was not frozen).
- dot-imports are not handled for the time being (this will come back).

R=adonovan
CC=golang-dev
https://golang.org/cl/7058060
2013-01-11 13:53:38 -08:00
Gwenael Treguier
7f0449a108 database/sql: check NumInput on Stmt.Exec
Fixes #3678.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6460087
2013-01-11 13:28:33 -08:00
Brad Fitzpatrick
bef4cb475c net/http: buffer before chunking
This introduces a buffer between writing from a handler and
writing chunks.  Further, it delays writing the header until
the first full chunk is ready.  In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.

Fixes #2357

R=golang-dev, dave, minux.ma, rsc, adg, balasanjay
CC=golang-dev
https://golang.org/cl/6964043
2013-01-11 10:03:43 -08:00
Georg Reinke
98259b9211 os: use syscall.Pipe2 on Linux
Update #2656

R=golang-dev, iant, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7065063
2013-01-11 08:30:25 -08:00
Stéphane Travostino
53e342f648 bytes: fix UnreadByte failure after ReadBytes
Fixes #4583.

R=golang-dev, minux.ma, bradfitz, rsc, dave
CC=golang-dev
https://golang.org/cl/6976050
2013-01-11 17:02:21 +11:00
Rick Arnold
60abc6b577 encoding/json: improve performance of Unmarshal on primitive types
Skip most of the scanning and parsing logic for simple (non-object/array) JSON values.

benchmark                   old ns/op    new ns/op    delta
BenchmarkUnmarshalInt             948          436  -54.01%
BenchmarkUnmarshalUint            930          427  -54.09%
BenchmarkUnmarshalString         1407          715  -49.18%
BenchmarkUnmarshalFloat          1114          536  -51.89%
BenchmarkUnmarshalBool            759          266  -64.95%
BenchmarkUnmarshalStruct         8165         8181   +0.20%

No significant effects on the go1 benchmarks:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9647362752   9596196417   -0.53%
BenchmarkFannkuch11      5623613048   5518694872   -1.87%
BenchmarkGobDecode         32944041     33165434   +0.67%
BenchmarkGobEncode         21237482     21080554   -0.74%
BenchmarkGzip             750955920    749861980   -0.15%
BenchmarkGunzip           197369742    197886192   +0.26%
BenchmarkJSONEncode        79274091     78891137   -0.48%
BenchmarkJSONDecode       180257802    175280358   -2.76%
BenchmarkMandelbrot200      7396666      7388266   -0.11%
BenchmarkParse             11446460     11386550   -0.52%
BenchmarkRevcomp         1605152523   1599512029   -0.35%
BenchmarkTemplate         204538247    207765574   +1.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            23.30        23.14    0.99x
BenchmarkGobEncode            36.14        36.41    1.01x
BenchmarkGzip                 25.84        25.88    1.00x
BenchmarkGunzip               98.32        98.06    1.00x
BenchmarkJSONEncode           24.48        24.60    1.00x
BenchmarkJSONDecode           10.76        11.07    1.03x
BenchmarkParse                 5.06         5.09    1.01x
BenchmarkRevcomp             158.34       158.90    1.00x
BenchmarkTemplate              9.49         9.34    0.98x

Fixes #3949.

R=golang-dev, dave, bradfitz, timo
CC=golang-dev
https://golang.org/cl/7068043
2013-01-10 17:58:45 -08:00
Alex Brainman
810e439859 net: use windows ConnectEx to dial (when possible)
Update #2631.
Update #3097.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7061060
2013-01-11 12:42:09 +11:00
Georg Reinke
e32d1154ec syscall: implement Pipe2 on Linux and use it in ForkExec
Fixes #2656.

R=golang-dev, bradfitz, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7062057
2013-01-10 17:04:55 -08:00