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

5143 Commits

Author SHA1 Message Date
Anthony Martin
fb3b27329e os: fix Plan 9 build after more FileMode changes
This should go in after Brad's CL 5553064.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5555056
2012-01-20 20:01:29 -08:00
Robert Griesemer
35ba05ee28 bytes: simplified logic
Also: Avoid potential crash due to reslicing of nil buffer.

R=r
CC=golang-dev
https://golang.org/cl/5556075
2012-01-20 15:39:14 -08:00
Rob Pike
696bf79350 bytes.Buffer: turn buffer size overflows into errors
Fixes #2743.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5556072
2012-01-20 13:51:49 -08:00
Robert Griesemer
0796c1c3ec encoding/varint: deleted WriteXvarint
Fixes #2748.

R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5557072
2012-01-20 12:57:53 -08:00
Scott Lawrence
b0360e469c go/ast: respect ImportSpec.EndPos
Fixes #2566.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5541068
2012-01-20 13:34:19 -05:00
Russ Cox
88010973aa go/doc: avoid the name 'a.out' in the testdata
R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5561047
2012-01-20 13:34:11 -05:00
Dmitriy Vyukov
1ff1405cc7 runtime: add type algorithms for zero-sized types
BenchmarkChanSem old=127ns new=78.6ns

R=golang-dev, bradfitz, sameer, rsc
CC=golang-dev
https://golang.org/cl/5558049
2012-01-20 10:32:55 +04:00
Mikio Hara
5e59e8537c net: fix linux build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5558056
2012-01-19 18:56:17 -08:00
Alex Brainman
8d6958fc04 misc/cgo/test: make tests run on windows
- use proper Win64 gcc calling convention when
  calling initcgo on amd64
- increase g0 stack size to 64K on amd64 to make
  it the same as 386
- implement C.sleep
- do not use C.stat, since it is renamed to C._stat by mingw
- use fopen to implement TestErrno, since C.strtol
  always succeeds on windows
- skip TestSetEnv on windows, because os.Setenv
  sets windows process environment, while C.getenv
  inspects internal C runtime variable instead

R=golang-dev, vcc.163, rsc
CC=golang-dev
https://golang.org/cl/5500094
2012-01-20 12:59:44 +11:00
Brad Fitzpatrick
7fc4c07172 database/sql: move from exp/sql
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5536076
2012-01-19 16:04:26 -08:00
Gustavo Niemeyer
369454d7b2 html/template: fix docs after API changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5528109
2012-01-19 21:49:28 -02:00
Brad Fitzpatrick
6454a3eb15 os: use FileMode instead of uint32 in various functions
Fixes #2733

R=chickencha, ality, rsc
CC=golang-dev
https://golang.org/cl/5553064
2012-01-19 15:45:18 -08:00
Nigel Tao
ab2ea94c60 image: change the YCbCr image's pixel buffers to start at Rect.Min
instead of the origin.

This makes YCbCr match the other image types (e.g. RGBA, Gray) in
that an image's bounds is not restricted to the positive quadrant.

Also optimize the YCbCr draw code by hoisting some computation
outside of the loop.

benchmark              old ns/op    new ns/op    delta
draw.BenchmarkYCbCr      2544418      2373558   -6.72%

Like https://golang.org/cl/4681044/ I don't think a gofix is
feasible. People will have to make manual changes. On the other hand,
directly manipulating YCbCr images is relatively rare, compared to
RGBA images, and if other code just uses the jpeg and draw packages
instead of messing directly with a YCbCr's []byte representations,
then things should just continue to work.

R=r
CC=golang-dev
https://golang.org/cl/5558048
2012-01-20 10:44:22 +11:00
Mikio Hara
7f4936a1c5 net: fix windows build
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5532102
2012-01-20 08:33:37 +09:00
Mikio Hara
743c2d0f48 net: fix broken setDefaultSockopts
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5536068
2012-01-20 07:31:13 +09:00
Luit van Drongelen
8d66a416cb crypto/hmac: Deprecate hmac.NewMD5, hmac.NewSHA1 and hmac.NewSHA256
Remove NewMD5, NewSHA1 and NewSHA256 in favor of using New and
explicitly importing the used hash-function. This way when using, for
example, HMAC with RIPEMD there's no md5, sha1 and sha256 linked in
through the hmac package.

A gofix rule is included, and applied to the standard library (3 files
altered).

This change is the result of a discussion at
https://golang.org/cl/5550043/ to pull the discussion about
deprecating these functions out of that issue.

R=golang-dev, agl
CC=golang-dev, r, rsc
https://golang.org/cl/5556058
2012-01-19 17:28:38 -05:00
David Symonds
ee09a8cd9f gc: don't emit pkgpath for error type.
Fixes #2660.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557060
2012-01-20 09:26:17 +11:00
Brad Fitzpatrick
bb7eca177a net/http: log handler panic before closing HTTP connection
Fix originally from rogpeppe in 5414048 but was rolled
back due to test breakage.

This CL makes the test more robust to order of operations.

Fixes #2480 again.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5536072
2012-01-19 14:19:59 -08:00
Gustavo Niemeyer
01a0d39a7f os/exec: trivial allocation removal in LookPath
R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/5549043
2012-01-19 20:17:46 -02:00
Gustavo Niemeyer
ca3e6d1367 encoding/xml: marshal/unmarshal xml.Name in field
R=rsc
CC=golang-dev
https://golang.org/cl/5542052
2012-01-19 20:15:55 -02:00
Shenghou Ma
fec7aa952f doc: update out-of-date comments about runtime/cgo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532100
2012-01-19 17:13:33 -05:00
Robert Griesemer
7b07310a69 go/parser: expressions may have comments
Thanks to 0xE2.0x9A.0x9B for the patch suggestion.

Fixes #2739.

R=r
CC=golang-dev
https://golang.org/cl/5536071
2012-01-19 13:54:31 -08:00
Rob Pike
c837e612bd text/template/parse: use human error prints
The previous version of all the node.String methods printed the parse
tree and was useful for developing the parse tree code. Now that that's done,
we might as well print the nodes using the standard template syntax.
It's much easier to read and makes error reporting look more natural.

Helps issue 2644.

R=rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/5553066
2012-01-19 13:51:37 -08:00
Dave Cheney
c354f93b93 runtime: madvise and SysUnused for Darwin
SysUnused is a direct call to madvise MADV_FREE.

R=sebastien.paolacci, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5531073
2012-01-19 15:51:29 -05:00
Evan Shaw
5a1322a79f os: add ModeSticky
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5539063
2012-01-19 11:29:24 -08:00
Shenghou Ma
d888ab80a3 testing: do not recover example's panic
So as to give out stack trace for panic in examples.
        This behavior also matches the tests'.
        Fixes #2691.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5554061
2012-01-19 10:19:33 -08:00
Olivier Duperray
e5c1f3870b pkg: Add & fix Copyright of "hand generated" files
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554064
2012-01-19 10:14:56 -08:00
Brad Fitzpatrick
bc0139b4b3 exp/sql: rename NullableString to NullString and allow its use as a parameter
Prep for Issue 2699

R=rsc
CC=golang-dev
https://golang.org/cl/5536045
2012-01-19 09:27:45 -08:00
Robert Griesemer
9e5f62ac0c go/doc, godoc: don't shadow receiver
Fixes #2737.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5553062
2012-01-19 08:52:53 -08:00
Christoph Hack
2a6b4e120a net/http: the documentation should call NewRequest with the right signature.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5554063
2012-01-19 06:11:02 -08:00
Adam Langley
a99e35b625 crypto/x509: remove explicit uses of rsa.
(Sending to r because of the API change.)

Over time we might want to add support for other key types.

While I was in the code, I also made the use of RawSubject the same
between Subject and Issuer when creating certificates.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5554049
2012-01-19 08:49:52 -05:00
Adam Langley
247799ce8a crypto/elliptic: add constant-time P224.
(Sending to r because of the API change.)

This change alters the API for crypto/elliptic to permit different
implementations in the future. This will allow us to add faster,
constant-time implementations of the standard curves without any more
API changes.

As a demonstration, it also adds a constant-time implementation of
P224. Since it's only 32-bit, it's actually only about 40% the speed
of the generic code on a 64-bit system.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5528088
2012-01-19 08:39:03 -05:00
Dmitriy Vyukov
f2f0059307 math/rand: decrease test duration in short mode
TestNonStandardNormalValues runs 1.5s,
the change reduces it to 0.2s in short mode.
The problem is with slow machines, emulators and dynamic tools.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540065
2012-01-19 16:17:44 +04:00
Andrew Gerrand
3358a5068a godoc: add anchors to cmd documentation headings
Also, disable server-side generation of TOC for commands as they would
only ever show Overview. The JS does a better job (for now).

Fixes #2732.

R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/5558046
2012-01-19 18:59:06 +11:00
Nigel Tao
b4829c1de6 html: in foreign content, check for HTML integration points in breakout
elements.

Pass tests10.dat, test 33:
<!DOCTYPE html><svg><desc><svg><ul>a

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <svg svg>
|       <svg desc>
|         <svg svg>
|         <ul>
|           "a"

Also pass test 34:
<!DOCTYPE html><p><svg><desc><p>

R=andybalholm, dsymonds
CC=golang-dev
https://golang.org/cl/5536048
2012-01-19 17:41:10 +11:00
Mikio Hara
d4fe9c6a9d encoding/json: fix comments, tweak tests for tag names
R=bradfitz
CC=golang-dev
https://golang.org/cl/5558047
2012-01-19 15:33:29 +09:00
Russ Cox
21d3721eb8 regexp: add SubexpNames
Fixes #2440.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5559043
2012-01-19 01:24:01 -05:00
Mikio Hara
e3e93b0f43 syscall: fix plan9 build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5532097
2012-01-19 14:52:28 +09:00
Robert Griesemer
c109705c6f go/doc: collect imports
R=r
CC=golang-dev
https://golang.org/cl/5556051
2012-01-18 19:35:53 -08:00
Mikio Hara
b58b5ba997 net: fix plan9 build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5554058
2012-01-19 12:25:37 +09:00
Mikio Hara
2356e43827 net: fix comments
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5557059
2012-01-19 12:23:30 +09:00
Brad Fitzpatrick
f44304ee63 net/http: update the Client docs a bit
R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/5557058
2012-01-18 19:05:53 -08:00
Brad Fitzpatrick
7d418aeed2 syscall: add Unix method to TimeSpec, TimeVal
Fixes #2534

R=golang-dev, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/5554057
2012-01-18 19:05:44 -08:00
Brad Fitzpatrick
b39c883e29 encoding/json: allow / and % in tag names
Fixes #2718

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5532095
2012-01-18 19:05:15 -08:00
Sanjay Menakuru
0d8c6b4fcd path: added examples
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5503089
2012-01-19 13:28:25 +11:00
Nigel Tao
af08cfa494 image: add PixOffset methods; use them in image/draw and image/tiff.
image/draw benchmarks show <1% change for the fast paths.
The slow paths got worse by 1-4%, but they're the slow paths.
I don't care so much about them, and presumably compiler improvements
could claw it back.

IIUC 6g's inlining is enabled by default now.

benchmark                        old ns/op    new ns/op    delta
draw.BenchmarkFillOver             2988384      2999624   +0.38%
draw.BenchmarkFillSrc               153141       153262   +0.08%
draw.BenchmarkCopyOver             2155756      2170831   +0.70%
draw.BenchmarkCopySrc                72591        72646   +0.08%
draw.BenchmarkNRGBAOver            2487372      2491576   +0.17%
draw.BenchmarkNRGBASrc             1361306      1409180   +3.52%
draw.BenchmarkYCbCr                2540712      2562359   +0.85%
draw.BenchmarkGlyphOver            1004879      1023308   +1.83%
draw.BenchmarkRGBA                 8746670      8844455   +1.12%
draw.BenchmarkGenericOver         31860960     32512960   +2.05%
draw.BenchmarkGenericMaskOver     16369060     16435720   +0.41%
draw.BenchmarkGenericSrc          13128540     13127810   -0.01%
draw.BenchmarkGenericMaskSrc      30059300     28883210   -3.91%

R=r, gri
CC=golang-dev, rsc
https://golang.org/cl/5536059
2012-01-19 12:59:39 +11:00
Brad Fitzpatrick
98af38807e net: use NewTimer, not NewTicker, in fd_windows.go
It works with NewTicker too, but is potentially a bit less efficient,
and reads wrong.

This is what happens when you TBR Windows changes, I guess.

R=golang-dev, gri, iant
CC=golang-dev
https://golang.org/cl/5536060
2012-01-18 16:49:59 -08:00
Brad Fitzpatrick
b71883e9b0 net: change SetTimeout to SetDeadline
Previously, a timeout (in int64 nanoseconds) applied to a granularity
even smaller than one operation:  a 100 byte read with a 1 second timeout
could take 100 seconds, if the bytes all arrived on the network 1 second
apart.  This was confusing.

Rather than making the timeout granularity be per-Read/Write,
this CL makes callers set an absolute deadline (in time.Time)
after which operations will fail.  This makes it possible to
set deadlines at higher levels, without knowing exactly how
many read/write operations will happen in e.g. reading an HTTP
request.

Fixes #2723

R=r, rsc, dave
CC=golang-dev
https://golang.org/cl/5555048
2012-01-18 16:24:06 -08:00
Robert Griesemer
eaf8295f3d fix windows build: always use / in filenames of go/doc test output
R=r
CC=golang-dev
https://golang.org/cl/5554055
2012-01-18 14:59:58 -08:00
Benny Siegert
be93207c8f image/color: rename modelYCbCr to yCbCrModel.
This matches the other color models. It seems that this was missed
during the review of 5544073.

R=nigeltao, david.crawshaw
CC=golang-dev
https://golang.org/cl/5536057
2012-01-19 09:34:37 +11:00
Robert Griesemer
39bb4bd454 go/doc: rewrote and completed test framework
Packages to test are kept in ./testdata together
with the corresponding golden (packagename.out)
file.

To update the golden files, run: go test -update

R=rsc
CC=golang-dev
https://golang.org/cl/5543054
2012-01-18 14:11:31 -08:00
Robert Griesemer
9edabbe038 go/token: replaced Files() with Iterate()
- Use a faster closure-based iterator rather than a channel-based one.
- Otherwise: better code organization, but no other API changes.

R=r, r
CC=golang-dev
https://golang.org/cl/5557051
2012-01-18 14:10:42 -08:00
Sameer Ajmani
20812c4907 time: add Since, which returns the time elapsed since some past time t.
R=rsc, r
CC=golang-dev
https://golang.org/cl/5532088
2012-01-18 15:25:00 -05:00
Adam Langley
dbebb08601 exp/ssh: handle versions with just '\n'
djm recommend that we do this because OpenSSL was only fixed in 2008:
http://anoncvs.mindrot.org/index.cgi/openssh/sshd.c?revision=1.380&view=markup

R=dave, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/5555044
2012-01-18 15:04:17 -05:00
Shenghou Ma
18de11479c crypto/tls: add FreeBSD root certificate location
Fixes #2721.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5532090
2012-01-18 10:03:00 -08:00
Olivier Duperray
dcc5fe1e20 pkg/bytes: add the usual copyright notice to example_test.go
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5553050
2012-01-18 09:40:50 -08:00
Olivier Duperray
90c38c46af go/scanner: fix example
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5532085
2012-01-18 09:33:50 -08:00
Luit van Drongelen
a5263c7caa crypto/hmac: Add HMAC-SHA224 and HMAC-SHA384/512
First was, apart from adding tests, a single line of code (to add the
constructor function). Adding SHA512-based hashing to crypto/hmac
required minor rework of the package because of a previously hardcoded
block-size in it's implementation. Instead of using a hash.Hash
generator function the constructor function now uses a crypto.Hash
type, which was extended to expose information about block size.

The only standard library package impacted by the change is
crypto/tls, for which the fix is included in this patch. It might be
useful to extend gofix to include this API change too.

R=agl, r, rsc, r
CC=golang-dev
https://golang.org/cl/5550043
2012-01-18 10:36:28 -05:00
Alex Brainman
436b37d885 os: remove old note about NewSyscallError being special
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5556044
2012-01-18 16:59:40 +11:00
David Symonds
6e285ebade encoding/json: document angle bracket escaping.
Fixes #2643.

R=rsc, d_smithson
CC=golang-dev
https://golang.org/cl/5543068
2012-01-18 12:56:24 +11:00
Nigel Tao
a5a16eeaab image: fix typo in Rectangle.Sub comment.
Fixes #2724.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5555043
2012-01-18 10:55:03 +11:00
Rob Pike
b7ec659b54 fmt: fix Malloc test
We need to avoid allocating an extra word for the interface value
passing the floating-point value as an interface{}. It's easy.

Fixes #2722.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5553044
2012-01-17 15:42:02 -08:00
Rob Pike
7585aa6ae5 utf8.String: move to exp/utf8string.String
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5528115
2012-01-17 14:21:50 -08:00
Rob Pike
3b87d68a07 testing: document examples
The package documentation did not mention them.
They were described only in godoc for gotest, and that's going away.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5539079
2012-01-17 14:20:27 -08:00
David Symonds
2ebf0de27c net/http: change test to use override param instead of chan.
Follow-on from https://golang.org/cl/5543062.

R=bradfitz, dvyukov
CC=golang-dev
https://golang.org/cl/5539071
2012-01-18 08:28:09 +11:00
Rob Pike
4985ee3dcb text/template: fix nil error on redefinition
Fixes #2720.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5545072
2012-01-17 13:24:59 -08:00
Brad Fitzpatrick
f4ad8c1c5b net/http/cgi: increase a flaky test timeout
Fixes 2450, probably.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5540074
2012-01-17 13:14:27 -08:00
Rob Pike
4c40558c74 container/heap: better package documentation
Fixes #1820.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5540073
2012-01-17 13:07:47 -08:00
Brad Fitzpatrick
a00de45bbb mime: make FormatMediaType take full type for consistency
Fixes #2405

R=rsc
CC=golang-dev
https://golang.org/cl/5539048
2012-01-17 11:57:42 -08:00
Rob Pike
45d739748e fmt: enable and fix malloc test
On 32-bit machines, %g takes an extra malloc. I don't know why yet,
but this makes the test pass again, and enables it even for -short.

Fixes #2653.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5542055
2012-01-17 10:45:36 -08:00
Brad Fitzpatrick
ebc8013edf exp/sql: copy when scanning into []byte by default
Fixes #2698

R=rsc
CC=golang-dev
https://golang.org/cl/5539060
2012-01-17 10:44:35 -08:00
Luuk van Dijk
9523b4d59c gc: fix infinite recursion for embedded interfaces
Fixes #1909

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5523047
2012-01-17 10:00:57 +01:00
Dmitriy Vyukov
8e99016c80 old/netchan: fix data race on client hashmap
Fixes #2713.

R=golang-dev, r
CC=golang-dev, mpimenov
https://golang.org/cl/5545065
2012-01-17 11:48:20 +04:00
Alex Brainman
994e0646d8 pkg: add missing godoc comments to windows versions
Mostly copied comments from unix files.

R=rsc
CC=golang-dev
https://golang.org/cl/5533057
2012-01-17 16:51:54 +11:00
Alex Brainman
f320eb94f9 go/build: no back slash in FindTree returned pkg name
Fixes #2652.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5516045
2012-01-17 16:51:02 +11:00
Gustavo Niemeyer
9b54af2020 exp/proxy: fix build after URL changes
R=golang-dev
CC=golang-dev
https://golang.org/cl/5540062
2012-01-17 00:55:35 -02:00
Gustavo Niemeyer
dafd9f0bfc net/url: cleaned up URL interface (v2)
Duplicated fields from URL were dropped so that its behavior
is simple and expected when being stringified and when being
operated by packages like http. Most of the preserved fields
are in unencoded form, except for RawQuery which continues to
exist and be more easily handled via url.Query().

The RawUserinfo field was also replaced since it wasn't practical
to use and had limitations when operating with empty usernames
and passwords which are allowed by the RFC. In its place the
Userinfo type was introduced and made accessible through the
url.User and url.UserPassword functions.

What was previous built as:

        url.URL{RawUserinfo: url.EncodeUserinfo("user", ""), ...}

Is now built as:

        url.URL{User: url.User("user"), ...}

R=rsc, bradfitz, gustavo
CC=golang-dev
https://golang.org/cl/5498076
2012-01-17 00:49:05 -02:00
Mikio Hara
a5aa4d3307 net: fix unintentional error variable shadowing
R=rsc
CC=golang-dev
https://golang.org/cl/5543065
2012-01-17 10:59:39 +09:00
Scott Lawrence
5163e7aa27 math/rand: document default initial seed for global generator
Fixes #2044.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5541056
2012-01-16 18:13:34 -05:00
Russ Cox
3735cf7b09 exp/terminal: fix build on non-Linux using Makefiles
The Makefiles will go away soon.

R=agl
CC=golang-dev
https://golang.org/cl/5544081
2012-01-16 17:49:58 -05:00
Jeff Hodges
650b936b0c net/http: send cookies in jar on redirect
Until a RFC 6265 jar lands, Request.AddCookie() will work incorrectly.

Fixes #2692

R=bradfitz, rsc
CC=golang-dev, r
https://golang.org/cl/5544069
2012-01-16 12:57:59 -08:00
Shenghou Ma
c30ba7e65a runtime: implement runtime.usleep for FreeBSD/386 and amd64.
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5528106
2012-01-17 03:22:34 +11:00
Christopher Wedgwood
f53cc8e6ff exp/ssh: rename (some) fields
R=dave, agl, agl
CC=golang-dev
https://golang.org/cl/5494057
2012-01-16 10:09:36 -05:00
Maxim Pimenov
0aaf2c2d10 runtime: fix typo in comment
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/5540059
2012-01-16 18:42:18 +04:00
Dmitriy Vyukov
92686dda7c net/http: fix data race in test
Fixes #2712.

R=golang-dev, dsymonds
CC=golang-dev, mpimenov
https://golang.org/cl/5543062
2012-01-16 14:47:33 +04:00
Dmitriy Vyukov
ba7dc5de06 sync/atomic: fix data race in tests
Fixes #2710.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5541066
2012-01-16 11:43:36 +04:00
Dmitriy Vyukov
3d2e75cf92 exp/inotify: fix data race in linux tests
Fixes #2708.

R=golang-dev, bradfitz
CC=golang-dev, mpimenov
https://golang.org/cl/5543060
2012-01-16 11:11:58 +04:00
Mikio Hara
8727b11dfb net: consistent log format in test
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5545062
2012-01-16 14:57:18 +09:00
David Crawshaw
cdf7654062 image/color: simplify documentation
R=nigeltao, dsymonds, adg
CC=golang-dev
https://golang.org/cl/5544073
2012-01-16 16:02:31 +11:00
Jonathan Pittman
0a97ef8f71 exp/ssh: add marshal functions for uint32 and uint64 types
R=golang-dev, dave, agl
CC=golang-dev
https://golang.org/cl/5533081
2012-01-15 19:54:17 -05:00
Adam Langley
1019eda9d8 exp/terminal: still trying to unbreak non-Linux builds.
R=golang-dev
CC=golang-dev
https://golang.org/cl/5542050
2012-01-15 10:41:16 -05:00
Adam Langley
026f8dfb94 exp/terminal: add to level Makefile for the (non-Linux?) systems that need it.
R=golang-dev
CC=golang-dev
https://golang.org/cl/5528102
2012-01-15 10:22:15 -05:00
Adam Langley
a33b76081b exp/ssh: patching in the last change lost that a file was deleted.
R=golang-dev
CC=golang-dev
https://golang.org/cl/5541060
2012-01-15 10:08:48 -05:00
Adam Langley
dd47a0a2ca exp/ssh: remove duplicated terminal code.
The terminal code in exp/terminal was forked from the code in exp/ssh.
This change removes the duplicated code from exp/ssh in favour of
using exp/terminal.

R=rsc
CC=golang-dev
https://golang.org/cl/5375064
2012-01-15 09:59:06 -05:00
Volker Dobler
4dda23a1d0 http: Allow cookies with negative Max-Age attribute as these are
allowed by RFC 6265 sec 5.2.2.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5533083
2012-01-15 19:32:16 +11:00
Mikio Hara
7419921bf3 net: platform-dependent default socket options
This CL revises existing platform-dependent default socket
options to make it possible to accomodate multiple multicast
datagram listeners on a single service port.

Also removes unnecessary SO_REUSEADDR, SO_REUSEPORT socket
options from unicast datagram sockets by default.

Fixes #1692.

R=devon.odell, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5538052
2012-01-15 14:19:44 +09:00
Rob Pike
2374edc640 go/doc: print only one newline between paragraphs
Fixes #2595.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5544068
2012-01-14 11:57:32 -08:00
Shenghou Ma
4cfa9e3c61 doc: fix comments referring to removed API funcs
The strconv package has removed Atob, AtoF{64,32} and Ftoa.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540057
2012-01-14 10:59:45 -08:00
Adam Langley
a9e1f6d7a6 exp/terminal: add SetPrompt and handle large pastes.
(This was missing in the last change because I uploaded it from the
wrong machine.)

Large pastes previously misbehaved because the code tried reading from
the terminal before checking whether an line was already buffered.
Large pastes can cause multiples lines to be read at once from the
terminal.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5542049
2012-01-14 10:59:11 -05:00
Adam Langley
423a09760b exp/proxy: new package
exp/proxy provides client support for tunneling connections through
various proxies.

This is an initial, incomplete sketch of the code to lay down an
API.

R=golang-dev, r, r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5490062
2012-01-14 10:44:35 -05:00
Mikio Hara
d3c59f6ec8 net: make use of the kernel state to listen on TCP, Unix
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/5545044
2012-01-14 13:42:18 +09:00
Scott Lawrence
439d863e7c go/doc: remove duplicate package comment
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5528101
2012-01-13 16:49:30 -08:00
Olivier Duperray
066551e49b pkg/go/doc: fix undefined: doc.NewPackageDoc in headscan.go
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5539059
2012-01-13 16:45:30 -08:00
Brad Fitzpatrick
bf734d62d8 exp/sql: add time.Time support
Fixes #2694

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5541057
2012-01-13 15:45:05 -08:00
Scott Lawrence
a08c1960dd go/ast: fix typo
R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5543056
2012-01-13 15:36:54 -08:00
Brad Fitzpatrick
1c441e259f exp/sql: fix statement leak
Also verified in external test suite that this fixes MySQL
resource exhaustion problems, and also exposed a double-free
bug in the gosqlite3 driver (where gosqlite3 either got lucky
before, or was working around this bug)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5544057
2012-01-13 15:25:07 -08:00
Rémy Oudompheng
0575cd9de4 strconv: faster FormatFloat(x, *, -1, 64) using Grisu3 algorithm.
The implementation is similar to the one from the double-conversion
library used in the Chrome V8 engine.

                            old ns/op   new ns/op  speedup
BenchmarkAppendFloatDecimal      591         480      1.2x
BenchmarkAppendFloat            2956         486      6.1x
BenchmarkAppendFloatExp        10622         503     21.1x
BenchmarkAppendFloatNegExp     40343         483     83.5x
BenchmarkAppendFloatBig         2798         664      4.2x

See F. Loitsch, ``Printing Floating-Point Numbers Quickly and
Accurately with Integers'', Proceedings of the ACM, 2010.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5502079
2012-01-13 23:24:33 +01:00
Rob Pike
a5950df89e template: for range on a map, sort the keys if feasible.
Fixes #2696.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5543055
2012-01-13 14:09:13 -08:00
Mikio Hara
92c8df46c6 src: make use of runtime.GOOS, GOARCH instead of syscall.OS, ARCH
R=rsc, r
CC=golang-dev
https://golang.org/cl/5545048
2012-01-14 06:40:55 +09:00
Brad Fitzpatrick
87ceb0cec7 bytes: make Write and WriteString code look the same
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540056
2012-01-13 11:48:57 -08:00
Rob Pike
eaecf357e7 time: delete unused buffer.WriteByte method
R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/5539056
2012-01-13 11:47:55 -08:00
Robert Griesemer
c7cdce13f5 godoc: make ?m=src mode deterministic
Merge package files in the go/ast MergePackageFiles
function always	    in the same order (sorted by filename)
instead	 of map iteration order to obtain the same
package	 file each time.  This functionality is used
by godoc when displaying packages in ?m=src mode.

Also: minor cleanup in godoc.go.

R=rsc
CC=golang-dev
https://golang.org/cl/5540054
2012-01-13 09:32:35 -08:00
Gustavo Niemeyer
1627b46eaa xml: major Go 1 fixup
This CL improves the xml package in the following ways:

- makes its interface match established conventions
- brings Marshal and Unmarshal closer together
- fixes a large number of bugs and adds tests
- improves speed significantly
- organizes and simplifies the code

Fixes #2426.
Fixes #2406.
Fixes #1989.

What follows is a detailed list of those changes.

- All matching is case sensitive without special processing
  to the field name or xml tag in an attempt to match them.
  Customize the field tag as desired to match the correct XML
  elements.

- Flags are ",flag" rather than "flag". The names "attr",
  "chardata", etc, may be used to name actual XML elements.

- Overriding of attribute names is possible with "name,attr".

- Attribute fields are marshalled properly if they have
  non-string types. Previously they were unmarshalled, but were
  ignored at marshalling time.

- Comment fields tagged with ",comment" are marshalled properly,
  rather than being marshalled as normal fields.

- The handling of the Any field has been replaced by the ",any"
  flag to avoid unexpected results when using the field name for
  other purposes, and has also been fixed to interact properly
  with name paths. Previously the feature would not function
  if any field in the type had a name path in its tag.

- Embedded struct support fixed and cleaned so it works when
  marshalling and also when using field paths deeper than one level.

- Conflict reporting on field names have been expanded to cover
  all fields. Previously it'd catch only conflicts of paths
  deeper than one level. Also interacts correctly with embedded
  structs now.

- A trailing '>' is disallowed in xml tags. It used to be
  supported for removing the ambiguity between "attr" and "attr>",
  but the marshalling support for that was broken, and it's now
  unnecessary. Use "name" instead of "name>".

- Fixed docs to point out that a XMLName doesn't have to be
  an xml.Name (e.g. a struct{} is a good fit too). The code was
  already working like that.

- Fixed asymmetry in the precedence of XML element names between
  marshalling and unmarshalling. Marshal would consider the XMLName
  of the field type before the field tag, while unmarshalling would
  do the opposite. Now both respect the tag of the XMLName field
  first, and a nice error message is provided in case an attempt
  is made to name a field with its tag in a way that would
  conflict with the underlying type's XMLName field.

- Do not marshal broken "<???>" tags when in doubt. Use the type
  name, and error out if that's not possible.

- Do not break down unmarshalling if there's an interface{} field
  in a struct.

- Significant speed boost due to caching of type metadata and
  overall allocation clean ups. The following timings reflect
  processing of the the atom test data:

  Old:

  BenchmarkMarshal           50000             48798 ns/op
  BenchmarkUnmarshal          5000            357174 ns/op

  New:

  BenchmarkMarshal          100000             19799 ns/op
  BenchmarkUnmarshal         10000            128525 ns/op

R=cw, gustavo, kevlar, adg, rogpeppe, fullung, christoph, rsc
CC=golang-dev
https://golang.org/cl/5503078
2012-01-13 11:05:19 +01:00
Robert Griesemer
eac31c67a8 go/doc: streamlined go/doc API
- the main changes are removing the Doc suffix
  from the exported types, so instead of
  doc.TypeDoc one will have doc.Type, etc.

- All exported types now have a Name (or Names) field.
  For Values, the Names field lists all declared variables
  or constants.

- Methods have additional information about where they are
  coming from.

- There's a mode field instead of a bool to
  control the package's operation, which makes
  it easier to extend w/o API changes.

Except for the partially implemented new Method type,
this is based on existing code. A clean rewrite is in
progress based on this new API.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/5528060
2012-01-12 17:36:57 -08:00
Robert Griesemer
4f63cdc81f go/doc: initial testing support
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5533082
2012-01-12 17:20:51 -08:00
Robert Griesemer
9535b86a27 go/doc: don't ignore anonymous non-exported fields
- remove wrapper.go from testing package (not needed anymore)

Fixes #1000.

R=rsc, golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5502074
2012-01-12 16:05:05 -08:00
Robert Griesemer
74cb963225 go/parser: Remove unused Parse* functions. Simplified ParseExpr signature.
Only ParseFile, ParseDir, and ParseExpr are used in the tree.
If partial parsing of code is required, it is fairly simple
to wrap the relevant piece of code into a dummy package for
parsing (see parser.ParseExpr).

Also: minor cleanups.

R=rsc
CC=golang-dev
https://golang.org/cl/5535055
2012-01-12 16:04:48 -08:00
Robert Griesemer
06479f766c go/ast: remove unnecessary result value from ast.Fprint/Print
These functions are mostly of interest for debugging; the
number of bytes written is uninteresting.

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5540046
2012-01-12 16:04:32 -08:00
Russ Cox
ba0e02b207 cgo: write _cgo_export.h to object directory, not source dir
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540048
2012-01-12 15:04:31 -08:00
Brad Fitzpatrick
b37de7387a json: better error messages when the ,string option is misused
Fixes #2331

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5544045
2012-01-12 14:40:29 -08:00
Brad Fitzpatrick
7a7d345391 net/http: don't ignore Request.Write's Flush error
Pointed out by nekotaroh in issue 2645

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5539045
2012-01-12 13:15:40 -08:00
Rémy Oudompheng
37cd165838 strconv: implement fast path for rounding already short numbers.
benchmark                   old ns/op   new ns/op   delta
BenchmarkFormatFloatDecimal      3765        1386    -63%

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5494060
2012-01-12 11:34:06 -08:00
Russ Cox
f0f6aa59cc go/doc: move CommentText to ast.CommentGroup's Text method
Now only godoc imports go/doc.

R=gri
CC=golang-dev
https://golang.org/cl/5541045
2012-01-12 11:34:02 -08:00
Russ Cox
6f77cd2914 strconv: fix round up corner case
Comment described the correct condition
but the code did not implement it.

Fixes #2625.

R=remyoudompheng
CC=golang-dev
https://golang.org/cl/5530082
2012-01-12 11:32:28 -08:00
Brad Fitzpatrick
701f70abf6 sql: fix potential corruption in QueryRow.Scan into a *[]byte
Fixes #2622

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5533077
2012-01-12 11:23:33 -08:00
Russ Cox
fb036824df go/build: allow colon in #cgo flags
This makes it possible to say -I c:/foo on Windows.

Fixes #2683 comment #3.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540043
2012-01-12 11:05:54 -08:00
Russ Cox
4953b87296 testing: fix defer race
In a test that does

        func TestFoo(t *testing.T) {
                defer cleanup()
                t.Fatal("oops")
        }

it can be important that cleanup run as the test fails.
The old code did this in Fatal:

        t.signal <- t
        runtime.Goexit()

The runtime.Goexit would run the deferred cleanup
but the send on t.signal would cause the main test loop
to move on and possibly even exit the program before
the runtime.Goexit got a chance to run.

This CL changes tRunner (the top stack frame of a test
goroutine) to send on t.signal as part of a function
deferred by the top stack frame.  This delays the send
on t.signal until after runtime.Goexit has run functions
deferred by the test itself.

For the above TestFoo, this CL guarantees that cleanup
will run before the test binary exits.

This is particularly important when cleanup is doing
externally visible work, like removing temporary files
or unmounting file systems.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532078
2012-01-12 10:18:12 -08:00
Dmitriy Vyukov
a03c519a8c effective_go: provide reference to runtime.NumCPU()
R=golang-dev, robert.hencke, r
CC=golang-dev
https://golang.org/cl/5538050
2012-01-12 22:06:50 +04:00
Andrew Gerrand
e955a3cca2 net/textproto: always copy the data from bufio to avoid corruption
Fixes #2621.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5498104
2012-01-12 14:15:58 +11:00
Russ Cox
610757b155 runtime: delete duplicate implementation of pcln walker
It's hard enough to get right once.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5533073
2012-01-11 18:45:32 -08:00
Mike Samuel
b1d6fa517c html/template: reenable testcases and fix mis-escaped sequences.
Tighter octal parsing broke some tests and were disabled in
https://golang.org/cl/5530051

Those tests were broken.  The CSS decoder was supposed to see CSS
hex escape sequences of the form '\' <hex>+, but those escape
sequences were instead being consumed by the template parser.

This change properly escapes those escape sequences, and uses
proper escaping for NULs.

R=golang-dev, rsc, nigeltao
CC=golang-dev
https://golang.org/cl/5529073
2012-01-11 18:47:03 -05:00
Robert Griesemer
3fc327b33b go/scanner: 17% faster scanning
- Changed the Scan API semantics slightly:
The token literal string is only returned
if the token is a literal, comment, semicolon,
or illegal character. In all other cases, the
token literal value is determined by the token
value.

Clients that care about the token literal value
when not present can always use the following
piece of code:

pos, tok, lit := scanner.Scan()
if lit == "" {
   lit = tok.String()
}

- Changed token.Lookup API to use a string instead
of a []byte argument.

- Both these changes were long-standing TODOs.

- Added BenchmarkScan.

This change permits a faster implementation of Scan
with much fewer string creations:

benchmark                old ns/op    new ns/op    delta
scanner.BenchmarkScan        74404        61457  -17.40%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532076
2012-01-11 14:20:32 -08:00
Robert Griesemer
276f177b9c go/scanner: remove (exported) InsertSemis mode
This is a relic from the times when we switched
to automatic semicolon insertion. It's still use-
ful to have a non-exported switch for testing.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5528077
2012-01-11 10:06:44 -08:00
Robert Griesemer
a30b172ca0 go/printer: don't crash if AST contains BadXXX nodes
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5535048
2012-01-11 08:32:03 -08:00
Adam Langley
b1bad5530a Makefile: update openpgp/error -> openpgp/errors
R=golang-dev
CC=golang-dev
https://golang.org/cl/5530078
2012-01-11 08:39:29 -05:00
Adam Langley
a68494bf21 crypto/openpgp: assorted cleanups
1) Include Szabolcs Nagy's patch which adds serialisation for more
   signature subpackets.
2) Include Szabolcs Nagy's patch which adds functions for making DSA
   keys.
3) Make the random io.Reader an argument to the low-level signature
   functions rather than having them use crypto/rand.
4) Rename crypto/openpgp/error to crypto/openpgp/errors so that it
   doesn't clash with the new error type.

R=bradfitz, r
CC=golang-dev
https://golang.org/cl/5528044
2012-01-11 08:35:32 -05:00
Shenghou Ma
1250f94f93 runtime: runtime.usleep() bugfix on darwin/amd64 and linux/arm
pkg/runtime/sys_darwin_amd64.s: fixes syscall select nr
pkg/runtime/sys_linux_arm.s: uses newselect instead of the now unimplemented
        (old) select, also fixes the wrong div/mod statements in runtime.usleep.
Fixes #2633

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5504096
2012-01-10 20:48:02 -08:00
Russ Cox
8fe7701301 os: work around inlining bug (issue 2678)
TBR=lvd
CC=golang-dev
https://golang.org/cl/5534070
2012-01-10 20:26:11 -08:00
Alex Brainman
d03bfa8e5b net: fix windows build
R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5533065
2012-01-11 14:55:10 +11:00
Russ Cox
a6d8b483b6 runtime: make garbage collector faster by deleting code
Suggested by Sanjay Ghemawat.  5-20% faster depending
on the benchmark.

Add tree2 garbage benchmark.
Update other garbage benchmarks to build again.

R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5530074
2012-01-10 19:49:11 -08:00
Robert Griesemer
2b6288113e go/scanner: fix documentation
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5528070
2012-01-10 18:31:27 -08:00
Robert Griesemer
090049130e go/ast: predeclared objects have the Universe/Unsafe scope as Decl
Makes it possible to easily detect if an Object was predeclared
(as opposed to unresolved).

R=rsc
CC=golang-dev
https://golang.org/cl/5530072
2012-01-10 18:30:06 -08:00
Mikio Hara
b06514bb34 syscall: fix windows build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5533063
2012-01-10 18:27:09 -08:00
Nigel Tao
415f15b667 image: rename image.Tiled to image.Repeated.
What package image currently provides is a larger image consisting
of many copies of a smaller image.

More generally, a tiled image could be a quilt consisting of different
smaller images (like Google Maps), or a technique to view a portion of
enormous images without requiring the whole thing in memory.

This richer construct might not ever belong in the standard library (and
is definitely out of scope for Go 1), but I would like the option for
image.Tiled to be its name.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5530062
2012-01-11 12:35:05 +11:00
Mikio Hara
cbdbdc4f61 net: add IP-level socket option helpers for Unix variants
Also reorganize socket options stuff but there are no API behavioral
changes.

R=rsc, fullung
CC=golang-dev
https://golang.org/cl/5494067
2012-01-11 09:53:32 +09:00
Nigel Tao
aa033c20b3 html: propagate foreign namespaces only when adding foreign content.
Pass tests10.dat, test 31:
<div><svg><path><foreignObject><p></div>a

| <html>
|   <head>
|   <body>
|     <div>
|       <svg svg>
|         <svg path>
|           <svg foreignObject>
|             <p>
|               "a"

Also pass test 32:
<!DOCTYPE html><svg><desc><div><svg><ul>a

R=andybalholm
CC=golang-dev
https://golang.org/cl/5527064
2012-01-11 10:15:40 +11:00
Maxim Pimenov
dcdc309c7c runtime: fix typo in comment
R=golang-dev
CC=golang-dev
https://golang.org/cl/5529059
2012-01-10 12:56:25 -08:00
Brad Fitzpatrick
4435c8bf2a exp/sql: close Rows on EOF
Fixes #2624

R=rsc
CC=golang-dev
https://golang.org/cl/5530068
2012-01-10 12:51:27 -08:00
Russ Cox
5032a7dc0c runtime: distinct panic message for call of nil func value
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5531062
2012-01-10 11:46:57 -08:00
Dave Cheney
bc1f4c1823 runtime: regenerate defs_darwin_{386,amd64}.h
Regenerated under Lion 10.7.2 amd64.
Also tested on Snow Leopart 10.6.8 386.

R=golang-dev, dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/5533058
2012-01-10 09:48:10 -08:00