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

9147 Commits

Author SHA1 Message Date
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
Andrew Gerrand
8bbe5ccb71 godoc: support canonical Paths in HTML metadata
Redirect to the canonical path when the old path is accessed.

R=gri
CC=golang-dev
https://golang.org/cl/5536061
2012-01-20 07:37:36 +11: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
Brad Fitzpatrick
f47807a57f cmd/go: skip _obj directories in package scans
Fixes #2693

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557057
2012-01-18 19:27:16 -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
Andrew Gerrand
7cb21a79a4 godoc: specify HTML page metadata with a JSON blob
This allows HTML pages to specify arbitrary data in a header:

<!--{
        "Title": "The page title",
        ...
}-->

replacing the old style comments:

<!-- title The page title -->

R=gri, rsc, r, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5532093
2012-01-19 11:24:54 +11: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
Luuk van Dijk
6ff01f01f4 gc: fieldnames in structliterals in exported inlines should not be qualified if they're embedded builtin types.
Trust me.
Fixes #2687.

R=rsc
CC=golang-dev
https://golang.org/cl/5545047
2012-01-18 17:51:28 +01: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
Luuk van Dijk
18ee75ec88 gc: handle printing of string/arrayrune conversions
Fixes #2714.

R=rsc
CC=golang-dev
https://golang.org/cl/5540066
2012-01-18 09:52:16 +01: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
3495f39fc4 cmd/go: remove mentions of 'gotest' from the documentation
go test runs the tests itself; it does not run the gotest command,
so these mentions are confusing.

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5551043
2012-01-17 13:13:50 -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
Shenghou Ma
c5f8433261 buildscripts: move to buildscript directory
Fixes #2717.

R=r, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5545069
2012-01-17 11:18:15 -05:00
Luuk van Dijk
4e78818259 gc: give esc.c's sink an orig so -mm diagnostics work again.
R=rsc
CC=golang-dev
https://golang.org/cl/5543063
2012-01-17 10:01:12 +01: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
Shenghou Ma
b24d1cb5ec 5l: remove redundant code
5l/asm.c: code in line 311-319 has already outputed segtext.sect->next;

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532048
2012-01-16 19:29:54 -05: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
Scott Lawrence
b16f3a2d50 gc: don't fault on return outside function
Fixes #2598.

R=golang-dev, ality, minux.ma, mpimenov, rsc
CC=golang-dev
https://golang.org/cl/5510043
2012-01-16 18:12:25 -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
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01: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
Olivier Duperray
c40314821b cmd/gofmt: fix simplify.go by running gofmt on cmd/gofmt
R=golang-dev
CC=golang-dev
https://golang.org/cl/5539061
2012-01-13 18:05:47 -08: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
Dmitriy Vyukov
a4f7024e0a cmd/go: fix data race during build
Fixes #2695.

R=golang-dev, mpimenov, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5545052
2012-01-13 22:22:03 +04: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
c2ffd9d0c2 cmd/go: use relative paths in go fix, go fmt, go vet output
Fixes #2686.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5528089
2012-01-12 15:28:52 -08:00
Russ Cox
4505ae3863 cmd/go: handle path to cmd directory
Now it works to run 'go install' (no args) in cmd/go.

Fixes #2679.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5543046
2012-01-12 15:27:57 -08:00
Russ Cox
e91b31bc79 fix build
TBR=gri
CC=golang-dev
https://golang.org/cl/5528090
2012-01-12 15:27:49 -08:00
Russ Cox
811006c89d cmd/go: handle cgo pkg-config pragmas
Fixes #2681.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540047
2012-01-12 15:04:39 -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
Russ Cox
c624fa691d go/build: pass CgoLDFLAGS at end of link command
By the time a Unix linker gets to the end of the
command line it has forgotten what you told it
at the beginning of the command line, so you
have to put library arguments (like -lm) at the end.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5541043
2012-01-12 13:44:02 -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
267f56e10b ld: parse but do not implement -X flag
This will let programs invoking ld prepare for it.
See issue 2676.

R=iant
CC=golang-dev
https://golang.org/cl/5535044
2012-01-12 10:23:24 -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
Russ Cox
725f084b11 cmd/go: fix linker arguments
Especially affects tests, but not test-specific.
The linker was only being told where to find the
direct dependencies of package main.  Sometimes that
was sufficient to find the rest; sometimes not.

Fixes #2657.
Fixes #2666.
Fixes #2680.

R=golang-dev, adg, rogpeppe
CC=golang-dev
https://golang.org/cl/5528079
2012-01-12 10:18:03 -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
Shenghou Ma
26ba35666e goyacc: fix units.y build breakage
This breakage is mainly due to API changes in pkg.
(e.g., package utf8 moved to unicode/utf8;
       remove of strconv.Atof64;
       change character type from int to rune.)
Also correct the usage comment.

This fixes issue 2646.
PS: I don't change the goyacc.go, because I think token type
    should not be force to rune.

R=golang-dev, adg, rogpeppe, r, r
CC=golang-dev
https://golang.org/cl/5502093
2012-01-12 07:54:20 -08:00
Rémy Oudompheng
94ff311d1b gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.

R=lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5489128
2012-01-12 12:08:40 +01: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
Russ Cox
524fb81c41 gc: inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5533078
2012-01-11 20:32:02 -05: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
Russ Cox
81728cf06d gc: fix inlining bug
R=lvd
CC=golang-dev
https://golang.org/cl/5532077
2012-01-11 17:25:09 -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
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Russ Cox
f2b51f564f cmd/go: change deadline to 10 minutes
1 minute is not enough for the slower builders.

R=adg
CC=golang-dev
https://golang.org/cl/5533068
2012-01-11 12:44:31 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Robert Griesemer
b8f76764cb go test: align "no test files" message
R=rsc
CC=golang-dev
https://golang.org/cl/5533070
2012-01-11 11:15:36 -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
Dmitriy Vyukov
c7fdbeb6c1 cmd/go: fix test documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5529067
2012-01-11 09:47:08 -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
Russ Cox
0c012af114 cmd/go: kill test.out after 1 minute
Will have to do better but this is enough to
stop the builders from hanging, I hope.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/5533066
2012-01-10 21:01:58 -08: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
Russ Cox
091ef25a5e go: rely on exit code to tell if test passed
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5532066
2012-01-10 20:13:02 -08:00
Russ Cox
4a6b07f235 gc: enable inlining by default
R=lvd, r
CC=golang-dev
https://golang.org/cl/5531058
2012-01-10 20:08:53 -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
Luuk van Dijk
97fd7d5f34 gc: inlining fixes
flag -l means: inlining on, -ll inline with early typecheck
-l lazily typechecks imports on use and re-export, nicer for debugging
-lm produces output suitable for errchk tests, repeated -mm... increases inl.c's verbosity
export processed constants, instead of originals
outparams get ->inlvar too, and initialized to zero
fix shared rlist bug, that lead to typecheck messing up the patched tree
properly handle non-method calls to methods T.meth(t, a...)
removed embryonic code to handle closures in inlined bodies
also inline calls inside closures (todo: move from phase 6b to 4)

Fixes #2579.

R=rsc
CC=golang-dev
https://golang.org/cl/5489106
2012-01-10 21:24:31 +01: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
Maxim Pimenov
800c49820a go: fix typo in comment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5531060
2012-01-10 07:43:48 -08:00
Luuk van Dijk
a6c49098bc gc: Nicer errors before miscompiling.
This fixes issue 2444.

A big cleanup of all 31/32bit size boundaries i'll leave for another cl though.  (see also issue 1700).

R=rsc
CC=golang-dev
https://golang.org/cl/5484058
2012-01-10 11:19:22 +01:00
Luuk van Dijk
4bcc9c6b5e gc: disallow declaration of variables outside package.
Fixes #2231.

Declaring main.i in package main in the same way already triggers syntax errors.

R=rsc
CC=golang-dev
https://golang.org/cl/5483078
2012-01-10 11:18:56 +01:00
Luuk van Dijk
556258e57b gc: fix stray %#N in error message
Fixes #2639.

R=rsc
CC=bradfitz, golang-dev
https://golang.org/cl/5489140
2012-01-10 11:09:04 +01:00
Luuk van Dijk
ba25778f3f gc: omit runtime.closure wrap for closures without closure variables
Fixes #1894.

test/closure.go's test for newfunc already covers this.

R=rsc, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5516051
2012-01-10 11:07:35 +01:00
Mikio Hara
ad3e82e736 undo CL 5530063 / 1d7295fdf62e
runtime: enable runtime.ncpu on FreeBSD

««« original CL description
cmd/go: fix freebsd build

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5531059
2012-01-10 16:11:31 +09:00
Devon H. O'Dell
12bf00054e runtime: enable runtime.ncpu on FreeBSD
R=adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5528062
2012-01-10 17:39:17 +11:00
Mikio Hara
8cad9251b3 cmd/go: fix freebsd build
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5530063
2012-01-10 14:47:20 +09:00
Russ Cox
8d8829c671 cmd/go: add -p flag for parallelism (like make -j)
On my MacBookAir4,1:

19.94r 	 go install -a -p 1 std
12.36r 	 go install -a -p 2 std
9.76r 	 go install -a -p 3 std
10.77r 	 go install -a -p 4 std

86.57r 	 go test -p 1 std -short
52.69r 	 go test -p 2 std -short
43.75r 	 go test -p 3 std -short
40.44r 	 go test -p 4 std -short

157.50r 	 go test -p 1 std
99.58r 	 go test -p 2 std
87.24r 	 go test -p 3 std
80.18r 	 go test -p 4 std

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/5531057
2012-01-09 21:06:31 -08:00
Russ Cox
6dfdd4c1e3 runtime: add NumCPU
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5528061
2012-01-09 18:45:59 -08:00
Sameer Ajmani
cbf4f4b8d0 strconv: return ErrSyntax when unquoting illegal octal sequences. This
is consistent with what the Go compiler returns when such sequences
appear in string literals.

Fixes #2658.

R=golang-dev, rsc, r, r, nigeltao
CC=golang-dev
https://golang.org/cl/5530051
2012-01-09 19:55:18 -05:00
Brad Fitzpatrick
024952fb8a syscall: make Environ return original order
Fixes #2619

R=r, rsc
CC=golang-dev
https://golang.org/cl/5528058
2012-01-09 16:51:20 -08:00
Russ Cox
146a703cd1 cmd/go: add -v flag to build and install
The -v flag prints the names of packages as they are built/installed.

Use -v in make.bash/run.bash to avoid a silent pause during
the build while Go code is being compiled.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532055
2012-01-09 16:44:01 -08:00
Russ Cox
b8615a0931 go: add ... patterns in import path arguments
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5530058
2012-01-09 16:23:00 -08:00
Robert Griesemer
22dfc77c99 go/doc: first steps towards cleaning up go/doc
- separated exported data structures from doc reader
  by extracting all exported data structures into doc.go
  and moving the implementation into reader.go
- added missing documentation comments
- no API or semantic changes (but moved positions of
  PackageDoc.Doc and TypeDoc.Decl field up for consistency)
- runs all tests

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5527063
2012-01-09 16:14:01 -08:00
Nigel Tao
748fab9d11 html: foreign element HTML integration points, tag name adjustment,
shorten the MathML namespace abbreviation from "mathml" to "math".
Python's html5lib uses "mathml", but I think that that is an internal
implementation detail; the test cases use "math".

Pass tests10.dat, test 30:
<div><svg><path><foreignObject><math></div>a

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

R=andybalholm
CC=golang-dev
https://golang.org/cl/5529044
2012-01-10 11:06:09 +11:00
Russ Cox
0ad241dd55 cmd/go: fix import directory list for compilation
This fixes the most annoying bug in the go command,
that 'go build' sometimes ignored packages it had just
rebuilt in favor of stale installed ones.

This part of the code needs more thought, but this small
change is an important improvement.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5531053
2012-01-09 15:38:07 -08:00
Anthony Martin
1421b4ceff syscall: ignore godefs input when building on Plan 9
R=golang-dev, akumar, rsc
CC=golang-dev
https://golang.org/cl/5534055
2012-01-09 15:09:40 -08:00
Russ Cox
cc02ef0258 os: add ModeCharDevice
This should make conversion from Unix mode
to os.FileMode and back not lossy.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5531052
2012-01-09 14:22:53 -08:00
Adam Langley
f942736495 crypto/openpgp: truncate hashes before checking DSA signatures.
I didn't believe that OpenPGP allowed > SHA-1 with DSA, but it does and
so we need to perform hash truncation.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5510044
2012-01-09 16:57:51 -05:00
Rémy Oudompheng
f5d024a746 text/template: handle panic values that are not errors.
The recover code assumes that the panic() argument was
an error, but it is usually a simple string.
Fixes #2663.

R=golang-dev, r, r, gri
CC=golang-dev, remy
https://golang.org/cl/5527046
2012-01-09 12:54:31 -08:00
Alexey Borzenkov
793768e9d5 encoding/gob: fix panic when decoding []byte to incompatible slice types
Fixes #2662.

R=golang-dev, rogpeppe, r, r
CC=golang-dev, r, rogpeppe
https://golang.org/cl/5515050
2012-01-09 12:52:03 -08:00
Luuk van Dijk
41806ec26d gc: remove now redundant typecheck of ->ninit on switches.
Fixes #2576.

R=rsc
CC=golang-dev
https://golang.org/cl/5498105
2012-01-09 21:42:24 +01:00
Ian Lance Taylor
900b8becb3 cgo: if value for constant did not parse, get it from DWARF info
R=rsc, borman
CC=golang-dev
https://golang.org/cl/5525043
2012-01-09 11:22:26 -08:00
Robert Griesemer
b4be65bc7f math/big: simplify fast string conversion
- use slice ops for convertWords instead of lo/hi boundaries
- always compute leading zeroes (simplifies logic significantly),
  but remove them once, at the end (since leafSize is small, the
  worst-case scenario is not adding significant overhead)
- various comment cleanups (specifically, replaced direct -> iterative,
  and indirect -> recursive)
- slightly faster overall for -bench=String

(This CL incorporates the changes re: my comments to CL 5418047
https://golang.org/cl/5418047/ )

benchmark                          old ns/op    new ns/op    delta
big.BenchmarkString10Base2               519          527   +1.54%
big.BenchmarkString100Base2             2279         2158   -5.31%
big.BenchmarkString1000Base2           18475        17323   -6.24%
big.BenchmarkString10000Base2         178248       166219   -6.75%
big.BenchmarkString100000Base2       1548494      1431587   -7.55%
big.BenchmarkString10Base8               415          422   +1.69%
big.BenchmarkString100Base8             1025          978   -4.59%
big.BenchmarkString1000Base8            6822         6428   -5.78%
big.BenchmarkString10000Base8          64598        61065   -5.47%
big.BenchmarkString100000Base8        593788       549150   -7.52%
big.BenchmarkString10Base10              654          645   -1.38%
big.BenchmarkString100Base10            1863         1835   -1.50%
big.BenchmarkString1000Base10          12099        11981   -0.98%
big.BenchmarkString10000Base10         57601        56888   -1.24%
big.BenchmarkString100000Base10     20123120     19827890   -1.47%
big.BenchmarkString10Base16              358          362   +1.12%
big.BenchmarkString100Base16             815          776   -4.79%
big.BenchmarkString1000Base16           4710         4421   -6.14%
big.BenchmarkString10000Base16         43938        40968   -6.76%
big.BenchmarkString100000Base16       406307       373930   -7.97%

R=michael.jones, mtj
CC=golang-dev
https://golang.org/cl/5432090
2012-01-09 11:20:09 -08:00
Russ Cox
8a4bd094a0 undo CL 5504108 / 0edee03791f4
breaks 386 build

««« original CL description
gc: put limit on size of exported recursive interface

Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

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

»»»

R=lvd, lvd
CC=golang-dev
https://golang.org/cl/5534049
2012-01-09 09:45:08 -08:00
Lorenzo Stoakes
aa63a928ea gc: put limit on size of exported recursive interface
Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108
2012-01-09 11:48:53 -05:00
Albert Strasheim
2cb6fcf63f syscall: Linux-only support for parent death signal
As discussed in this thread:

https://groups.google.com/group/golang-dev/browse_thread/thread/5b76b7700265a787

I've tried to come up with a solution that is minimally invasive for the platforms that don't support "parent death signal", without splitting up exec_unix.go.

See also: http://www.win.tue.nl/~aeb/linux/lk/lk-5.html#ss5.8

R=rsc, dave, borman, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5487061
2012-01-09 21:37:46 +09:00
Andrew Gerrand
c7e91724c0 go/build: handle and warn of duplicate GOPATH entries
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5519050
2012-01-09 14:24:05 +11:00
Wei Guangjing
9569c67a6b windows: use ArbitraryUserPointer as TLS slot
R=hectorchu, alex.brainman
CC=golang-dev
https://golang.org/cl/5519054
2012-01-09 11:23:07 +11:00
Florian Weimer
0448ce13a0 encoding/asn1: document support for *big.Int
Also add basic tests.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5533045
2012-01-08 10:02:23 -05:00
Sameer Ajmani
1379d90651 time: fix godoc for After and NewTicker.
R=golang-dev, gri, bradfitz, iant
CC=golang-dev, rsc
https://golang.org/cl/5523049
2012-01-07 20:53:53 -05:00
Ryan Hitchman
a15448d65e gc: improve unsafe.Pointer type-check error messages
Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
2012-01-06 14:34:16 -08:00
Robert Griesemer
e36acdfb56 sort: eliminate extra Len() call
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5521052
2012-01-05 18:40:17 -08:00
Robert Hencke
a3baccefd6 various: fix prints
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5516049
2012-01-05 18:38:01 -08:00
Andrew Gerrand
2c459f14e9 goinstall: fix test data
R=gri
CC=golang-dev
https://golang.org/cl/5519048
2012-01-06 09:48:03 +11:00
Eric Eisner
fd1322828c cmd/go: Pass arguments to command for run
Command arguments are separated from input .go file arguments
by a -- separator.

R=rsc, golang-dev, adg
CC=golang-dev
https://golang.org/cl/5514046
2012-01-06 09:23:00 +11:00
Andrew Gerrand
c2ea412296 goinstall: use correct checkout URL for Google Code svn repos
Fixes #2655.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5510045
2012-01-06 09:20:59 +11:00
Roger Peppe
5f5a7eb4bc go test: don't try to print package with error message.
If there's a error compiling a _test.go file, the error
message tries to print a *Package with %s. There's no String
method on *Package, so the error message looks bad.
Since the error messages identify the file in question
anyway, this CL removes the package from the error message.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5520045
2012-01-05 13:19:25 -08:00
Charles L. Dorian
149d3f06d8 math: fix typo in all_test.go
Logb errors were reported as Ilogb errors.

R=rsc, golang-dev, gri
CC=golang-dev
https://golang.org/cl/5517045
2012-01-05 11:04:14 -08:00
Mikio Hara
bab56ecb4d net: fix incorrect mode on ListenIP, ListenUDP
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5523044
2012-01-05 09:44:25 -08:00
Jeff R. Allen
c581ec4918 crypto/tls: Improve TLS Client Authentication
Fix incorrect marshal/unmarshal of certificateRequest.
Add support for configuring client-auth on the server side.
Fix the certificate selection in the client side.
Update generate_cert.go to new time package

Fixes #2521.

R=krautz, agl, bradfitz
CC=golang-dev, mikkel
https://golang.org/cl/5448093
2012-01-05 12:05:38 -05:00
Andrew Gerrand
2469a817ba net: update DialIP comments to mention protocols
Fixes #2637.

R=golang-dev, mikioh.mikioh, iant
CC=golang-dev
https://golang.org/cl/5508043
2012-01-05 15:18:08 +11:00
Alex Brainman
b682da32b3 make.bash: remove old dregs
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5522043
2012-01-05 14:17:32 +11:00
Sanjay Menakuru
2693232f16 cmd/go: include external test files in the files sent to gofmt, govet, and gofix
Also, add XTestGoFiles to the go command's public api.

Fixes #2649.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5502102
2012-01-05 10:37:15 +11:00
Robert Griesemer
3f1eb94ef2 runtime: fix typo in comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5511047
2012-01-04 14:06:54 -08:00
Adam Langley
d5e6b8d016 crypto/tls: update generate_cert.go for new time package
Fixes #2635.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5512043
2012-01-04 14:56:16 -05:00
Dave Cheney
424f53fa0c exp/ssh: fix two flow control bugs in chanWriter
This CL fixes two issues sending data to the remote peer.
The first bug occurs when the size of the buffer passed to
Write is larger than the current window, in this case, w.rwin
can become negative.

The second issue is more problematic than the first as the
amount of data passed to writePacket was not limited to w.rwin.
In this case the remote peer could silently drop the additional
data, or drop the connection.

Credit to Jacek Masiulaniec for the bug report.

R=agl, jacek.masiulaniec
CC=golang-dev
https://golang.org/cl/5511043
2012-01-04 10:36:21 -05:00
Andrew Gerrand
9d92676f63 unsafe: refer to correct reflect functions
Fixes #2641.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5509043
2012-01-04 17:14:56 +11:00
Andrew Balholm
99fed2be27 html: parse <frameset> inside body
Pass tests6.dat, test 47:
<param><frameset></frameset>

| <html>
|   <head>
|   <frameset>

Also pass remaining tests in tests6.dat.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5489136
2012-01-04 09:51:15 +11:00
Sanjay Menakuru
7ccd505dc4 cmd/go: include test files in the files sent to gofmt, govet, and gofix
Also, add TestGoFiles to the go command's public api.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5505083
2012-01-03 14:12:54 +11:00
Evan Shaw
c20c09251c encoding/json: don't marshal special float values
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5500084
2012-01-03 12:30:18 +11:00
Michael Shields
38ff98b4c6 encoding/xml: use strings.Reader in tests.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5502083
2012-01-03 12:22:02 +11:00
Christoph Hack
a274798d6e cmd/go: refer to the right command in the doc description.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5501072
2012-01-03 12:06:12 +11:00
Benny Siegert
8e9e75f008 gotest: make _testmain.go conform to gofmt rules
Otherwise, running "gofmt -d ." after "gotest" gives some
spurious changes.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5504101
2012-01-03 12:00:39 +11:00
Dave Cheney
7f20bcbbcb exp/ssh: various small fixes
transport.go:
* remove unused nil check.

doc.go:
* improve documentation about supported auth
methods and update Run example.

Thanks Jacek Masiulaniec for both reports.

R=jacek.masiulaniec, agl
CC=golang-dev
https://golang.org/cl/5501075
2011-12-27 09:49:19 -05:00
Rob Pike
6a88f1c4cb bytes.Buffer: read of 0 bytes at EOF shouldn't be an EOF
This corner case arose doing an RPC with a empty-slice payload. Ouch.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5505073
2011-12-26 23:49:24 -08:00
Vadim Vygonets
f71c03af90 log/syslog: add Alert method
Alert logs a message using the LOG_ALERT priority.

Fixes #2325.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/5504058
2011-12-26 09:34:27 +09:00
David Symonds
98b90475ac flag: change Set method Value interface to return error instead of bool.
This yields much better error messages when a bad flag value is given.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5498078
2011-12-25 16:12:26 +11:00
David Symonds
57c9bb4a07 testing: use flag.Duration for -timeout flag.
R=golang-dev, gustavo, r
CC=golang-dev
https://golang.org/cl/5498077
2011-12-25 16:07:05 +11:00
Nigel Tao
d5e45e3a8a html: adjust foreign attributes.
Pass tests10.dat, test 22:
<!DOCTYPE html><body xlink:href=foo><svg xlink:href=foo></svg>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     xlink:href="foo"
|     <svg svg>
|       xlink href="foo"

Also pass tests through test 29:
<div><svg><path></svg><path>

R=andybalholm
CC=golang-dev
https://golang.org/cl/5489117
2011-12-25 12:42:47 +11:00
Andrew Balholm
b28f017537 html: "in select in table" insertion mode.
Pass tests10.dat, test 16:
<!DOCTYPE
html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|           <td>
|             <select>
|               "foobarbaz"
|     <p>
|       "quux"

Also pass tests through test 21:
<!DOCTYPE html><frameset></frameset><svg><g></g><g></g><p><span>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5505069
2011-12-24 11:07:14 +11:00
Marcel van Lohuizen
cadbd3ea49 exp/norm: fixed two unrelated bugs in normalization library.
1) incorrect length given for out buffer in String.
2) patchTail bug that could cause characters to be lost
   when crossing into the out-buffer boundary.

Added tests to expose these bugs.  Also slightly improved
performance of Bytes() and String() by sharing the reorderBuffer
across operations.

Fixes #2567.

R=r
CC=golang-dev
https://golang.org/cl/5502069
2011-12-23 18:21:26 +01:00
Robert Hencke
335c5db76a net/rpc: trivial test cleanup
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5498066
2011-12-23 22:01:46 +09:00
David Symonds
cf506f6eac flag: add Duration flag type.
This works in the expected way: flag.Duration returns a *time.Duration,
and uses time.ParseDuration for parsing the input.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5489113
2011-12-23 16:29:38 +11:00
David Symonds
f298d0ce29 time: add ParseDuration.
R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5489111
2011-12-23 16:28:56 +11:00
Russ Cox
eef7184046 cmd/go: two testing fixes
1. Show passing output for "go test" (no args) and with -v flag.
2. Warn about out-of-date packages being rebuilt.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5504080
2011-12-22 22:24:43 -05:00
Russ Cox
3800b14071 runtime: delete old asm_*.h if still around
Fixes bug Robert ran into.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5501070
2011-12-22 22:24:34 -05:00
Andrew Gerrand
e8ae29588d cmd/go: update "go help remote" to use correct Google Code urls
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5489114
2011-12-23 14:09:44 +11:00
Alex Brainman
5962ef2c00 path/filepath: implement Base and Dir for windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5501069
2011-12-23 13:23:07 +11:00
Rob Pike
416afcb411 testing: add wrapper methods so the godoc output lists all methods
To be deleted when godoc catches up.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5504079
2011-12-22 17:17:19 -08:00
Andrew Balholm
4a8ea4ae94 html: Don't ignore whitespace in "after after frameset" mode.
Pass tests6.dat, test 46:
<html><frameset></frameset></html>

| <html>
|   <head>
|   <frameset>
|   " "

R=nigeltao
CC=golang-dev
https://golang.org/cl/5505065
2011-12-23 11:07:11 +11:00
Robert Griesemer
fcd877ea8a fix build: correct build scripts
R=r
CC=golang-dev
https://golang.org/cl/5498075
2011-12-22 15:52:33 -08:00
Robert Griesemer
dea9f417d2 fix build: updated build scripts
R=golang-dev
CC=golang-dev
https://golang.org/cl/5504078
2011-12-22 15:37:09 -08:00
Robert Griesemer
198936f2b8 go/doc, godoc: move export filtering into go/doc
- exports.go contains a stripped-down (but semantically unchanged)
  version of the code in go/ast/filter.go for export filtering
- filter.go contains the documentation filtering code found before
  at the end of doc.go; this is simply a code move w/o any semantic
  changes
- godoc now relies on go/doc for export filtering when creating
  documentation. It still has a separate form of export filtering
  for showing the source code version. This needs to be consolidated
  (perhaps the source form view should just be removed?).
- Stripping of function bodies (stripFunctionBodies function of
  godoc.go) is now happening in doc.go (line 176).
- doc.NewPackageDoc has an extra parameter "exportsOnly. If set
  to false, the behavior is as before. This function is only called
  once in our source code; a gofix module is probably not warranted.
- Deleted doc.NewFileDoc - was never called.

This change is mostly a code move w/ some minimal tweaks. It should
not cause any changes to the behavior of godoc. It's a prerequisite
for extracting anonymous embedded fields.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5502072
2011-12-22 15:28:15 -08:00
Rob Pike
07db252222 fmt: make the malloc test check its counts
Discover than %g is now down to 1 malloc from 2 from 4.
Have fun with funcs.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5504077
2011-12-22 15:16:06 -08:00
Alex Brainman
102c1a7c96 go/build: (*Tree).BinDir should not return path with / in it on windows
R=rsc
CC=golang-dev
https://golang.org/cl/5502064
2011-12-23 09:46:30 +11:00
Rémy Oudompheng
2afebbdf35 strconv: fix bug in extended-float based conversion.
A test intended for denormals erroneously returned true also for
infinities, leading to bad overflows and wrong error estimates.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5489091
2011-12-22 17:28:35 -05:00
Robert Griesemer
fc78c5aa00 math/big: Rand shouldn't hang if argument is also receiver.
Fixes #2607.

R=rsc
CC=golang-dev
https://golang.org/cl/5489109
2011-12-22 14:15:41 -08:00
Rob Pike
b6122b0a64 path: Dir
There was Base but not Dir, so fill in the gap.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5504076
2011-12-22 14:08:34 -08:00
Robert Griesemer
c0589a21c9 go/doc: s/typeDoc/typeInfo/
To avoid confusion between typeDoc and TypeDoc.
No semantic change.

R=r
CC=golang-dev
https://golang.org/cl/5502071
2011-12-22 14:00:52 -08:00
Rob Pike
dd1a34bdae path/filepath: Dir
There was Base but not Dir, so fill in the gap.

R=n13m3y3r, r, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5503067
2011-12-22 13:58:58 -08:00
Robert Griesemer
7ea92ddd66 go/doc, godoc: show methods of anonymous fields
Missing: Handling of embedded interfaces.

Also, for reasons outlined in the previous CL (5500055), embedded
types have to be exported for its "inherited" methods to be visible.
This will be addressed w/ a subsequent CL.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5502059
2011-12-22 13:11:40 -08:00
Rob Pike
b1a287e3a1 testing: fix the fix to the wording about the bug
TBR=rsc

R=rsc
CC=golang-dev
https://golang.org/cl/5498070
2011-12-22 11:23:10 -08:00
Rob Pike
34139ee155 testing: fix wording in explanation of potential bug
TBR=rsc

R=rsc
CC=golang-dev
https://golang.org/cl/5504075
2011-12-22 11:08:51 -08:00
Rob Pike
66155134a7 testing: make signalling safer for parallel tests
Each test gets a private signal channel.
Also fix a bug that prevented parallel tests from running.

R=r, r
CC=golang-dev
https://golang.org/cl/5505061
2011-12-22 10:43:54 -08:00
Robert Hencke
b5216e2e55 testing: compare Log to Println
Log always adds spaces between operands, like Println but unlike Print

R=golang-dev
CC=golang-dev
https://golang.org/cl/5504069
2011-12-22 10:05:51 -08:00
Luuk van Dijk
86deacc0bc gc: better linenumbers for inlined functions
Fixes #2580 up to a point.

R=rsc
CC=golang-dev
https://golang.org/cl/5498068
2011-12-22 17:31:54 +01:00
Adam Langley
7350c771f8 exp/terminal: several cleanups
1) Add EscapeCodes to the terminal so that applications don't wire
   them in.
2) Add a callback for auto-complete
3) Fix an issue with input lines longer than the width of the
   terminal.
4) Have Write() not stomp the current line. It now erases the current
   input, writes the output and reprints the prompt and partial input.
5) Support prompting without local echo in Terminal.
6) Add GetSize to report the size of terminal.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5479043
2011-12-22 11:23:57 -05:00
Joel Sing
f1ebbf80bd syscall: make pipe work on netbsd
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5504070
2011-12-23 02:47:48 +11:00
Brad Fitzpatrick
a626adce1e os: update package location of exec to os/exec in comments
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5503065
2011-12-22 07:25:43 -08:00
Mikio Hara
98fe44bdfc cmd/go: fix windows build
R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5502066
2011-12-23 00:14:59 +09:00
Mikio Hara
e636f6f51c cmd/gc: make sure use of pthread for gcc-4.5 and beyond
R=golang-dev, rsc, n13m3y3r, rogpeppe
CC=golang-dev
https://golang.org/cl/5501060
2011-12-22 23:18:34 +09:00
Joel Sing
43bc8a9b53 syscall: make getdirentries work on netbsd
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5504068
2011-12-22 23:42:43 +11:00
Brad Fitzpatrick
90d56e072f exec: disable the ExtraFiles test on darwin
Still a mystery. New issue 2603 filed.

R=golang-dev, dsymonds, iant
CC=golang-dev
https://golang.org/cl/5503063
2011-12-21 17:08:16 -08:00
Ian Lance Taylor
5690ddc7fa runtime: don't panic on SIGILL, just crash
R=rsc
CC=golang-dev
https://golang.org/cl/5504067
2011-12-21 15:45:36 -08:00
Russ Cox
fa02bac809 os/exec: put the print where it will help
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5501058
2011-12-21 17:49:29 -05:00
Russ Cox
914ab8a23f os/exec: dump lsof on failure
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5504063
2011-12-21 17:17:28 -05:00
Robert Griesemer
89c7e206d1 godoc: fix crash
R=iant, rsc
CC=golang-dev
https://golang.org/cl/5500065
2011-12-21 13:55:47 -08:00
Andrew Gerrand
f2c9d22850 os/exec: enable inherited file descriptor test
Fixes #2596.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5498061
2011-12-22 08:50:56 +11:00
Russ Cox
5e5592cf30 os/user: not on windows
R=golang-dev
CC=golang-dev
https://golang.org/cl/5498062
2011-12-21 16:35:31 -05:00
Russ Cox
a9b92013d2 buildscript: make script safer, same output on Windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5502062
2011-12-21 15:58:05 -05:00
Russ Cox
0509727b0d build: fixes for Windows
* work around a linker/cgo bug
* do not run deps.bash on Windows unless we need it
  (cuts a full minute off the build time)
* add windows to the list of cgo-enabled targets

The gopack problem is issue 2601.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5504062
2011-12-21 15:57:47 -05:00
Rob Pike
18f7c0a3f6 path/filepath.Rel: document that the returned path is always relative
Fixes #2593.

R=rsc, alex.brainman, n13m3y3r
CC=golang-dev
https://golang.org/cl/5500052
2011-12-21 11:46:42 -08:00
Brad Fitzpatrick
71f0fb7760 crypto/x509: don't crash with nil receiver in accessor method
Fixes #2600

R=golang-dev, agl, rsc
CC=golang-dev
https://golang.org/cl/5500064
2011-12-21 10:49:35 -08:00
Robert Griesemer
97853b46a0 go/doc: steps towards collecting methods of embedded types
No visible external changes yet. The current approach is
a stop-gap approach: For methods of anonymous fields to be
seen, the anonymous field's types must be exported.

Missing: computing the actual MethodDocs and displaying them.

(Depending on the operation mode of godoc, the input to go/doc
is a pre-filtered AST with all non-exported nodes removed. Non-
exported anonymous fields are not even seen by go/doc in this
case, and it is impossible to collect associated (even exported)
methods. A correct fix will require some more significant re-
engineering; AST filtering will have to happen later, possibly
inside go/doc.)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5500055
2011-12-21 08:45:00 -08:00
Russ Cox
721e19c24c os/user: fix for arm (non-cgo)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5504056
2011-12-21 10:17:37 -05:00
Russ Cox
25c8014ed9 cmd/go: respect $GCFLAGS
R=lvd
CC=golang-dev
https://golang.org/cl/5500060
2011-12-21 09:04:34 -05:00
Russ Cox
f52a2088ef go/build: add new +build tags 'cgo' and 'nocgo'
This lets us mark net's cgo_stub.go as only to be
built when cgo is disabled.

R=golang-dev, ality, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5489100
2011-12-21 08:51:18 -05:00
Roger Peppe
43b8f68c3f cmd/go: use spaces consistently in help message
R=rsc
CC=golang-dev
https://golang.org/cl/5501053
2011-12-21 08:25:31 -05:00
Russ Cox
8feab4d5f7 os/signal: not on windows
R=golang-dev
CC=golang-dev
https://golang.org/cl/5500061
2011-12-21 08:20:25 -05:00
Russ Cox
0fcb24b91c cmd/go: fix build (piece of 5489100 leaked in to last checkin)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5489102
2011-12-21 08:05:04 -05:00
Anthony Martin
6645602c0b os/signal: do not build on Plan 9
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5503057
2011-12-21 07:52:07 -05:00
Russ Cox
8f5f347e2c cmd/go: many improvements
* correct dependency calculations
* comment meaning of action fields
* new alias "std" like "all" but standard packages only
* add -o flag to 'go build'
* set up for parallel build (still serial)
* understand that import "C" depends on cgo, runtime/cgo

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5502055
2011-12-21 07:47:12 -05:00
Mikio Hara
836105679e net, syscall: interface address and mask
This CL makes both InterfaceAddrs and Addrs method on Interface
return IPNet struct for representing interface address and mask
like below:

interface "lo0": flags "up|loopback|multicast", ifindex 1, mtu 16384
        interface address "fe80::1/64"
        interface address "127.0.0.1/8"
        interface address "::1/128"
        joined group address "ff02::fb"
        joined group address "224.0.0.251"
        joined group address "ff02::2:65d0:d71e"
        joined group address "224.0.0.1"
 	joined group address "ff01::1"
        joined group address "ff02::1"
        joined group address "ff02::1:ff00:1"

Fixes #2571.

R=rsc
CC=golang-dev
https://golang.org/cl/5489062
2011-12-21 21:39:00 +09:00
Russ Cox
3435438948 runtime: silence darwin/386 build warnings
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5502056
2011-12-21 07:23:03 -05:00
Mikio Hara
16a2d2617f cmd/go: avoid infinite loop with package specific flags
R=rsc
CC=golang-dev
https://golang.org/cl/5505053
2011-12-21 21:20:17 +09:00
Joel Sing
9ca57a706c crypto/mime/net/time: add netbsd to +build tags
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5501052
2011-12-21 21:44:47 +11:00
Russ Cox
efa2246e42 build: rewrite to use bash time builtin
Should help windows/amd64

R=adg
CC=golang-dev
https://golang.org/cl/5500058
2011-12-21 01:24:57 -05:00
Alex Brainman
a462816753 build: multiple fixes to make "go install" work on windows
R=rsc
CC=golang-dev
https://golang.org/cl/5502054
2011-12-21 16:57:44 +11:00
Mikio Hara
6709330488 build: make use of env
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5504053
2011-12-21 11:11:55 +09:00
Russ Cox
a63262b6c0 build: fix for freebsd, openbsd
TBR=r
CC=golang-dev
https://golang.org/cl/5505052
2011-12-20 20:37:58 -05:00
Brad Fitzpatrick
1dfe3d1f6e os: don't trust O_CLOEXEC on OS X
OS X 10.6 doesn't do O_CLOEXEC.
OS X 10.7 does.

For now, always fall back to using syscall.CloseOnExec on darwin.

This can removed when 10.6 is old news, or if we find a
way to cheaply & reliably detect 10.6 vs 10.7 at runtime.

Fixes #2587

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/5500053
2011-12-20 15:41:37 -08:00
Brad Fitzpatrick
0735e06cfd build: fix the build with USE_GO_TOOL=false
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5502051
2011-12-20 15:30:36 -08:00
Nigel Tao
d13ce8115d image/ycbcr: move the Y'CbCr types into image and image/color.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5493084
2011-12-21 10:29:21 +11:00
Nigel Tao
fe28d1aacf html: handle breakout tags in foreign content.
Also recognize that, in the latest version of the HTML5 spec,
foreign content is not an insertion mode, but a separate concern.

Pass tests10.dat, test 13:
<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g><p>baz</table><p>quux

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <table>
|       <caption>
|         <svg svg>
|           <svg g>
|             "foo"
|           <svg g>
|             "bar"
|         <p>
|           "baz"
|     <p>
|       "quux"

Also pass tests through test 15:
<!DOCTYPE html><body><table><colgroup><svg><g>foo</g><g>bar</g><p>baz</table><p>quux

R=andybalholm
CC=golang-dev
https://golang.org/cl/5494078
2011-12-21 10:00:41 +11:00
Russ Cox
e83cd7f750 build: a round of fixes
TBR=r
CC=golang-dev
https://golang.org/cl/5503052
2011-12-20 17:54:40 -05:00
Brad Fitzpatrick
01507b9ad1 net: fix Windows build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5505048
2011-12-20 14:32:33 -08:00
Russ Cox
c037d3f254 build: fix on Linux
On other systems the temporary directory name
will have a .XXXXXX in the middle of it.  Oh well.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5504049
2011-12-20 17:11:16 -05:00
Russ Cox
ac3028f0a9 build: fix build
Missing file during last CL.

TBR=r
CC=golang-dev
https://golang.org/cl/5505047
2011-12-20 17:00:52 -05:00
Russ Cox
41a6165c03 build: use go command during build
If something goes wrong, it should suffice to set
USE_GO_TOOL=false in env.bash to fall back to the
makefiles.  I will delete the makefiles in January.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5502047
2011-12-20 16:50:13 -05:00
Russ Cox
fd1c1b9679 cmd/go: work toward build script
The commands in the standard tree are now named
by the pseudo-import paths cmd/gofmt etc.
This avoids ambiguity between cmd/go's directory
and go/token's parent directory.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5503050
2011-12-20 16:42:44 -05:00
Russ Cox
82a6a4f39e gc: allow use of unsafe.Pointer in generated code
The functions we generate to implement == on structs
or arrays may need to refer to unsafe.Pointer even in
safe mode, in order to handle unexported fields contained
in other packages' structs.

R=ken2
CC=golang-dev
https://golang.org/cl/5505046
2011-12-20 16:25:57 -05:00
Brad Fitzpatrick
964309e2fd net: DialTimeout
Fixes #240

R=adg, dsymonds, rsc, r, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5491062
2011-12-20 13:17:39 -08:00
Rob Pike
4869996b92 template: better error message for empty templates
New("x").ParseFiles("y") can result in an empty "x" template.
Make the message clearer that this is the problem. The error
returns from both template packages in this case were
confusing.

I considered making the method use "x" instead of "y" in
this case, but that just made other situations confusing
and harder to explain.

Fixes #2594.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5498048
2011-12-20 12:58:23 -08:00
Russ Cox
5d429ad013 runtime/cgo: fix build
Two forgotten renames from last CL.

TBR=r
CC=golang-dev
https://golang.org/cl/5502046
2011-12-20 14:42:58 -05:00
Russ Cox
54fb9940cf go: build runtime/cgo
Also rename -v to -x in the build and install commands,
to match the flag in go test (which we can't change
because -v is taken).  Matches sh -x anyway.

R=r, iant, ality
CC=golang-dev
https://golang.org/cl/5504045
2011-12-20 14:25:23 -05:00
Rob Pike
6b772462e4 panics: use the new facilities of testing.B instead
Lots of panics go away.
Also fix a name error in html/template.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5498045
2011-12-20 10:36:25 -08:00
Robert Griesemer
b9697d4a58 go/ast, parser: remember short variable decls. w/ correspoding ident objects
The ast.Object's Decl field pointed back to the corresponding declaration for
all but short variable declarations. Now remember corresponding assignment
statement in the Decl field.

Also: simplified some code for parsing select statements.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5492072
2011-12-20 09:59:09 -08:00
Rob Pike
c50e4f5e2f testing: allow benchmarks to print and fail
Refactors the benchmarks and test code.
Now benchmarks can call Errorf, Fail, etc.,
and the runner will act accordingly.

Because functionality has been folded into an
embedded type, a number of methods' docs
no longer appear in godoc output. A fix is
underway; if it doesn't happen fast enough,
I'll add wrapper methods to restore the
documentation.

R=bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5492060
2011-12-20 09:51:39 -08:00
Maxim Pimenov
7be6229f9f cgo: support export for built-in types
This change doesn't pay attention to structs
so they still cannot be exported, see Issue 2552.

Fixes #2462.

R=dvyukov, rsc, iant
CC=golang-dev
https://golang.org/cl/5487058
2011-12-20 09:28:45 -08:00
Roger Peppe
16bf7d9e82 encoding/binary: add more benchmarks
Also add a byte count to the varint benchmarks - this
isn't accurate, of course, but it allows a rough comparison to
the other benchmarks.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496070
2011-12-20 09:25:47 -08:00
Robert Hencke
317ad14c6a time: JSON marshaler for Time
R=golang-dev, dsymonds, hectorchu, r, r
CC=golang-dev
https://golang.org/cl/5496064
2011-12-20 09:01:18 -08:00
Russ Cox
a1198fcc03 go: build runtime
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5495068
2011-12-20 10:28:04 -05:00
Ian Lance Taylor
b49625663e syscall: remove unnecessary semicolon from mksyscall.pl
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5495098
2011-12-19 20:57:59 -08:00
Ian Lance Taylor
36397814cc strconv: remove obsolete comment.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5490078
2011-12-19 20:57:32 -08:00
Ian Lance Taylor
21af3d86cd runtime: correct '.' to '·' in comments
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495097
2011-12-19 20:56:37 -08:00
Andrew Gerrand
7bffdc7247 encoding/binary: add Write and Read examples
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5495095
2011-12-20 13:16:36 +11:00
Joel Sing
5842f7e46a 5l/6l/8l: add support for netbsd signature note section
R=m4dh4tt3r, jsing, rsc
CC=golang-dev
https://golang.org/cl/5493068
2011-12-20 12:25:06 +11:00
Alex Brainman
b7e9d22528 net/http: test should not leave tmp files behind on windows
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5496067
2011-12-20 11:53:24 +11:00
Alex Brainman
796a2c19ea os: make sure Remove returns correct error on windows
R=golang-dev, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/5493078
2011-12-20 11:52:20 +11:00
Alex Brainman
448d89d67a old/template: close file in TestAll before deleting it
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5491073
2011-12-20 11:51:31 +11:00
Andrew Balholm
a0bd46e70f html: ignore <caption>, <col>, <tbody> etc. when parsing table fragments
Pass tests6.dat, test 36:
<caption><col><colgroup><tbody><tfoot><thead><tr>

| <tr>

Pass tests through test 44:
<body></body></html>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5494055
2011-12-20 10:57:06 +11:00
Brad Fitzpatrick
315b361f89 zip: fix data race in test
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5492073
2011-12-19 15:40:10 -08:00
Mikio Hara
d2933e9902 syscall: regenerate z-files for linux/arm
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5496062
2011-12-20 07:42:00 +09:00
Ian Lance Taylor
355ed5da82 exec: disable new test to fix build
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/5494075
2011-12-19 14:09:12 -08:00
Rémy Oudompheng
2368b003e0 strconv: implement faster parsing of decimal numbers.
The algorithm is the same as in the double-conversion library
which also implements Florian Loitsch's fast printing algorithm.
It uses extended floats with a 64-bit mantissa, but cannot give
an answer for all cases.

                           old ns/op  new ns/op  speedup
BenchmarkAtof64Decimal         332        322      1.0x
BenchmarkAtof64Float           385        373      1.0x
BenchmarkAtof64FloatExp       9777        419     23.3x
BenchmarkAtof64Big            3934        691      5.7x
BenchmarkAtof64RandomBits    34060        899     37.9x
BenchmarkAtof64RandomFloats   1329        680      2.0x

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

R=ality, rsc
CC=golang-dev, remy
https://golang.org/cl/5494068
2011-12-19 16:45:51 -05:00
Ian Lance Taylor
384329592a net, syscall, os: set CLOEXEC flag on epoll/kqueue descriptor
Enable new test in os.

R=dave, iant, rsc
CC=golang-dev
https://golang.org/cl/5494061
2011-12-19 12:57:49 -08:00
Russ Cox
1d0f93b4be gc: avoid unsafe in defn of package runtime
Keeps -u tracking simple.

R=ken2
CC=golang-dev
https://golang.org/cl/5495094
2011-12-19 15:52:15 -05:00
Russ Cox
55889409f8 runtime: separate out auto-generated files, take 2
This is like the ill-fated CL 5493063 except that
I have written a shell script (autogen.sh) instead of
thinking I could possibly write a correct Makefile.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496075
2011-12-19 15:51:13 -05:00
Rémy Oudompheng
4a4c39e7d4 encoding/json: cleanup leftover variables in array decoding.
An old update for API changes in reflect package left several
helper variables that do not have a meaning anymore, and
the type checking of arrays vs slices was broken.
Fixes #2513.

R=ultrotter, rsc
CC=golang-dev, remy
https://golang.org/cl/5488094
2011-12-19 15:32:06 -05:00
Rémy Oudompheng
3a2dec0246 strconv: reduce buffer size for multi-precision decimals.
The longest numbers we have to represent are the smallest denormals.
Their decimal mantissa is not longer than 5^1100. Taking into
account some extra size for in-place operations, 800 digits are
enough. This saves time used for zero intiialization of extra
bytes.

                                        old ns/op  new ns/op    delta
strconv_test.BenchmarkAtof64Decimal           521        334   -35.9%
strconv_test.BenchmarkAtof64Float             572        391   -31.6%
strconv_test.BenchmarkAtof64FloatExp        10242      10036    -2.0%
strconv_test.BenchmarkAtof64Big              4229       4029    -4.7%
strconv_test.BenchmarkFormatFloatDecimal     1396        934   -33.1%
strconv_test.BenchmarkFormatFloat            4295       3341   -22.2%
strconv_test.BenchmarkFormatFloatExp        12035      11181    -7.1%
strconv_test.BenchmarkFormatFloatBig         4213       3229   -23.4%
strconv_test.BenchmarkAppendFloatDecimal     1031        600   -41.8%
strconv_test.BenchmarkAppendFloat            3971       3044   -23.3%
strconv_test.BenchmarkAppendFloatExp        11699      11003    -5.9%
strconv_test.BenchmarkAppendFloatBig         3836       2915   -24.0%

R=golang-dev, bradfitz, rsc
CC=golang-dev, remy
https://golang.org/cl/5491064
2011-12-19 15:03:53 -05:00
Brad Fitzpatrick
178be83e0e exec: add test to verify net package's epoll fd doesn't go to child
R=rsc
CC=golang-dev
https://golang.org/cl/5490075
2011-12-19 09:23:07 -08:00
Christopher Nielsen
5425db8f99 syscall: Changes to the syscall package to support NetBSD.
Not all syscalls are implemented, but many are. On the suggestion
of Joel Sing <jsing@google.com>, the generated files were added
with hg add instead of hg cp, since they are generated on an OS
dependant basis.

R=golang-dev, jsing, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5491050
2011-12-20 03:57:58 +11:00
Adam Langley
2ca4a61658 crypto/tls: don't assume an RSA private key in the API.
We still very much assume it in the code, but with this change in
place we can implement other things later without changing and users
of the package.

Fixes #2319.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5489073
2011-12-19 10:39:30 -05:00
Alex Brainman
10e43384f3 net/http: test both texta and textb values, not texta twice
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5489082
2011-12-19 17:31:20 +11:00
Alex Brainman
c4227f5bb0 io/ioutil: close file in TestWriteFile before deleting it
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5495086
2011-12-19 17:30:14 +11:00
Andrew Gerrand
0b28de9a05 archive/zip: add SetModTime method to FileHeader
Fixes #2574.

R=golang-dev, bradfitz, adg, bradfitz
CC=golang-dev
https://golang.org/cl/5494072
2011-12-19 14:59:41 +11:00
Nigel Tao
18e8441476 html: handle text nodes in foreign content.
Passes tests10.dat, test 6:
<!DOCTYPE html><body><table><svg><g>foo</g></svg></table>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <svg svg>
|       <svg g>
|         "foo"
|     <table>

Also pass tests through test 12:
<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g></svg><p>baz</caption></table>

R=andybalholm
CC=golang-dev
https://golang.org/cl/5495061
2011-12-19 12:20:00 +11:00
Andrew Gerrand
5ede9df5a0 encoding/json: examples for Marshal and Unmarshal
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5493075
2011-12-19 11:16:55 +11:00
Gustavo Niemeyer
12f473f807 text/template: fix handing of nil arguments to functions
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5494070
2011-12-18 22:14:11 -02:00
Christopher Nielsen
5030177ea3 os: Add NetBSD support for recent signal changes.
Add NetBSD to mksignals.sh and generate files.
While we're here, also add netbsd to the +build list where appropriate.

R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5492064
2011-12-18 02:29:18 +11:00
Rob Pike
13b26cb36a runtime: use correct traceback file on arm
reported by fred richter

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5494062
2011-12-16 22:52:02 -08:00
Andrew Gerrand
76a0783321 goinstall: only suggest -fix for bad imports when appropriate
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495073
2011-12-17 13:14:59 +11:00
Andrew Gerrand
96a5780db8 go/build: remove 'go/build' from error messages
This leads to really confusing messages in goinstall.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495074
2011-12-17 13:14:18 +11:00
Russ Cox
86dcc431e9 runtime: hg revert -r 6ec0a5c12d75
That was the last build that was close to working.
I will try that change again next week.
Make is being very subtle today.

At the reverted-to CL, the ARM traceback appears
to be broken.  I'll look into that next week too.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5492063
2011-12-16 18:50:40 -05:00
Robert Griesemer
541b67d051 go/printer, gofmt: fine tuning of line spacing
- no empty lines inside empty structs and interfaces
- top-level declarations are separated by a blank line if
  a) they are of different kind (e.g. const vs type); or
  b) there are documentation comments associated with a
     declaration (this is new)
- applied gofmt -w misc src

The actual changes are in go/printer/nodes.go:397-400 (empty structs/interfaces),
and go/printer/printer.go:307-309 (extra line break). The remaining
changes are cleanups w/o changing the existing functionality.

Fixes issue  2570.

R=rsc
CC=golang-dev
https://golang.org/cl/5493057
2011-12-16 15:43:06 -08:00
Russ Cox
72bdd86835 runtime: fix build on gri's machine
Why it was not failing anywhere else I don't know,
but the Makefile was definitely wrong.  The rules
must not run in parallel.

TBR=r
CC=golang-dev
https://golang.org/cl/5489069
2011-12-16 18:31:09 -05:00
Russ Cox
cfd17a1b57 runtime: fix build
I am looking forward to not supporting two build
systems simultaneously.  Make complains about
a circular dependency still, but I don't understand it
and it's probably not worth the time to figure out.

TBR=r
CC=golang-dev
https://golang.org/cl/5496058
2011-12-16 17:58:53 -05:00
Olivier Duperray
32734f4664 websocket: fix a trivial example server
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5491063
2011-12-16 14:24:37 -08:00
Russ Cox
bd9243da22 runtime: separate out auto-generated files
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5493063
2011-12-16 17:04:32 -05:00
Russ Cox
95907c4752 runtime: fix build
TBR=r
CC=golang-dev
https://golang.org/cl/5493061
2011-12-16 15:46:25 -05:00
Russ Cox
851f30136d runtime: make more build-friendly
Collapse the arch,os-specific directories into the main directory
by renaming xxx/foo.c to foo_xxx.c, and so on.

There are no substantial edits here, except to the Makefile.
The assumption is that the Go tool will #define GOOS_darwin
and GOARCH_amd64 and will make any file named something
like signals_darwin.h available as signals_GOOS.h during the
build.  This replaces what used to be done with -I$(GOOS).

There is still work to be done to make runtime build with
standard tools, but this is a big step.  After this we will have
to write a script to generate all the generated files so they
can be checked in (instead of generated during the build).

R=r, iant, r, lucio.dere
CC=golang-dev
https://golang.org/cl/5490053
2011-12-16 15:33:58 -05:00
Rob Pike
474d64d26e encoding/gob: arrays are zero only if their elements are zero
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5494059
2011-12-16 11:52:58 -08:00
Rob Pike
4fb5f5449a gob: isZero for struct values
Fixes #2577.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5492058
2011-12-16 11:33:57 -08:00
Maxim Pimenov
bf6dd2db04 various: use $GCFLAGS and $GCIMPORTS like Make does
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5489065
2011-12-16 11:31:39 -05:00
Volker Dobler
dd694fb149 net/http: Added interface for a cookie jar.
Types implementing CookieJar may be used in a Client
to persist cookies.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5399043
2011-12-16 10:48:41 -05:00
Mikio Hara
055b4f7ea0 syscall: sort Makefile, mkall.sh and mkerrors.sh entries
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5495062
2011-12-16 19:51:25 +09:00
Mikio Hara
ecc317647b net: sort Makefile entries
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5493058
2011-12-16 19:50:55 +09:00
Alex Brainman
8fa8ebf834 go/build: make sure syslist.go is gofmted
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5490051
2011-12-16 15:52:30 +11:00
Russ Cox
20090df70f go: implement test command
Gotest tries to build things, for which it invokes make,
and it was too hard to coordinate go invoking gotest
invoking go to build the test binary, so put all the code
here instead.  Gotest will be deleted once we switch.

The only code that really made sense to copy verbatim
was the flag parsing.

This remains a work in progress.  There are still plenty
of things to clean up and make better, but this is a good
checkpoint.  It can run all the tests in the tree (except
runtime, which it can't build yet).

$ go test all -short
ok  	archive/tar
ok  	archive/zip
ok  	bufio
?   	builtin [no test files]
ok  	bytes
ok  	compress/bzip2
ok  	compress/flate
ok  	compress/gzip
ok  	compress/lzw
ok  	compress/zlib
ok  	container/heap
ok  	container/list
ok  	container/ring
?   	crypto [no test files]
ok  	crypto/aes
ok  	crypto/bcrypt
ok  	crypto/blowfish
ok  	crypto/cast5
ok  	crypto/cipher
ok  	crypto/des
ok  	crypto/dsa
ok  	crypto/ecdsa
ok  	crypto/elliptic
ok  	crypto/hmac
ok  	crypto/md4
ok  	crypto/md5
ok  	crypto/ocsp
ok  	crypto/openpgp
ok  	crypto/openpgp/armor
ok  	crypto/openpgp/elgamal
?   	crypto/openpgp/error [no test files]
ok  	crypto/openpgp/packet
ok  	crypto/openpgp/s2k
ok  	crypto/rand
ok  	crypto/rc4
ok  	crypto/ripemd160
ok  	crypto/rsa
ok  	crypto/sha1
ok  	crypto/sha256
ok  	crypto/sha512
ok  	crypto/subtle
ok  	crypto/tls
ok  	crypto/twofish
ok  	crypto/x509
?   	crypto/x509/pkix [no test files]
ok  	crypto/xtea
ok  	debug/dwarf
ok  	debug/elf
ok  	debug/gosym
ok  	debug/macho
ok  	debug/pe
ok  	encoding/ascii85
ok  	encoding/asn1
ok  	encoding/base32
ok  	encoding/base64
ok  	encoding/binary
ok  	encoding/csv
ok  	encoding/git85
ok  	encoding/gob
ok  	encoding/hex
ok  	encoding/json
ok  	encoding/pem
ok  	encoding/xml
ok  	errors
ok  	exp/ebnf
?   	exp/ebnflint [no test files]
ok  	exp/gotype
ok  	exp/norm
ok  	exp/spdy
ok  	exp/sql
ok  	exp/sql/driver
ok  	exp/ssh
ok  	exp/types
ok  	expvar
ok  	flag
ok  	fmt
ok  	go/ast
ok  	go/build
ok  	go/doc
ok  	go/parser
ok  	go/printer
ok  	go/scanner
ok  	go/token
?   	hash [no test files]
ok  	hash/adler32
ok  	hash/crc32
ok  	hash/crc64
ok  	hash/fnv
ok  	html
ok  	html/template
ok  	image
?   	image/bmp [no test files]
?   	image/color [no test files]
ok  	image/draw
?   	image/gif [no test files]
ok  	image/jpeg
ok  	image/png
ok  	image/tiff
ok  	image/ycbcr
ok  	index/suffixarray
ok  	io
ok  	io/ioutil
ok  	log
ok  	log/syslog
ok  	math
ok  	math/big
ok  	math/cmplx
ok  	math/rand
ok  	mime
ok  	mime/multipart
ok  	net
?   	net/dict [no test files]
ok  	net/http
ok  	net/http/cgi
ok  	net/http/fcgi
?   	net/http/httptest [no test files]
ok  	net/http/httputil
?   	net/http/pprof [no test files]
ok  	net/mail
ok  	net/rpc
ok  	net/rpc/jsonrpc
ok  	net/smtp
ok  	net/textproto
ok  	net/url
ok  	old/netchan
ok  	old/regexp
ok  	old/template
ok  	os
ok  	os/exec
ok  	os/signal
ok  	os/user
ok  	patch
ok  	path
ok  	path/filepath
ok  	reflect
ok  	regexp
ok  	regexp/syntax
# cd /Users/rsc/g/go/src/pkg/runtime; 6g -o /var/folders/mw/qfnx8hhd1_s9mm9wtbng0hw80000gn/T/go-build874847916/runtime_test/_obj/_go_.6 -p runtime_test -I /var/folders/mw/qfnx8hhd1_s9mm9wtbng0hw80000gn/T/go-build874847916 append_test.go chan_test.go closure_test.go gc_test.go mfinal_test.go proc_test.go sema_test.go softfloat64_test.go symtab_test.go
proc_test.go:87: undefined: runtime.Entersyscall
proc_test.go:88: undefined: runtime.Exitsyscall
proc_test.go:111: undefined: runtime.Entersyscall
proc_test.go:116: undefined: runtime.Exitsyscall
softfloat64_test.go:79: undefined: Fadd64
softfloat64_test.go:80: undefined: Fsub64
softfloat64_test.go:82: undefined: Fmul64
softfloat64_test.go:83: undefined: Fdiv64
softfloat64_test.go:94: undefined: F64to32
softfloat64_test.go:99: undefined: F32to64
softfloat64_test.go:99: too many errors

exit status 1
FAIL	runtime [build failed]
?   	runtime/cgo [no test files]
ok  	runtime/debug
ok  	runtime/pprof
ok  	sort
ok  	strconv
ok  	strings
ok  	sync
ok  	sync/atomic
?   	syscall [no test files]
?   	testing [no test files]
?   	testing/iotest [no test files]
ok  	testing/quick
ok  	testing/script
ok  	text/scanner
ok  	text/tabwriter
ok  	text/template
ok  	text/template/parse
ok  	time
ok  	unicode
ok  	unicode/utf16
ok  	unicode/utf8
?   	unsafe [no test files]
ok  	websocket
$

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495055
2011-12-15 23:51:04 -05:00
Russ Cox
0358c8957a io/ioutil: remove another reference to _test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5492051
2011-12-15 19:32:47 -05:00
Russ Cox
6699aa4aee crypto/tls: quiet build
On a Mac, all the useful functions are deprecated.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5493054
2011-12-15 18:37:31 -05:00
Alex Brainman
2da651f115 ld: allow for IMAGE_REL_AMD64_ADDR32NB relocation type
enable cgo again on windows/amd64

R=rsc, vcc.163
CC=golang-dev
https://golang.org/cl/5488074
2011-12-16 10:32:14 +11:00
Russ Cox
b53856c16d os/exec: fix -test.run argument for new 'go test'
In 'go test' I deleted the leading package. prefix
from all the test names, since it contained no actual
information.  Adjust the -test.run argument accordingly.
This will still work with the current gotest too, since
the argument is an unanchored pattern.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5491058
2011-12-15 18:21:38 -05:00
Russ Cox
f99b412813 io/ioutil, old/template: do not assume _test exists for scratch space
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496052
2011-12-15 18:21:29 -05:00
Rob Pike
197eb8f7c3 govet: add checking for printf verbs
Also fix the errors it catches.

Fixes #1654.

R=rsc
CC=golang-dev
https://golang.org/cl/5489060
2011-12-15 15:17:52 -08:00
Volker Dobler
cb7d6e37d8 godoc: Allow examples for methods.
An example for a method M() of type T can be written as
func ExampleT_M() { ... }.
To differentiate between multiple examples for one function, type or
method a suffix with a lowercase start may be appended to the name
of the example function, e.g. ExampleFoo_basicUsage.

Fixes #2465.

R=golang-dev, adg, r, rsc, duperray.olivier, r
CC=golang-dev
https://golang.org/cl/5440100
2011-12-16 10:01:54 +11:00
Andrew Gerrand
9834a25d33 testing: trim spaces before comparing example output
bytes: add two Buffer examples

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5490048
2011-12-16 09:43:58 +11:00
Nigel Tao
a369004e23 html: handle end tags in foreign objects.
I'm not 100% sure I get all the corner cases right, for end tags, but
I'll let the test suite smoke it out.

Pass tests10.dat, test 1:
<!DOCTYPE html><svg></svg><![CDATA[a]]>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <svg svg>
|     <!-- [CDATA[a]] -->

Also pass tests through test 5:
<!DOCTYPE html><body><table><svg></svg></table>

R=andybalholm
CC=golang-dev
https://golang.org/cl/5495044
2011-12-16 09:36:50 +11:00
Robert Griesemer
9f65e99ad4 go/printer, gofmt: don't write too many newlines
In some rare cases, gofmt would accept more than the maximum
number of empty lines (1) between source code snippets.

The actual change is in printer.go, lines 773-775; the rest
is some minor restructuring.

Applied gofmt -w src misc .

Fixes #2387.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496047
2011-12-15 13:51:47 -08:00
Dave Cheney
52c8107a3c exp/ssh: simplify Stdin/out/errPipe methods
If a Pipe method is called, return the underlying
reader/writer from session.clientChan, bypassing the
io.Copy and io.Pipe harness.

StdoutPipe and StderrPipe now return an io.Reader not
an io.ReadCloser as SSH cannot signal the close of the
local reader to the remote process.

R=rsc, agl, gustav.paul, cw
CC=golang-dev
https://golang.org/cl/5493047
2011-12-15 16:50:41 -05:00
Rob Pike
b618f32687 govet: divide the program into one file per vetting suite
Just a rearrangement except for a couple of new functions
and names so govet.go can have all the generic walk routines.

R=rsc
CC=golang-dev
https://golang.org/cl/5489058
2011-12-15 13:44:35 -08:00
Rob Pike
04faa08c07 fmt: speed up floating point print, clean up some code
%g down to two mallocs from four. Also a mild speedup.

fmt_test.BenchmarkSprintfFloat         3016         2703  -10.38%

Fixes #2557.

R=rsc
CC=golang-dev
https://golang.org/cl/5491054
2011-12-15 12:52:29 -08:00
Brad Fitzpatrick
29264c6f4f json: use strconv.Append variants to avoid allocations in encoding
Before/after, best of 3:
json.BenchmarkCodeEncoder  10  183495300 ns/op  10.58 MB/s
->
json.BenchmarkCodeEncoder  10  133025100 ns/op  14.59 MB/s

But don't get too excited about this.  These benchmarks, while
stable at any point of time, fluctuate wildly with any line of
code added or removed anywhere in the path due to stack splitting
issues.

It's currently much faster, though, and this is the API that
doesn't allocate so should always be faster in theory.

R=golang-dev, dsymonds, rsc, r, gri
CC=golang-dev
https://golang.org/cl/5411052
2011-12-15 11:21:21 -08:00
Russ Cox
143f3b38f5 go: help messages for 'go test'
The plan is to make 'go test' replace gotest entirely, so it
cannot refer to gotest's godoc.  Instead, copy gotest's
documentation in as three different help messages:
'go help test', 'go help testflag', and 'go help testfunc'.

R=r
CC=golang-dev
https://golang.org/cl/5491048
2011-12-15 13:54:19 -05:00
Robert Griesemer
fb6ffd8f78 go/scanner: strip CRs from raw literals
R=rsc
CC=golang-dev
https://golang.org/cl/5495049
2011-12-15 10:51:32 -08:00
Russ Cox
fd1f10966d more tags for go/build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5490047
2011-12-15 13:35:59 -05:00
Brad Fitzpatrick
ea51dd23b4 sql: add Rows.Columns
Also, fix package name in error messages.

Fixes #2453

R=rsc
CC=golang-dev
https://golang.org/cl/5483088
2011-12-15 10:14:57 -08:00
Brad Fitzpatrick
f89b5746fb json: some tests to demonstrate bad error messages
Not a fix yet (help wanted), but part of Issue 2331

R=rsc
CC=golang-dev
https://golang.org/cl/5490043
2011-12-15 10:02:47 -08:00
Russ Cox
1b82e03a8f os: make compatible with go/build
It is probably a mistake to have these here at all -
os is supposed to be portable - but this only fixes
the build issue.

R=golang-dev, r, r, iant
CC=golang-dev
https://golang.org/cl/5487073
2011-12-15 12:33:36 -05:00
Russ Cox
6e8875551a test/bench/go1: first draft of Go 1 benchmark suite
I have included a few important microbenchmarks,
but the overall intent is to have mostly end-to-end
benchmarks timing real world operations.

The jsondata.go file is a summary of agl's
activity in various open source repositories.
It gets used as test data for many of the benchmarks.

Everything links into one binary (even the test data)
so that it is easy to run the benchmarks on many
computers: there is just one file to copy around.

R=golang-dev, r, bradfitz, adg, r
CC=golang-dev
https://golang.org/cl/5484071
2011-12-15 12:32:59 -05:00
Christopher Nielsen
d10126a622 os: OS-dependent bits to support NetBSD.
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5482068
2011-12-15 12:19:19 -05:00
Luuk van Dijk
7e6890a670 gc: inlining, allow empty bodies, fix _ arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/5487077
2011-12-15 17:50:59 +01:00
Luuk van Dijk
5b2f8d96ce gc: omit argument names from function types in error messages
Fixes #2563

R=rsc
CC=golang-dev
https://golang.org/cl/5495047
2011-12-15 17:38:47 +01:00
Luuk van Dijk
9bf3478658 gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels
emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case.

R=rsc
CC=golang-dev
https://golang.org/cl/5483071
2011-12-15 17:35:59 +01:00
Roger Peppe
cebf55dc9b time: new AddDate method
R=rsc
CC=golang-dev
https://golang.org/cl/5465044
2011-12-15 11:23:01 -05:00
Dave Cheney
fc6df2fdd8 exp/ssh: rename ClientAuthPublicKey helper ClientAuthKeyring
Also, rename ServerConfig.PubKeyCallback to PublicKeyCallback.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5477059
2011-12-15 11:06:10 -05:00
Russ Cox
17264df112 gc: implement and test \r in raw strings
For issue 680.

R=ken2
CC=golang-dev
https://golang.org/cl/5492046
2011-12-15 10:47:09 -05:00
Russ Cox
2ad8a9c507 go: implement build, install, run
clean is gone; all the intermediate files are created
in a temporary tree that is wiped when the command ends.

Not using go/build's Script because it is not well aligned
with this API.  The various builder methods are copied from
go/build and adapted.  Probably once we delete goinstall
we can delete the Script API too.

R=rogpeppe, adg, adg
CC=golang-dev
https://golang.org/cl/5483069
2011-12-14 22:42:42 -05:00
Rob Pike
24e9683ae6 fmt: don't recur if String method (etc.) misbehaves
Fixes #2555.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5486076
2011-12-14 16:37:54 -08:00
Andrew Balholm
85fdd68bd9 html: don't leave "in column group" mode when ignoring a token
Pass tests6.dat, test 26:
foo<col>

| <col>

Also pass tests through test 35:
<table><tr><div><td>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5482074
2011-12-15 10:45:19 +11:00
Rémy Oudompheng
076ebed0d8 cgo: add basic gccgo support.
R=rsc, iant
CC=golang-dev, remy
https://golang.org/cl/5485070
2011-12-14 15:40:35 -08:00
Anthony Martin
d89b7173c2 5c, 6c, 8c: support 64-bit switch value
For real this time. :-)

R=rsc, ken
CC=golang-dev
https://golang.org/cl/5486061
2011-12-14 17:30:40 -05:00
Vadim Vygonets
8fbeb945db gzip: Convert between Latin-1 and Unicode
I realize I didn't send the tests in last time.  Anyway, I added
a test that knows too much about the package's internal structure,
and I'm not sure whether it's the right thing to do.

Vadik.

R=bradfitz, rsc, go.peter.90
CC=golang-dev
https://golang.org/cl/5450073
2011-12-14 17:17:40 -05:00
Vadim Vygonets
58b97a29fd net/smtp: add CRAM-MD5 authentication
R=golang-dev, edsrzf, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5451087
2011-12-14 17:17:25 -05:00
Rob Pike
1402d1a686 html/template: define the FuncMap type locally
This redefinition means that the public signature of html/template
does not refer to text/template.

Fixes #2546.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487083
2011-12-14 11:22:17 -08:00
Robert Hencke
78821616d6 gotest: use build.DefaultContext.GOARCH
Fixes https://golang.org/cl/5480060/#msg4

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485051
2011-12-14 11:21:30 -08:00
Brad Fitzpatrick
22dafc9bc5 http: fix failing Transport HEAD request with gzip-looking response
We only want to attempt to un-gzip if there's a body (not in
response to a HEAD)

This was accidentally passing before, but revealed to be broken
when c3c6e72d7cc went in.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5477093
2011-12-14 11:20:21 -08:00
Robert Griesemer
6890afd9a3 strconv: slightly faster int conversion for GOARCH=386
benchmark                           old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatInt         12198        12031   -1.37%
strconv_test.BenchmarkAppendInt          9268         9153   -1.24%
strconv_test.BenchmarkFormatUint         3538         3429   -3.08%
strconv_test.BenchmarkAppendUint         3133         3062   -2.27%

No performance difference for GOARCH=amd64.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5488089
2011-12-14 11:14:10 -08:00
Rob Pike
34c7765fe5 json: treat renamed byte slices the same as []byte
Fixes #2163.

R=rsc
CC=golang-dev
https://golang.org/cl/5488068
2011-12-14 11:03:28 -08:00
Robert Griesemer
465aba66c1 strconv: even faster int conversion
benchmark                           old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatInt         10038         8217  -18.14%
strconv_test.BenchmarkAppendInt          6822         4969  -27.16%
strconv_test.BenchmarkFormatUint         2811         1814  -35.47%
strconv_test.BenchmarkAppendUint         2349         1360  -42.10%

R=rsc
CC=golang-dev
https://golang.org/cl/5488083
2011-12-14 10:45:59 -08:00
Robert Griesemer
25e94154b7 undo CL 5477092 / c3c6e72d7cc5
The obvious fix is breaking the build in non-obvious ways.
Reverting while waiting for the correct fix, if any is needed.

««« original CL description
net/http: fix bug in error checking

Thanks to josef86@gmail.com for pointing this out.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5477092
»»»

R=iant
CC=golang-dev
https://golang.org/cl/5488085
2011-12-14 10:44:34 -08:00
Robert Griesemer
c0421d92c8 net/http: fix bug in error checking
Thanks to josef86@gmail.com for pointing this out.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5477092
2011-12-14 08:43:42 -08:00
Luuk van Dijk
e14d1d7e41 gc: use inferred type rather than original one when reporting non-assignability.
Fixes #2451

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5372105
2011-12-14 17:34:35 +01:00
Russ Cox
d842acd57e crypto/tls: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5484073
2011-12-14 10:25:48 -05:00
Russ Cox
23cd406496 hash/crc32: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5486060
2011-12-14 10:25:16 -05:00
Russ Cox
576311d72b go/build: make compatible with go/build
The irony!

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482062
2011-12-14 10:24:17 -05:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
a62722bba4 gc: inlining (disabled without -l)
Cross- and intra package inlining of single assignments or return <expression>.
Minus some hairy cases, currently including other calls, expressions with closures and ... arguments.

R=rsc, rogpeppe, adg, gri
CC=golang-dev
https://golang.org/cl/5400043
2011-12-14 15:05:33 +01:00
Andrew Balholm
e25a83d03e html: close <button> element before opening a new one
Pass tests6.dat, test 13:
<button><button>

| <html>
|   <head>
|   <body>
|     <button>
|     <button>

Also pass tests through test 25:
<table><colgroup>foo

R=nigeltao
CC=golang-dev
https://golang.org/cl/5487072
2011-12-14 21:40:31 +11:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Russ Cox
c8a5f8841c undo CL 5485063 / 21595dc0395a
breaks 64-bit build

««« original CL description
8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/5488075
2011-12-14 00:46:07 -05:00
Christopher Wedgwood
1e63a4e424 runtime: bump gc 'extra bytes' check
(needed for non-zero GOMAXPROCS)

R=iant, rsc
CC=go.peter.90, golang-dev
https://golang.org/cl/5486059
2011-12-13 21:28:43 -08:00
Russ Cox
6481e37d28 8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
2011-12-14 00:08:38 -05:00
Rob Pike
ba576b2b48 encoding/gob: better error messages when types mismatch
The transmitter must encode an interface value if it is to be decoded
into an interface value, but it's a common and confusing error to
encode a concrete value and attempt to decode it into an interface,
particularly *interface{}. This CL attempts to explain things better.

Fixes #2367.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5485072
2011-12-13 20:40:55 -08:00
Yasuhiro Matsumoto
1c50c32af0 exp/winfsnotify: fix build.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5483057
2011-12-14 13:17:48 +11:00
Joel Sing
7b5ae29afd syscall: regenerate z-files for openbsd
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5414053
2011-12-14 10:46:49 +11:00
Ian Lance Taylor
26239417bb runtime: Make gc_test test extra allocated space, not total space.
Testing total space fails for gccgo when not using split
stacks, because then each goroutine has a large stack, and so
the total memory usage is large.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487068
2011-12-13 15:12:55 -08:00
Rob Pike
64776da456 bufio: make the minimum read buffer size 16 bytes.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/5485067
2011-12-13 15:07:17 -08:00
Russ Cox
5fe96c640a test/garbage: move to test/bench/garbage
(These are benchmarks for the garbage collector, not tests.)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5484070
2011-12-13 18:02:49 -05:00
Russ Cox
1161e1172b fix build, sorry
TBR=r
CC=golang-dev
https://golang.org/cl/5488066
2011-12-13 17:53:00 -05:00
Brad Fitzpatrick
39213c1fdb strconv: some allocation tests
R=rsc, r
CC=golang-dev
https://golang.org/cl/5477084
2011-12-13 14:49:26 -08:00
Russ Cox
bcbb2f93ee test/bench: move to test/bench/shootout
R=golang-dev, r, gri, bradfitz
CC=golang-dev
https://golang.org/cl/5487067
2011-12-13 17:46:54 -05:00
Russ Cox
2572803899 math: delete non-Sqrt-based Hypot
I was confused by the existence of two portable Hypot
routines in the tree when I cleaned things up, and I made
ARM use the wrong (imprecise) one.  Use the right one,
and delete the wrong one.

Fixes arm build.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485065
2011-12-13 17:08:56 -05:00
Russ Cox
2c6d3eaf78 undo CL 5414048 / f6b994f33cf4
breaks build

««« original CL description
http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

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

»»»

R=bradfitz
CC=golang-dev
https://golang.org/cl/5482061
2011-12-13 17:08:18 -05:00
Robert Griesemer
5fb7e5b482 go/printer, godoc: print comments in example code
- go/printer: support for printing CommentedNodes
- go/doc: collect comments from examples

Fixes #2429.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5482052
2011-12-13 14:05:05 -08:00
Robert Griesemer
fe746335aa gofmt: simplify flags
-tabs replaces -tabindent
-spaces has been removed

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5487066
2011-12-13 14:03:25 -08:00
Andrew Gerrand
0b0a6ec7ec gofix: add googlecode module for rewriting Google Code imports
goinstall: disallow googlecode.com import paths

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5421049
2011-12-14 08:46:26 +11:00
Roger Peppe
516168057e http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5414048
2011-12-13 16:34:22 -05:00
Yasuhiro Matsumoto
19d064f68a gofix: add fix httputil
R=r, rsc, adg
CC=golang-dev
https://golang.org/cl/5364056
2011-12-13 16:23:06 -05:00
Christopher Wedgwood
0e9ee93cea archive/tar: (test) structure comparison not reflect.DeepEqual
R=dsymonds
CC=golang-dev
https://golang.org/cl/5487064
2011-12-14 08:08:49 +11:00
Russ Cox
dd8dc6f059 math: regularize build
This will be nicer to the automatic tools.
It requires a few more assembly stubs
but fewer Go files.

There are a few instances where it looks like
there are new blobs of code, but they are just
being copied out of deleted files.

There is no new code here.

Suppose you have a portable implementation for Sin
and a 386-specific assembly one.  The old way to
do this was to write three files

sin_decl.go
   func Sin(x float64) float64  // declaration only
sin_386.s
   assembly implementation

sin_port.go
   func Sin(x float64) float64 { ... }  // pure-Go impl

and then link in either sin_decl.go+sin_386.s or
just sin_port.go.  The Makefile actually did the magic
of linking in only the _port.go files for those without
assembly and only the _decl.go files for those with
assembly, or at least some of that magic.

The biggest problem with this, beyond being hard
to explain to the build system, is that once you do
explain it to the build system, godoc knows which
of sin_port.go or sin_decl.go are involved on a given
architecture, and it (correctly) ignores the other.
That means you have to put identical doc comments
in both files.

The new approach, which is more like what we did
in the later packages math/big and sync/atomic,
is to have

sin.go
   func Sin(x float64) float64  // decl only
   func sin(x float64) float64 {...}  // pure-Go impl

sin_386.s
   // assembly for Sin (ignores sin)
sin_amd64.s
   // assembly for Sin: jmp sin
sin_arm.s
   // assembly for Sin: jmp sin

Once we abandon Makefiles we can put all the assembly
stubs in one source file, so the number of files will
actually go down.

Chris asked whether the branches cost anything.
Given that they are branching to pure-Go implementations
that are not typically known for their speed, the single
direct branch is not going to be noticeable.  That is,
it's on the slow path.

An alternative would have been to preserve the old
"only write assembly files when there's an implementation"
and still have just one copy of the declaration of Sin
(and thus one doc comment) by doing:

sin.go
   func Sin(x float64) float64 { return sin(x) }

sin_decl.go
   func sin(x float64) float64 // declaration only
sin_386.s
   // assembly for sin

sin_port.go
   func sin(x float64) float64 { portable code }

In this version everyone would link in sin.go and
then either sin_decl.go+sin_386.s or sin_port.go.

This has an extra function call on all paths, including
the "fast path" to get to assembly, and it triples the
number of Go files involved compared to what I did
in this CL.  On the other hand you don't have to
write assembly stubs.  After starting down this path
I decided that the assembly stubs were the easier
approach.

As for generating the assembly stubs on the fly, much
of the goal here is to eliminate magic from the build
process, so that zero-configuration tools like goinstall
or the new go tool can handle this package.

R=golang-dev, r, cw, iant, r
CC=golang-dev
https://golang.org/cl/5488057
2011-12-13 15:20:12 -05:00
Christopher Wedgwood
6f975fbb31 cypto/ocsp: fix tests
Actually compare the result with expected not itself

R=agl, bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5477079
2011-12-13 14:40:28 -05:00
Russ Cox
6e2c3ef428 go: implement doc, fmt, fix, list, vet
This CL is concerned with the basic Package structure
and applies it to the (trivial) implementations of the
doc, fmt, fix, list, and vet commands.

The command as a whole is still very much a work in progress.
In particular, work making the error messages look nice
is deferred to a future CL.

R=golang-dev, adg, dsymonds, r
CC=golang-dev
https://golang.org/cl/5482048
2011-12-13 14:28:41 -05:00
Russ Cox
969b71d906 build: disable cgo on Windows/amd64
Apparently it is broken.  Disable so that dashboard
will let us see other breakages on Windows.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5477081
2011-12-13 14:20:38 -05:00
Rob Pike
38df0459ae strconv: make QuoteRune etc. take a rune argument
Just an oversight it didn't already.
Fixes #2515.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5483064
2011-12-13 11:13:23 -08:00
Russ Cox
c0951e9f8b 5g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/5482059
2011-12-13 14:12:16 -05:00
Rob Pike
02f6719d44 strconv: include package and function name in error strings
Fixes #2548.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5484062
2011-12-13 10:42:05 -08:00
Russ Cox
6bf84214c1 godoc: text wrapping
Example:

PACKAGE

package utf8
    import "unicode/utf8"

    Package utf8 implements functions and constants to support text
    encoded in UTF-8.  This package calls a Unicode character a rune for
    brevity.

CONSTANTS

const (
    RuneError = unicode.ReplacementChar // the "error" Rune or "replacement character".
    RuneSelf  = 0x80                    // characters below Runeself are represented as themselves in a single byte.
    UTFMax    = 4                       // maximum number of bytes of a UTF-8 encoded Unicode character.
)
    Numbers fundamental to the encoding.

FUNCTIONS

func DecodeLastRune(p []byte) (r rune, size int)
    DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
    rune and its width in bytes.

func DecodeLastRuneInString(s string) (r rune, size int)
    DecodeLastRuneInString is like DecodeLastRune but its input is a
    string.

func DecodeRune(p []byte) (r rune, size int)
    DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
    and its width in bytes.

func DecodeRuneInString(s string) (r rune, size int)
    DecodeRuneInString is like DecodeRune but its input is a string.

func EncodeRune(p []byte, r rune) int
    EncodeRune writes into p (which must be large enough) the UTF-8
    encoding of the rune.  It returns the number of bytes written.

func FullRune(p []byte) bool
    FullRune reports whether the bytes in p begin with a full UTF-8
    encoding of a rune.  An invalid encoding is considered a full Rune
    since it will convert as a width-1 error rune.

func FullRuneInString(s string) bool
    FullRuneInString is like FullRune but its input is a string.

func RuneCount(p []byte) int
    RuneCount returns the number of runes in p.  Erroneous and short
    encodings are treated as single runes of width 1 byte.

func RuneCountInString(s string) (n int)
    RuneCountInString is like RuneCount but its input is a string.

func RuneLen(r rune) int
    RuneLen returns the number of bytes required to encode the rune.

func RuneStart(b byte) bool
    RuneStart reports whether the byte could be the first byte of an
    encoded rune.  Second and subsequent bytes always have the top two
    bits set to 10.

func Valid(p []byte) bool
    Valid reports whether p consists entirely of valid UTF-8-encoded
    runes.

func ValidString(s string) bool
    ValidString reports whether s consists entirely of valid UTF-8-encoded
    runes.

TYPES

type String struct {
    // contains filtered or unexported fields
}
    String wraps a regular string with a small structure that provides
    more efficient indexing by code point index, as opposed to byte index.
    Scanning incrementally forwards or backwards is O(1) per index
    operation (although not as fast a range clause going forwards).
    Random access is O(N) in the length of the string, but the overhead is
    less than always scanning from the beginning.  If the string is ASCII,
    random access is O(1).  Unlike the built-in string type, String has
    internal mutable state and is not thread-safe.

func NewString(contents string) *String
    NewString returns a new UTF-8 string with the provided contents.

func (s *String) At(i int) rune
    At returns the rune with index i in the String.  The sequence of runes
    is the same as iterating over the contents with a "for range" clause.

func (s *String) Init(contents string) *String
    Init initializes an existing String to hold the provided contents.
    It returns a pointer to the initialized String.

func (s *String) IsASCII() bool
    IsASCII returns a boolean indicating whether the String contains only
    ASCII bytes.

func (s *String) RuneCount() int
    RuneCount returns the number of runes (Unicode code points) in the
    String.

func (s *String) Slice(i, j int) string
    Slice returns the string sliced at rune positions [i:j].

func (s *String) String() string
    String returns the contents of the String.  This method also means the
    String is directly printable by fmt.Print.

Fixes #2479.

R=golang-dev, dsymonds, mattn.jp, r, gri, r
CC=golang-dev
https://golang.org/cl/5472051
2011-12-13 13:33:40 -05:00
Russ Cox
61655bc513 gc: delete DUPOK definition
The relevant header is already included.

R=ken2
CC=golang-dev
https://golang.org/cl/5487062
2011-12-13 13:25:48 -05:00
Dave Cheney
2b600f77dd exp/ssh: improve client channel close behavior
R=gustav.paul
CC=golang-dev
https://golang.org/cl/5480062
2011-12-13 10:27:17 -05:00
Luuk van Dijk
7cf4825425 gc: small fixes to fmt.c
don't crash when printing error messages about symbols in a garbled state.
render OCOMPLIT in export mode.

R=rsc
CC=golang-dev
https://golang.org/cl/5466045
2011-12-13 09:15:46 +01:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
Nigel Tao
66113ac818 html: update comments to match latest spec.
R=dsymonds
CC=golang-dev
https://golang.org/cl/5482054
2011-12-13 14:20:26 +11:00
Nigel Tao
b9064fb132 html: a first step at parsing foreign content (MathML, SVG).
Nodes now have a Namespace field.

Pass adoption01.dat, test 12:
<a><svg><tr><input></a>

| <html>
|   <head>
|   <body>
|     <a>
|       <svg svg>
|         <svg tr>
|           <svg input>

The other adoption01.dat tests already passed.

R=andybalholm
CC=golang-dev
https://golang.org/cl/5467075
2011-12-13 13:52:47 +11:00
Mikio Hara
0643aacee9 syscall: regenerate z-files for darwin, freebsd
R=golang-dev, jsing, rsc
CC=golang-dev
https://golang.org/cl/5479054
2011-12-13 10:27:23 +09:00
Mikio Hara
f6972ba62b net: fix typo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5488052
2011-12-13 10:12:45 +09:00
Alex Brainman
53c4d81b63 env.bash: export CGO_ENABLED so cgo tests run
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5394042
2011-12-13 10:47:51 +11:00
David Symonds
3dbecd592b various: a grab-bag of time.Duration cleanups.
R=adg, r, rsc
CC=golang-dev
https://golang.org/cl/5475069
2011-12-13 10:42:56 +11:00
Russ Cox
fc7b9fc269 time: allow sleep tests to run for 200% too long
Some VMs are slow.  Very slow.
Fixes #2421.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482049
2011-12-12 18:33:47 -05:00
Ivan Krasin
b1ae728d19 compress/flate: fix out of bounds error
Fixes #2508.

R=rsc, krasin
CC=golang-dev
https://golang.org/cl/5449115
2011-12-12 18:25:32 -05:00
Christopher Nielsen
26089cfe25 runtime: Changes to the runtime to support NetBSD.
R=rsc
CC=golang-dev
https://golang.org/cl/5477052
2011-12-12 18:10:11 -05:00
Christoph Hack
ecf4a9216e godoc: added an opensearch description document.
R=golang-dev, r, tux21b, rsc
CC=golang-dev
https://golang.org/cl/5479062
2011-12-12 18:01:06 -05:00
Brad Fitzpatrick
06a9bc6835 sql: fix missing mutex unlock in an error case
Fixes #2542

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5483054
2011-12-12 13:56:56 -08:00
Gustavo Niemeyer
3dc278d3e2 reflect: fix Slice cap
R=golang-dev, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5483044
2011-12-12 19:45:40 -02:00
Sébastien Paolacci
e6f5a90b5f runtime: madvise and SysUnused for Linux
SysUnused being a direct call to madvise MADV_DONTNEED.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/5477057
2011-12-12 16:33:13 -05:00
Lucio De Re
0f4f3c6769 gc: avoid 0-length C array
R=golang-dev, ality
CC=golang-dev, rsc
https://golang.org/cl/5467066
2011-12-12 16:25:31 -05:00
Anthony Martin
2c2a582ae9 os: fix Plan 9 build for new FileInfo API
R=lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/5440073
2011-12-12 16:14:00 -05:00
Anthony Martin
1cb254a085 time: fix Plan 9 build for new API
I had to move readFile into sys_$GOOS.go
since syscall.Open takes only two arguments
on Plan 9.

R=lucio.dere, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5447061
2011-12-12 16:12:22 -05:00
Rémy Oudompheng
d7634ad7d9 gc: fix wrong arguments to error message for switches.
Fixes #2502.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5472062
2011-12-12 16:08:32 -05:00
Robert Hencke
d0cf3fa21e time: gob marshaler for Time
Addresses issue 2526

R=rsc, r
CC=golang-dev
https://golang.org/cl/5448114
2011-12-12 16:08:29 -05:00
Charles L. Dorian
f5c211172b math: fix special cases in Nextafter
Nextafter(0, -1) != -0.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5467060
2011-12-12 15:51:11 -05:00
Christopher Nielsen
420fe22921 ld/6l/8l: First pass at changes to the linker to support NetBSD binaries.
This will not currently create valid NetBSD binaries because NetBSD requires
an ELF note section to run, otherwise the kernel will throw ENOEXEC. I was
unable to determine an elegant way to add the section, so I am submitting
what I have.

References:
http://www.netbsd.org/docs/kernel/elf-notes.html
http://mail-index.netbsd.org/netbsd-bugs/2001/08/03/0012.html

R=rsc
CC=golang-dev
https://golang.org/cl/5472049
2011-12-12 15:42:11 -05:00
Christopher Nielsen
728c16cf13 build: Changes to the build infrastructure for NetBSD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5476048
2011-12-12 15:42:06 -05:00
Lucio De Re
d56ca13c03 gc: add varargck for %lN
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5476049
2011-12-12 15:42:02 -05:00
Russ Cox
ecda0fa5d4 gc: allow colon in //line file name
Assume last colon introduces line number.

Fixes #2543.

R=ken2
CC=golang-dev
https://golang.org/cl/5485047
2011-12-12 15:41:54 -05:00
Roger Peppe
2cb1aa4681 archive/zip: make zip understand os.FileMode.
Fixes implicit dependency on underlying os file modes.

R=rsc, r, n13m3y3r, gustavo, adg
CC=golang-dev
https://golang.org/cl/5440130
2011-12-12 15:22:55 -05:00
Ian Lance Taylor
68ec347c16 net/http: make test remove temporary file and directory
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5486044
2011-12-12 10:40:15 -08:00
Taru Karttunen
a620f2b73a crypto/aes: Made faster by eliminating some indirection
Made te and td arrays into variables te0-3 and td0-3,
which improves performance from 7000ns/op to 5800.

R=rsc, rogpeppe, agl
CC=golang-dev
https://golang.org/cl/5449077
2011-12-12 09:58:04 -05:00
Andrew Balholm
0c5443a0a6 html: don't ignore whitespace in or after framesets
Pass tests6.dat, test 7:
<frameset></frameset>
foo

| <html>
|   <head>
|   <frameset>
|   "
"

Also pass tests through test 12:
<form><form>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5480061
2011-12-12 13:18:01 +11:00
Rob Pike
e505c9ccac net/http: further simplify example program
(should have caught this in review.)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5478066
2011-12-11 09:29:44 -08:00
Joel Sing
7e797be7a3 exp/norm: fix rune/int types in test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5472067
2011-12-11 09:25:09 -08:00
Lucio De Re
90913cf170 Housekeeping: Cleaning up the clean-up process.
src/clean.bash:
        Add clean-ups for previously overlooked directories.
doc/codelab/wiki/Makefile:
        Dropped "index.html" from CLEANFILES so it will not be
        deleted on cleaning.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5476050
2011-12-11 09:23:17 -08:00
Lucio De Re
e628144aeb pkg/runtime/Makefile: sorted object module names.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5479060
2011-12-11 09:21:53 -08:00
Olivier Duperray
3308891c9d net/http: fix trivial example server
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5479061
2011-12-11 09:11:57 -08:00
Robert Hencke
d8d321068b gotest: use build.ArchChar()
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5480060
2011-12-10 14:42:29 -08:00
Hector Chu
fdb09d289a time: fix Time.Add
R=rsc, r
CC=golang-dev
https://golang.org/cl/5448121
2011-12-10 21:55:38 +00:00
Robert Hencke
7ab25a441c pkg: adjust "the a" in comments
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5476055
2011-12-10 13:02:23 +11:00
Rob Pike
0244bae672 expvar: fix typo in Publish documentation
Found and fixed by bketelsen@gmail.com.
Not worth making him a CONTRIBUTOR to delete one character.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5476054
2011-12-09 14:24:51 -08:00
Russ Cox
1cb7f85d74 gc: 0 expected bugs
Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
2011-12-09 14:58:28 -05:00
Rob Pike
5912869d61 html/template: make Must work
Fixes #2545.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5475054
2011-12-09 10:47:36 -08:00
Russ Cox
8c0b699ca4 gc: fix another blank bug
R=ken2
CC=golang-dev
https://golang.org/cl/5478051
2011-12-09 11:59:21 -05:00
Russ Cox
e77f057bf3 gc: resolve built-ins to built-in symbol
R=lvd
CC=golang-dev
https://golang.org/cl/5480049
2011-12-09 08:28:17 -05:00
Russ Cox
fc128403dc gc: minor changes for inlining
Copied from 5400043 since they stand alone from inlining.

R=lvd
CC=golang-dev
https://golang.org/cl/5479046
2011-12-09 08:03:51 -05:00
Russ Cox
012798a325 gc: rune is now an alias for int32
R=ken2
CC=golang-dev
https://golang.org/cl/5467049
2011-12-09 00:12:07 -05:00
Russ Cox
41453d2ed2 exp/types: fix linux build
I don't understand why it was only broken on Linux

TBR=gri
CC=golang-dev
https://golang.org/cl/5479045
2011-12-08 23:20:21 -05:00
Russ Cox
2ab9bb6aaf gc: fix export of '\'' and '\\' constants
Fixes Windows build.

R=ken2
CC=golang-dev
https://golang.org/cl/5472046
2011-12-08 22:43:31 -05:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Russ Cox
be0ffbfd02 gc: implement character constant type rules
R=ken2
CC=golang-dev
https://golang.org/cl/5444054
2011-12-08 22:07:43 -05:00
Charles L. Dorian
2065b0a094 math: special cases for Pow10; delete BUG
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5477046
2011-12-08 22:06:33 -05:00
Alex Brainman
27cab90363 syscall: allow for mksyscall_windows.pl to be used outside of syscall
this change should have been part of fafcd328da73

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/5462045
2011-12-09 11:12:03 +11:00
Alex Brainman
692c31d60a misc/cgo/testso: do not leave out file behind
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/5461044
2011-12-09 11:00:49 +11:00
Benny Siegert
5d045fb0f1 syscall: Remove obsolete Errstr call from commented-out example.
syscall_windows.go contains a small demo, which calls the obsolete
syscall.Errstr function.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5475044
2011-12-09 10:42:34 +11:00
Charles L. Dorian
94b0342f17 math: document more special cases
Acosh, Asinh, Atanh, Ceil, Floor, Trunc, Mod and Remainder affected. These changes add some non-finite arguments and results (and -0.0 results).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5469046
2011-12-08 17:07:13 -05:00
Adam Langley
60f564fc37 crypto/dsa: don't truncate input hashes.
Although FIPS 186-3 says that we should truncate the hashes, at least
one other library (libgcrypt) doesn't. This means that it's impossible
to interoperate with code using gcrypt if we enforce the truncation
inside of crypto/dsa.

This change shouldn't actually affect anything because nearly
everybody pairs DSA with SHA1, which doesn't need to be truncated in
either case.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5471043
2011-12-08 16:46:19 -05:00
Rob Pike
0397b28a90 html/template: clean up locking for ExecuteTemplate
R=mikesamuel, rogpeppe
CC=golang-dev
https://golang.org/cl/5448137
2011-12-08 10:15:53 -08:00
Andrea Spadaccini
83c30f3ec2 syscall: add constants for flock() system call under Linux.
The values have been generated only for the i386 and amd64 architectures.

R=golang-dev, mikioh.mikioh, dsymonds
CC=bradfitz, dsymonds, golang-dev
https://golang.org/cl/5452060
2011-12-08 15:12:08 +09:00
David Symonds
2949f3b659 time: use Duration for AfterFunc.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5465043
2011-12-08 15:42:44 +11:00
Russ Cox
f00340f022 gc: rename %union field name from lint to i
#define lint has special meaning to Bison;
having a field named lint conflicts with that.

R=ken2
CC=golang-dev
https://golang.org/cl/5462044
2011-12-07 23:38:32 -05:00
Alex Brainman
ef65feda2a syscall: return error, not uintptr, when function returns error
R=rsc
CC=golang-dev
https://golang.org/cl/5450119
2011-12-08 12:07:21 +11:00
Robert Griesemer
2e3bd890c5 strconv: fix documentation
Also: minor performance fix for large precision results.

benchmark                                   old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatFloatDecimal         2734         2734   +0.00%
strconv_test.BenchmarkFormatFloat                3141         3139   -0.06%
strconv_test.BenchmarkFormatFloatExp             8970         8989   +0.21%
strconv_test.BenchmarkFormatFloatBig             3228         3208   -0.62%

Fixes #2535.

R=rsc
CC=golang-dev
https://golang.org/cl/5435089
2011-12-07 14:45:45 -08:00
Rémy Oudompheng
4349effb15 gc: keep pointer to original node in constant rewrites.
This allows printing meaningful expressions in error messages
instead of evaluated constants.
Fixes #2276.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5432082
2011-12-07 16:18:50 -05:00
David Symonds
9d52fe22b4 exp/sql: simplify some string conversions.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5451112
2011-12-08 08:08:00 +11:00
Russ Cox
5e98505ba7 gc: fix spurious typecheck loop in &composite literal
Fixes #2538.

R=ken2
CC=golang-dev
https://golang.org/cl/5449114
2011-12-07 15:48:55 -05:00
Russ Cox
1278c6c055 bytes: lost edit from earlier CL
R=iant
CC=golang-dev
https://golang.org/cl/5450125
2011-12-07 15:30:01 -05:00
Russ Cox
9b875bc037 bytes: faster Count, Index, Equal
Benchmarks are from GOARCH=amd64 on a MacPro5,1.

benchmark                                    old MB/s     new MB/s  speedup
bytes_test.BenchmarkEqual32                    452.89       891.07    1.97x
bytes_test.BenchmarkEqual4K                    852.71      1700.44    1.99x
bytes_test.BenchmarkEqual4M                    841.53      1587.93    1.89x
bytes_test.BenchmarkEqual64M                   838.22      1578.14    1.88x

bytes_test.BenchmarkIndex32                     58.02        48.99    0.84x
bytes_test.BenchmarkIndex4K                     48.26        41.32    0.86x
bytes_test.BenchmarkIndex4M                     48.20        41.24    0.86x
bytes_test.BenchmarkIndex64M                    48.08        41.21    0.86x
bytes_test.BenchmarkIndexEasy32                410.04       546.82    1.33x
bytes_test.BenchmarkIndexEasy4K                849.26     14257.37   16.79x
bytes_test.BenchmarkIndexEasy4M                854.54     17222.15   20.15x
bytes_test.BenchmarkIndexEasy64M               843.57     11060.40   13.11x

bytes_test.BenchmarkCount32                     57.24        50.68    0.89x
bytes_test.BenchmarkCount4K                     48.19        41.82    0.87x
bytes_test.BenchmarkCount4M                     48.18        41.74    0.87x
bytes_test.BenchmarkCount64M                    48.17        41.71    0.87x
bytes_test.BenchmarkCountEasy32                433.11       547.44    1.26x
bytes_test.BenchmarkCountEasy4K               1130.59     14194.06   12.55x
bytes_test.BenchmarkCountEasy4M               1131.23     17231.18   15.23x
bytes_test.BenchmarkCountEasy64M              1111.40     11068.88    9.96x

The non-easy Count/Index benchmarks are a worst case input.

regexp.BenchmarkMatchEasy0_32                  237.46       221.47    0.93x
regexp.BenchmarkMatchEasy0_1K                  553.53      1019.72    1.84x
regexp.BenchmarkMatchEasy0_32K                 693.99      1672.06    2.41x
regexp.BenchmarkMatchEasy0_1M                  688.72      1611.68    2.34x
regexp.BenchmarkMatchEasy0_32M                 680.70      1565.05    2.30x
regexp.BenchmarkMatchEasy1_32                  165.56       243.08    1.47x
regexp.BenchmarkMatchEasy1_1K                  336.45       496.32    1.48x
regexp.BenchmarkMatchEasy1_32K                 302.80       425.63    1.41x
regexp.BenchmarkMatchEasy1_1M                  300.42       414.20    1.38x
regexp.BenchmarkMatchEasy1_32M                 299.64       413.47    1.38x

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5451116
2011-12-07 15:09:56 -05:00
Russ Cox
2f2cc24cd8 regexp: avoid allocation of input interface
Matters most for small inputs, because there is no real work
to amortize the allocation effort against.

benchmark                                old ns/op    new ns/op    delta
BenchmarkLiteral                               613          473  -22.84%
BenchmarkNotLiteral                           4981         4931   -1.00%
BenchmarkMatchClass                           7289         7122   -2.29%
BenchmarkMatchClass_InRange                   6618         6663   +0.68%
BenchmarkReplaceAll                           7843         7233   -7.78%
BenchmarkAnchoredLiteralShortNonMatch          329          228  -30.70%
BenchmarkAnchoredLiteralLongNonMatch           322          228  -29.19%
BenchmarkAnchoredShortMatch                    838          715  -14.68%
BenchmarkAnchoredLongMatch                     824          715  -13.23%

benchmark                                 old MB/s     new MB/s  speedup
BenchmarkMatchEasy0_32                      119.73       196.61    1.64x
BenchmarkMatchEasy0_1K                      540.58       538.33    1.00x
BenchmarkMatchEasy0_32K                     732.57       714.00    0.97x
BenchmarkMatchEasy0_1M                      726.44       708.36    0.98x
BenchmarkMatchEasy0_32M                     707.77       691.45    0.98x
BenchmarkMatchEasy1_32                      102.12       136.11    1.33x
BenchmarkMatchEasy1_1K                      298.31       307.04    1.03x
BenchmarkMatchEasy1_32K                     273.56       274.43    1.00x
BenchmarkMatchEasy1_1M                      268.42       269.23    1.00x
BenchmarkMatchEasy1_32M                     266.15       267.34    1.00x
BenchmarkMatchMedium_32                       2.53         3.38    1.34x
BenchmarkMatchMedium_1K                       9.37         9.57    1.02x
BenchmarkMatchMedium_32K                      9.29         9.67    1.04x
BenchmarkMatchMedium_1M                       9.42         9.66    1.03x
BenchmarkMatchMedium_32M                      9.41         9.62    1.02x
BenchmarkMatchHard_32                         6.66         6.75    1.01x
BenchmarkMatchHard_1K                         6.81         6.85    1.01x
BenchmarkMatchHard_32K                        6.79         6.85    1.01x
BenchmarkMatchHard_1M                         6.82         6.83    1.00x
BenchmarkMatchHard_32M                        6.80         6.80    1.00x

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5453076
2011-12-07 15:03:05 -05:00
Charles L. Dorian
e4de2e7fd0 math: document special-cases behavior for Dim, Max and Min
Max returns +Inf if x or y is +Inf; else it returns NaN if either x or y is NaN. Max(-0, -0) returns -0.
Min returns -Inf if x or y is -Inf; else it returns NaN if either x or y is NaN. Min(+0, -0) returns -0.
Dim(+Inf, +Inf) = NaN, Dim(-Inf, -Inf) = NaN and Dim(NaN, anything) = NaN.
Also, change "conditions" to "cases" for Sin (missed it in previous CL).

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5437137
2011-12-07 14:52:17 -05:00
Peter Mundy
69191553e7 time: fix daysIn for December
daysBefore[12+1]: index out of range
time.December and Windows SYSTEMTIME.wMonth
are 12 for December.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5448130
2011-12-07 14:47:25 -05:00
Robert Griesemer
127b5a66b1 strconv: faster float conversion
- added AppendFloatX benchmarks
- 2% to 13% better performance
- check for illegal bitSize

benchmark                                   old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatFloatDecimal         2993         2733   -8.69%
strconv_test.BenchmarkFormatFloat                3384         3141   -7.18%
strconv_test.BenchmarkFormatFloatExp             9192         9010   -1.98%
strconv_test.BenchmarkFormatFloatBig             3279         3207   -2.20%
strconv_test.BenchmarkAppendFloatDecimal         2837         2478  -12.65%
strconv_test.BenchmarkAppendFloat                3196         2928   -8.39%
strconv_test.BenchmarkAppendFloatExp             9028         8773   -2.82%
strconv_test.BenchmarkAppendFloatBig             3151         2782  -11.71%

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5448122
2011-12-07 10:30:27 -08:00
Scott Lawrence
a2ba34d374 ld: fix memory leaks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5434068
2011-12-07 11:50:39 -05:00
Rémy Oudompheng
0c64972dd1 gc: more accurate description of -w and -W switches.
The -w switch actually prints steps of the syntax tree walks
while -W prints a summary before and after the walk.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5444049
2011-12-07 11:45:30 -05:00
Gustav Paul
50c24bf6ec exp/ssh: Have Wait() return an *ExitError
I added the clientChan's msg channel to the list of channels that are closed in mainloop when the server sends a channelCloseMsg.

I added an ExitError type that wraps a Waitmsg similar to that of os/exec. I fill ExitStatus with the data returned in the 'exit-status' channel message and Msg with the data returned in the 'exit-signal' channel message.

Instead of having Wait() return on the first 'exit-status'/'exit-signal' I have it return an ExitError containing the status and signal when the clientChan's msg channel is closed.

I added two tests cases to session_test.go that test for exit status 0 (in which case Wait() returns nil) and exit status 1 (in which case Wait() returns an ExitError with ExitStatus 1)

R=dave, agl, rsc, golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5452051
2011-12-07 09:58:22 -05:00
Dmitriy Vyukov
428062da4e ld: increase default stack size on Windows for cgo
Fixes #2437.

R=rsc, hectorchu, mattn.jp, alex.brainman, jdpoirier, snaury, n13m3y3r
CC=golang-dev
https://golang.org/cl/5371049
2011-12-07 16:53:17 +03:00
Brad Fitzpatrick
130e2943a3 http: make Transport warning about connections closing more accurate
It was fragile and non-portable, and then became spammy with
the os.EINVAL removal.  Now it just uses the length of the
Peek return value instead.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5453065
2011-12-06 16:38:02 -08:00
Adam Langley
554ac03637 crypto: allocate less.
The code in hash functions themselves could write directly into the
output buffer for a savings of about 50ns. But it's a little ugly so I
wasted a copy.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5440111
2011-12-06 18:25:14 -05:00
Dave Cheney
bf59f081c1 exp/ssh: cleanup client auth tests
This CL cleans up the client auth tests, making the
individual test body more manageable.

Also, adds tests for rsa and dsa key negotiation.

Finally, remove the package level use of the variable
strings, which avoids conflicting with the strings pkg.

R=gustav.paul, agl, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5447049
2011-12-06 18:13:20 -05:00
Andrew Gerrand
2c7a84a95b goinstall: honour -install=false flag when -make=true
R=rsc
CC=golang-dev
https://golang.org/cl/5448124
2011-12-07 09:41:20 +11:00
Robert Griesemer
b219e8cbcf strconv: squeezed a bit more out of int/uint formatting
- less code
- slightly better performance (0-4%)

R=r, rsc
CC=golang-dev
https://golang.org/cl/5448120
2011-12-06 13:54:22 -08:00
Adam Langley
02d1dae106 crypto/x509: if a parent cert has a raw subject, use it.
This avoids a problem when creating certificates with parents that
were produce by other code: the Go structures don't contain all the
information about the various ASN.1 string types etc and so that
information would otherwise be lost.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5453067
2011-12-06 16:42:48 -05:00
Rob Pike
ee8b597b1f html/template: simplify ExecuteTemplate a little
Allow the text template to handle the error case of no template
with the given name.
Simplification suggested by Mike Samuel.

R=mikesamuel
CC=golang-dev
https://golang.org/cl/5437147
2011-12-06 12:47:12 -08:00
Rob Pike
66410bac3d fmt: benchmark floating point.
mallocs per Sprintf("%x"): 1
mallocs per Sprintf("%g"): 4

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449106
2011-12-06 08:40:16 -08:00
Maxim Pimenov
972b98c135 cgo: fix typo in the documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5448115
2011-12-06 08:16:39 -08:00
Robert Griesemer
e0c006a9b0 strconv: 34% to 63% faster conversions
(Note that the Int and Uint benchmarks use different test sets
and thus cannot be compared against each other. Int and Uint
conversions are approximately the same speed).

Before (best of 3 runs):
strconv_test.BenchmarkFormatInt    100000    15636 ns/op
strconv_test.BenchmarkAppendInt    100000    18930 ns/op
strconv_test.BenchmarkFormatUint   500000     4392 ns/op
strconv_test.BenchmarkAppendUint   500000     5152 ns/op

After (best of 3 runs):

strconv_test.BenchmarkFormatInt    200000    10070 ns/op (-36%)
strconv_test.BenchmarkAppendInt    200000     7097 ns/op (-63%)
strconv_test.BenchmarkFormatUint  1000000     2893 ns/op (-34%)
strconv_test.BenchmarkAppendUint   500000     2462 ns/op (-52%)

R=r, rsc, r
CC=golang-dev
https://golang.org/cl/5449093
2011-12-06 08:15:45 -08:00
Russ Cox
46deaa297b gc: disallow map/func equality via interface comparison
Missed when I removed direct map/func equality.

R=ken2
CC=golang-dev
https://golang.org/cl/5452052
2011-12-06 10:48:17 -05:00
Russ Cox
e4e4cdb39a image: avoid func comparison during ColorModel comparison
When I disallowed map + func comparisons, I only did it
in the static case and missed the comparisons via == on
interface values.  Fixing that turned these up.

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/5440103
2011-12-06 10:47:42 -05:00
Dave Cheney
bbbd41f4ff exp/ssh: simplify client channel open logic
This is part one of a small set of CL's that aim to resolve
the outstanding TODOs relating to channel close and blocking
behavior.

Firstly, the hairy handling of assigning the peersId is now
done in one place. The cost of this change is the slightly
paradoxical construction of the partially created clientChan.

Secondly, by creating clientChan.stdin/out/err when the channel
is opened, the creation of consumers like tcpchan and Session
is simplified; they just have to wire themselves up to the
relevant readers/writers.

R=agl, gustav.paul, rsc
CC=golang-dev
https://golang.org/cl/5448073
2011-12-06 09:33:23 -05:00
Rob Pike
0a5508c692 various: we don't cast, we convert
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5437142
2011-12-05 19:40:52 -08:00
Andrew Gerrand
ca7d86c4d3 hash: rewrite comment on Hash.Sum method
Fixes #2530.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/5449101
2011-12-06 14:12:09 +11:00
Rob Pike
2ed57a8cd8 fmt: only use Stringer or Error for strings
This is a slight change to fmt's semantics, but means that if you use
%d to print an integer with a Stringable value, it will print as an integer.
This came up because Time.Month() couldn't cleanly print as an integer
rather than a name. Using %d on Stringables is silly anyway, so there
should be no effect outside the fmt tests.
As a mild bonus, certain recursive failures of String methods
will also be avoided this way.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5453053
2011-12-05 16:45:51 -08:00
Russ Cox
4feafeeea0 gofix: fix for strconv API change
R=golang-dev, gri, adg, r
CC=golang-dev
https://golang.org/cl/5434098
2011-12-05 15:52:35 -05:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
efbeaedb64 strconv: new API
R=golang-dev, bradfitz, gri, r, agl
CC=golang-dev
https://golang.org/cl/5434095
2011-12-05 15:48:21 -05:00
Luuk van Dijk
40b2fe004f gc: changes in export format in preparation of inlining.
Includes minimal change to gcimporter to keep it working,

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5431046
2011-12-05 14:40:19 -05:00
Russ Cox
5cb1c82d96 gc: remove type elision in struct literals
R=ken2
CC=golang-dev
https://golang.org/cl/5437136
2011-12-05 14:22:41 -05:00
Charles L. Dorian
abc7df9686 math: add special-cases comments to Sinh and Tanh.
Also change "Special conditions" to "Special cases" as in other functions.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5440078
2011-12-05 14:01:24 -05:00
Rémy Oudompheng
3538d40ab5 crypto/aes: eliminate some bounds checking and manual truncation.
By converting array indices to uint8, they are automatically
constrained in the array range, and the binary AND with 0xff
is no longer needed anymore.

Before:  aes.BenchmarkEncrypt    363 ns/op
After:   aes.BenchmarkEncrypt    273 ns/op

R=golang-dev, gri, agl
CC=golang-dev, remy
https://golang.org/cl/5450084
2011-12-05 13:30:25 -05:00
Russ Cox
b9ccd077dc runtime: prep for type-specific algorithms
Equality on structs will require arbitrary code for type equality,
so change algorithm in type data from uint8 to table pointer.
In the process, trim top-level map structure from
104/80 bytes (64-bit/32-bit) to 24/12.

Equality on structs will require being able to call code generated
by the Go compiler, and C code has no way to access Go return
values, so change the hash and equal algorithm functions to take
a pointer to a result instead of returning the result.

R=ken
CC=golang-dev
https://golang.org/cl/5453043
2011-12-05 09:40:22 -05:00
David Symonds
dbaeb0cf13 net/mail: correctly compare parsed times in the test.
Fixes #2522.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5449084
2011-12-05 10:05:29 +11:00
Russ Cox
214ec7b547 gc: fix build (not sure how this edit got lost)
R=ken2, ken
CC=golang-dev
https://golang.org/cl/5449072
2011-12-02 15:05:45 -05:00
Russ Cox
7a42dddbe6 gc: fix line number for redundant print
R=ken2
CC=golang-dev
https://golang.org/cl/5434111
2011-12-02 14:58:26 -05:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
dcf1d7bc0e gofmt -s misc src
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5451079
2011-12-02 14:14:25 -05:00
Russ Cox
0dab624b70 gofmt: handle &T in composite literal simplify
R=gri
CC=golang-dev
https://golang.org/cl/5448086
2011-12-02 14:14:04 -05:00
Russ Cox
7dc9d8c72b gc: composite literals as per Go 1
R=ken2
CC=golang-dev
https://golang.org/cl/5450067
2011-12-02 14:13:12 -05:00
Robert Griesemer
951ba56adb goinstall: fix typo in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5449068
2011-12-02 10:30:35 -08:00
Russ Cox
7d15eda95d gc: do not allow slice of array literal
R=ken2
CC=golang-dev
https://golang.org/cl/5440083
2011-12-02 12:30:56 -05:00
Gustav Paul
bd9dc3d55f exp/ssh: allow for msgUserAuthBanner during authentication
The SSH spec allows for the server to send a banner message to the client at any point during the authentication process. Currently the ssh client auth types all assume that the first response from the server after issuing a userAuthRequestMsg will be one of a couple of possible authentication success/failure messages. This means that client authentication breaks if the ssh server being connected to has a banner message configured.

This changeset refactors the noneAuth, passwordAuth and publickeyAuth types' auth() function and allows for msgUserAuthBanner during authentication.

R=golang-dev, rsc, dave, agl
CC=golang-dev
https://golang.org/cl/5432065
2011-12-02 10:34:42 -05:00
Robert Hencke
6f0ef845e6 asn1: fix incorrect prints found by govet
R=golang-dev
CC=golang-dev
https://golang.org/cl/5449063
2011-12-02 10:13:02 -05:00
Mikio Hara
cf4acf80b4 net, syscall: remove BindToDevice API from UDPConn, IPConn
For now a pair of socket options SOL_SOCKET and SO_BINDTODEVICE
is supported on Linux only. I'd like to demote BindToDevice API
to syscall level because it's Linux dependent one.

In the near future, probably we may have a bit more portable
API that using IPROTO_IP/IPV6 level socket options to specify,
identify an inbound, outbound IP interface on incoming, outgoing
UDP and raw IP packets.

R=cw, golang-dev
CC=golang-dev
https://golang.org/cl/5447071
2011-12-02 23:18:16 +09:00
Rob Pike
30775f67e7 encoding/gob: don't send type info for unexported fields
Fixes #2517.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5440079
2011-12-02 00:02:24 -08:00
Benny Siegert
2a876beb18 os/exec: make LookPath always search the current directory under Windows.
cmd.exe implicitly looks in "." before consulting PATH.
LookPath should match this behavior.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5434093
2011-12-02 14:29:24 +11:00
Rob Pike
e6b3371781 template: move the empty check into parse, which needs it when constructing
tree sets.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449062
2011-12-01 17:24:54 -08:00
Andrew Balholm
a5d300862b html: allow whitespace between head and body
Also ignore <head> tag after </head>.

Pass tests6.dat, test 0:
<!doctype html></head> <head>

| <!DOCTYPE html>
| <html>
|   <head>
|   " "
|   <body>

Also pass tests through test 6:
<body>
<div>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5447064
2011-12-02 11:46:24 +11:00
Robert Griesemer
6ea3a268b6 go/doc: exclude lines ending in ':' from possible headings
This is a more conservative approach to heading detection and
removes 11 headings from the current repository (several in
fmt). The current headscan output is:

/home/gri/go3/src/cmd/goinstall (package documentation)
        Remote Repositories
        The GOPATH Environment Variable
/home/gri/go3/src/pkg/exp/gotype (package documentation)
        Examples
/home/gri/go3/src/pkg/html/template (package template)
        Introduction
        Contexts
        Errors
        A fuller picture
        Contexts
        Typed Strings
        Security Model
/home/gri/go3/src/pkg/text/template (package template)
        Actions
        Arguments
        Pipelines
        Variables
        Examples
        Functions
        Associated templates
        Nested template definitions
18 headings found

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5437105
2011-12-01 15:14:15 -08:00
Robert Griesemer
15a3a5cf6c gofmt: applied gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5451070
2011-12-01 14:33:24 -08:00
Robert Griesemer
e281576b9a go/doc: switch ToHTML from []byte to string argument
- this removes extra conversions from strings to bytes and vice versa
  for each comment
- minor cleanups

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5434096
2011-12-01 13:46:57 -08:00
Robert Griesemer
bc9ce6a129 go/doc: better headscan
- scan all comments not just the package documentation
- declutter output so that false positives are more easily spotted
- count the number of headings to quickly see differences
- minor tweaks

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5450061
2011-12-01 11:50:15 -08:00
Rob Pike
473de60359 time: update doc string for Error method
Fixes #2512.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449057
2011-12-01 11:44:17 -08:00
Gustavo Niemeyer
d2b77bb194 os: add ModeType constant to mask file type bits
This covers the lack of IsRegular comfortably:

    if stat.Mode()&os.ModeType == 0 { ... }

R=golang-dev, r, rsc, r, gustavo
CC=golang-dev
https://golang.org/cl/5440075
2011-12-01 17:35:43 -02:00
Brad Fitzpatrick
744fb52102 os: be consistent with receiver names for godoc TOC alignment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5449056
2011-12-01 11:23:39 -08:00
Gustav Paul
fad57c0c03 exp/ssh: export type signal. Renamed to Signal
R=dave, agl, rsc, golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5450059
2011-12-01 14:06:15 -05:00
Russ Cox
c52b7db470 gofix: add time+fileinfo fix
R=adg, rogpeppe, r, cw
CC=golang-dev
https://golang.org/cl/5450050
2011-12-01 13:59:57 -05:00
Volker Dobler
a6729b3085 go/doc: Detect headings in comments and format them as h3 in html.
To structure larger sections of comments in html output headings
are detected in comments and formated as h3 in the generated html.
A simple heuristic is used to detect headings in comments:
A heading is a non-blank, non-indented line preceded by a blank
line. It is followed by a blank and a non-blank, non-indented line.
A heading must start with an uppercase letter and end with a letter,
digit or a colon.  A heading may not contain punctuation characters.

R=jan.mercl, gri, adg, rsc, r
CC=golang-dev
https://golang.org/cl/5437056
2011-12-01 09:49:58 -08:00
Alex Brainman
d5f37122d2 crypto/tls: cleanup certificate load on windows
- correct syscall.CertEnumCertificatesInStore so it returns error
- remove "reflect" dependency

R=hectorchu, agl, rsc
CC=golang-dev, krautz
https://golang.org/cl/5441052
2011-12-01 12:38:00 -05:00
Adam Langley
bac7bc55a6 Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Adam Langley
2308aefc84 gofix: add a fix for hash.Sum.
This fix adds an output argument to hash.Sum.

Tree changes in https://golang.org/cl/5448065

R=rsc
CC=golang-dev
https://golang.org/cl/5450051
2011-12-01 12:25:09 -05:00
Rob Pike
d38cc47c0c text/template: replace Add with AddParseTree
Makes it clear we're adding exactly one tree and creating a
new template for it.

R=rsc
CC=golang-dev
https://golang.org/cl/5448077
2011-12-01 09:19:53 -08:00
Luuk van Dijk
6bee4e556f gc: avoid re-genning ninit in branches involving float comparison.
R=rsc
CC=golang-dev
https://golang.org/cl/5451050
2011-12-01 14:46:32 +01:00
Dave Cheney
c4d0ac0e2f exp/ssh: add Std{in,out,err}Pipe methods to Session
R=gustav.paul, cw, agl, rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/5433080
2011-12-01 08:30:16 -02:00
Alex Brainman
68e30a9765 time: fix windows build
R=rsc
CC=golang-dev
https://golang.org/cl/5440071
2011-12-01 15:26:28 +11:00
Rob Pike
9a86e244bf html/template: make execution thread-safe
The problem is that execution can modify the template, so it needs
interlocking to have the same thread-safe guarantee as text/template.
Fixes #2439.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5450056
2011-11-30 20:11:57 -08:00
Andrew Balholm
ce27b00f48 html: implement fragment parsing algorithm
Pass the tests in tests4.dat.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5447055
2011-12-01 12:47:57 +11:00
Joel Sing
595efd0d20 syscall: fix openbsd sysctl hostname/domainname workaround
Fixes #2509.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5451055
2011-12-01 10:17:33 +11:00
Rob Pike
07ee3cc741 html/template: update to new template API
Not quite done yet but enough is here to review.

Embedding is eliminated so clients can't accidentally reach
methods of text/template.Template that would break the
invariants.

TODO later: Add and Clone are unimplemented.
TODO later: address issue 2349

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5434077
2011-11-30 17:42:18 -05:00
Dave Cheney
0e62c75b9d undo CL 5436056 / 03560deae933
Remove the accidentally exported net.Listener

««« original CL description
exp/ssh: remove unused forwarding methods in Server Listener

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

»»»

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5437090
2011-11-30 17:14:03 -05:00
Ian Lance Taylor
bf43161c00 ld: align ELF data sections
fixes #2506

R=rsc, iant
CC=golang-dev
https://golang.org/cl/5440066
2011-11-30 13:24:16 -08:00
Russ Cox
97197a6248 time: fix windows build
TBR=brainman
CC=golang-dev
https://golang.org/cl/5447057
2011-11-30 15:45:24 -05:00
Charles L. Dorian
06e635e46d math: faster Sincos
Sincos via sincos.go is 35.4 ns/op, via sincos_amd64.s is 37.4 ns/op on 2.53 GHz Intel Core 2 Duo (Mac OS X).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5447045
2011-11-30 15:11:44 -05:00
Russ Cox
e62622b1b1 os: fix path/filepath test on Windows
This is not the right fix, but it is what used to happen
before the FileInfo conversion, and it should get the
build working again (at least that part).

TBR=brainman
CC=golang-dev
https://golang.org/cl/5434090
2011-11-30 13:42:14 -05:00
Russ Cox
e812db3558 encoding/asn1: fix test on OpenBSD
time.Parse uses time.Local if it has the right zone offset,
otherwise it calls time.FixedZone.  The test's use of reflect.DeepEqual
meant that the test expected time.FixedZone always, failing
when the local time zone really would have used -0700 for
that time.  The fix is to format the time to display only the
pieces we intend to test.

R=golang-dev, agl, iant
CC=golang-dev
https://golang.org/cl/5437088
2011-11-30 13:36:25 -05:00
Russ Cox
12eee9edbc os: fix windows build
TBR=brainman
CC=golang-dev
https://golang.org/cl/5449048
2011-11-30 12:38:54 -05:00
Roger Peppe
ca6de008ba math/big: fix destination leak into result value
This code would panic:
z := big.NewInt(1)
z.SetBit(big.NewInt(0), 2, 1)
if z.Cmp(big.NewInt(1<<2)) != 0 {
        panic("fail")
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5437081
2011-11-30 09:29:58 -08:00
Russ Cox
8dce57e169 os: new FileInfo, FileMode types + update tree
R=golang-dev, r, r, gri, bradfitz, iant, iant, nigeltao, n13m3y3r
CC=golang-dev
https://golang.org/cl/5416060
2011-11-30 12:04:16 -05:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Russ Cox
efe3d35fc5 time: new Time, Duration, ZoneInfo types
R=r, bradfitz, gri, dsymonds, iant
CC=golang-dev
https://golang.org/cl/5392041
2011-11-30 11:59:44 -05:00
Nigel Tao
849fc19cab html: clean up the z.rawTag calculation in the tokenizer.
R=andybalholm
CC=golang-dev
https://golang.org/cl/5440064
2011-11-30 17:00:37 +11:00
Andrew Balholm
3b3922771a html: parse <xmp> tags
Pass tests5.dat, test 10:
<p><xmp></xmp>

| <html>
|   <head>
|   <body>
|     <p>
|     <xmp>

Also pass the remaining tests in tests5.dat.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5440062
2011-11-30 15:37:41 +11:00
Andrew Balholm
e32f4ba77d html: parse the contents of <iframe> elements as raw text
Pass tests5.dat, test 4:
<iframe> <!---> </iframe>x

| <html>
|   <head>
|   <body>
|     <iframe>
|       " <!---> "
|     "x"

Also pass tests through test 9:
<style> <!</-- </style>x

R=nigeltao
CC=golang-dev
https://golang.org/cl/5450044
2011-11-30 11:44:54 +11:00
Gustav Paul
c6691d1fb4 exp/ssh: Add Start(cmd string) and Signal(sig string) to Session. Rename Exec to Run.
Exec() has been renamed to Run() in keeping with the os/exec API.

Added func (*Session) Start(cmd string) which starts a remote process but unlike Run() doesn't wait for it to finish before returning.

Run() has been refactored to use Start internally. Its really just a refactoring, no new code but some extra functionality was won.

Also added func (*Session) Signal(sig signal) which sends a UNIX signal to a remote process. This is espcially useful in conjunction with Start() as the two allow you to start a remote process, monitor its stdout/stderr, and send it a TERM/HUP/etc signal when you want it to close.

R=dave, rsc, agl, bradfitz, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5437058
2011-11-29 12:26:39 -05:00
Joel Sing
175e60a2ad crypto/tls: add openbsd root certificate location
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5437079
2011-11-29 09:20:59 -05:00
Luuk van Dijk
882368939c gc: move typedcl2 into export.c
R=rsc
CC=golang-dev
https://golang.org/cl/5447043
2011-11-29 13:34:08 +01:00
Nigel Tao
929290d5a0 html: spin doctype.go out of parse.go.
R=andybalholm
CC=golang-dev
https://golang.org/cl/5445049
2011-11-29 18:20:59 +11:00
Alex Brainman
fbdec642a9 runtime: make sure windows/amd64 stack is 16-byte aligned on syscall entry (fixes build)
R=golang-dev, vcc.163
CC=golang-dev
https://golang.org/cl/5445051
2011-11-29 12:57:20 +11:00
Andrew Balholm
c32b607687 html: detect quirks mode
Pass tests3.dat, test 23:
<p><table></table>

| <html>
|   <head>
|   <body>
|     <p>
|       <table>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5446043
2011-11-29 11:18:49 +11:00
Alex Brainman
6d4c18a4af syscall: implement Syscall15
Fixes #2251.

R=golang-dev, rsc
CC=golang-dev, jp
https://golang.org/cl/5440050
2011-11-29 10:24:19 +11:00
Andrew Gerrand
5a18aef67c goinstall: add -fix flag to run gofix on packages on build failure
goinstall: better error handling and reporting

R=r, r, rsc, mattn.jp
CC=golang-dev
https://golang.org/cl/5421051
2011-11-29 09:28:58 +11:00
Russ Cox
8e515485e2 gc: remove funarg special case in structfield
This should make CL 5431046 a little simpler.

R=ken2
CC=golang-dev
https://golang.org/cl/5444048
2011-11-28 16:40:39 -05:00
Charles L. Dorian
c8d2544b26 math: update special-conditions comments to use ± symbol
R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/5445046
2011-11-28 13:04:52 -08:00
Dave Cheney
4cc64bd5bf exp/ssh: move openChan to NewSession
openChan was only being called by NewSession, Dial has
its own version.

R=gustav.paul, agl, rsc
CC=golang-dev
https://golang.org/cl/5435071
2011-11-28 15:42:47 -05:00
Adam Langley
1eb7ca924b crypto/tls: don't rely on map iteration order.
Previously we were using the map iteration order to set the order of
the cipher suites in the ClientHello.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5440048
2011-11-28 15:34:16 -05:00
Rob Pike
5f6027e9ad text/template: address a couple of issues for html/template
- allow Lookup to work on uninitialized templates
- fix bug in add: can't error after parser is stopped
- add Add method for html/template

R=adg, rogpeppe, r, rsc
CC=golang-dev
https://golang.org/cl/5436080
2011-11-28 10:42:57 -08:00
Christopher Wedgwood
356b8ee26f strings: fix test output
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5445044
2011-11-28 09:51:03 -08:00
Christopher Wedgwood
7600281bda bytes: fix test output
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5441048
2011-11-28 09:50:51 -08:00
Dave Cheney
b57bb9282e exp/ssh: add safeString error sanitiser
R=huin, agl, gustav.paul, cw
CC=golang-dev
https://golang.org/cl/5399044
2011-11-28 12:29:19 -05:00
Rémy Oudompheng
60e4a61d30 gc: don't inherit orig from subnodes in constant expression nodes.
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes #2452.

R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
2011-11-28 12:22:15 -05:00
Dave Cheney
ce7e11997b exp/ssh: fix three shift bugs related to packet lengths
Thanks for Ke Lan for the initial report and investigation.

R=agl, gustav.paul, tg8866, rsc
CC=golang-dev
https://golang.org/cl/5443044
2011-11-28 12:10:16 -05:00
Maxim Pimenov
ffa6b383f5 gc: fix copying of types
reset xmethod during copytype

Fixes #2497

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5441045
2011-11-28 11:52:16 -05:00
Brad Fitzpatrick
1e85f41fd5 http: fix sniffing bug causing short writes
R=rsc
CC=golang-dev
https://golang.org/cl/5442045
2011-11-28 11:51:34 -05:00
Brad Fitzpatrick
e77099daa2 sql: add Tx.Stmt to use an existing prepared stmt in a transaction
R=rsc
CC=golang-dev
https://golang.org/cl/5433059
2011-11-28 11:00:32 -05:00
Gustav Paul
23227f3d63 exp/ssh: fix misleading spelling mistake in comment
R=dave, agl, rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5431089
2011-11-28 10:45:52 -05:00
Gustavo Niemeyer
a620865639 filepath/path: fix Rel buffer sizing
Fixes #2493.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5433079
2011-11-27 21:28:52 -05:00
Charles L. Dorian
f1fecf8d2a math: fix typo in Log1p comments
Also note the special case of -0.0.

R=rsc, golang-dev, gri
CC=golang-dev
https://golang.org/cl/5435084
2011-11-27 18:01:08 -08:00
Andrew Balholm
68e7363b56 html: parse <nobr> elements
Pass tests3.dat, test 20:
<!doctype html><nobr><nobr><nobr>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <nobr>
|     <nobr>
|     <nobr>

Also pass tests through test 22:
<!doctype html><html><body><p><table></table></body></html>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5438056
2011-11-28 10:55:31 +11:00
Michael T. Jones
4c113ffe16 math/big: use recursive subdivision for significant speedup
This change adds the second aspect to the conversion code, the
use of large divisiors (powers of big base) to greatly speed up
the divsion of large numbers. Speedups of 30x are common in the
large cases. Also includes new tests and tuning code for the
key internal parameters.

R=gri
CC=golang-dev
https://golang.org/cl/5438058
2011-11-27 11:10:59 -08:00
Gustav Paul
d859d7deee exp/ssh: messages now contain remote channel's id instead of local id
According to http://www.ietf.org/rfc/rfc4254.txt most channel messages contain the channel id of the recipient channel, not the sender id. This allows the recipient connection multiplexer to route the message to the correct channel.

This changeset fixes several messages that incorrectly send the local channel id instead of the remote channel's id.

While sessions were being created and closed in sequence channels in the channel pool were freed and reused on the server side of the connection at the same rate as was done on the client, so the channel local and remote channel ids always corresponded. As soon as I had concurrent sessions on the same clientConn the server started to complain of 'uknown channel id N' where N is the local channel id, which is actually paired with server channel id K.

R=golang-dev, dave, rsc, agl
CC=golang-dev
https://golang.org/cl/5433063
2011-11-27 09:59:20 -05:00
Andrew Balholm
557ba72e69 html: ignore <head> tags in <head> element
Pass tests3.dat, test 12:
<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>

| <!DOCTYPE html>
| <html>
|   <head>
|     <meta>
|   <body>

Also pass tests through test 19:
<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5436069
2011-11-27 14:41:08 +11:00
Rob Pike
e9025df7ad text/template: rename the method Template.Template to Template.Lookup
Calling it Template makes it clumsy to embed the type, which html/template
depends on.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5432079
2011-11-26 08:32:55 -08:00
Alex Brainman
e38a1053a9 os: fail if Open("") is called on windows
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5432071
2011-11-26 11:01:49 +11:00
Benny Siegert
5519b5d716 exp/sql/driver: Correct package name in comment.
IIRC, package sql used to be called db. There was one occurrence
of the old name in a comment.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5431075
2011-11-25 10:57:10 -05:00
Dmitriy Vyukov
a899a467f2 time: fix timer stop
Due to data structure corruption,
some timers could not be removed.
Fixes #2495.

R=golang-dev, adg
CC=golang-dev, mdbrown
https://golang.org/cl/5437060
2011-11-25 14:13:10 +03:00
Andrew Gerrand
38c082f69e html/template: fix documentation indent
R=nigeltao
CC=golang-dev
https://golang.org/cl/5437061
2011-11-25 13:32:44 +11:00
Rob Pike
0197cc49ae text/template: fix bug in Clone
Cloned template copied the root template incorrectly.
Add test of self-consistency.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5436063
2011-11-24 16:07:19 -08:00
Scott Lawrence
0f0c25dccc strings: Add ContainsAny and ContainsRune to correspond to IndexAny etc.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5430046
2011-11-23 20:20:14 -08:00
Rob Pike
da62104169 gofix: trivial rewrite for template.ParseFiles
Also warn about uses of Set.

R=rsc
CC=golang-dev
https://golang.org/cl/5436051
2011-11-23 20:17:41 -08:00
Rob Pike
f56db6f534 text/template: new, simpler API
The Set type is gone. Instead, templates are automatically associated by
being parsed together; nested definitions implicitly create associations.
Only associated templates can invoke one another.

This approach dramatically reduces the breadth of the construction API.

For now, html/template is deleted from src/pkg/Makefile, so this can
be checked in. Nothing in the tree depends on it. It will be updated next.

R=dsymonds, adg, rsc, r, gri, mikesamuel, nigeltao
CC=golang-dev
https://golang.org/cl/5415060
2011-11-23 20:17:22 -08:00
Andrew Balholm
af081cd43e html: ingore newline at the start of a <pre> block
Pass tests3.dat, test 4:
<!DOCTYPE html><html><head></head><body><pre>\n</pre></body></html>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <pre>

Also pass tests through test 11:
<!DOCTYPE html><pre>&#x0a;&#x0a;A</pre>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5437051
2011-11-24 13:15:09 +11:00
Robert Griesemer
63e48ccd8e go/ast: trivial cleanup (remove superfluous string conversion)
R=iant, bradfitz
CC=golang-dev
https://golang.org/cl/5430059
2011-11-23 16:20:55 -08:00
Andrew Balholm
77b0ad1e80 html: parse DOCTYPE into name and public and system identifiers
Pass tests2.dat, test 59:
<!DOCTYPE <!DOCTYPE HTML>><!--<!--x-->-->

| <!DOCTYPE <!doctype>
| <html>
|   <head>
|   <body>
|     ">"
|     <!-- <!--x -->
|     "-->"

Pass all the tests in doctype01.dat.

Also pass tests2.dat, test 60:
<!doctype html><div><form></form><div></div></div>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5437045
2011-11-24 09:28:58 +11:00
Robert Griesemer
b3923a27dd go/printer, gofmt: more performance tweaks
Removed more string conversions and streamlined bottleneck
printing interface by removing unnecessary tests where possible.
About 6% faster AST printing.

Before:
- printer.BenchmarkPrint		50	32056640 ns/op

After:
- printer.BenchmarkPrint		50	30138440 ns/op (-6%)

R=r
CC=golang-dev
https://golang.org/cl/5431047
2011-11-23 09:27:38 -08:00
Rémy Oudompheng
8362ee99b0 fmt: don't check for nil when printing arrays as Go syntax.
Also add array values to printing test suite.
Fixes #2468.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5436053
2011-11-23 09:04:02 -08:00
Adam Langley
8281f6bd1b crypto/openpgp/packet: fix private key checksum
I misinterpreted http://tools.ietf.org/html/rfc4880#section-5.5.3
and implemented the sum of 16-bit values, rather than the 16-bit sum
of 8-bit values.

Thanks to Szabolcs Nagy for pointing it out.

R=bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/5372091
2011-11-23 09:44:29 -05:00
Dave Cheney
f2c858749a exp/ssh: add simple tcpip.go functional tests
R=rsc, agl, n13m3y3r, bradfitz
CC=golang-dev
https://golang.org/cl/5385041
2011-11-23 09:38:11 -05:00
Dave Cheney
d5514120b1 exp/ssh: remove unused forwarding methods in Server Listener
R=agl, rsc
CC=golang-dev
https://golang.org/cl/5436056
2011-11-23 09:35:01 -05:00
Robert Griesemer
4874d14180 go/printer: remove "written" result value - is never used
R=r
CC=golang-dev
https://golang.org/cl/5436052
2011-11-22 15:27:10 -08:00
Robert Griesemer
a0e54aaffa go/printer, gofmt: 20 to 30% faster gofmt
Buffer intermediate output via a bytes.Buffer and thus avoid
calling through the entire Writer stack for every item printed.
There is more opportunity for improvements along the same lines.

Before (best of 3 runs):
- printer.BenchmarkPrint	      50	  47959760 ns/op
- time gofmt -l $GOROOT/src	      real	  0m11.517s

After (best of 3 runs):
- printer.BenchmarkPrint	      50	  32056640 ns/op (= -33%)
- time gofmt -l $GOROOT/src	      real	  0m9.070s       (= -21%)

R=r
CC=golang-dev
https://golang.org/cl/5432054
2011-11-22 15:12:34 -08:00
Andrew Balholm
57ed39fd3b html: on EOF in a comment, ignore final dashes (up to 2)
Pass tests2.dat, test 57:
<!DOCTYPE html><!--x--

| <!DOCTYPE html>
| <!-- x -->
| <html>
|   <head>
|   <body>

Also pass test 58:
<!DOCTYPE html><table><tr><td></p></table>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5436048
2011-11-23 09:26:37 +11:00
Russ Cox
fe838c2ddb encoding/xml: fix copy bug
Fixes #2484.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5417059
2011-11-22 12:31:33 -05:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Russ Cox
c69d6345da os: make ReadAt comment clearer
Fixes #2486.

R=golang-dev, hanwen
CC=golang-dev
https://golang.org/cl/5417064
2011-11-22 12:22:28 -05:00
Dmitriy Vyukov
11e73b89ca cgo: add support for callbacks from dynamic libraries
R=golang-dev, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5375042
2011-11-22 17:57:49 +03:00
Andrew Balholm
95e60acb97 html: copy attributes from extra <html> tags to root element
Pass tests2.dat, test 50:
<!DOCTYPE html><html><body><html id=x>

| <!DOCTYPE html>
| <html>
|   id="x"
|   <head>
|   <body>

Also pass tests through test 56:
<!DOCTYPE html>X<p/x/y/z>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5432045
2011-11-22 12:08:22 +11:00
Andrew Balholm
750de28d6c html: ignore whitespace before <head> element
Pass tests2.dat, test 47:
" \n "
(That is, two spaces separated by a newline)

| <html>
|   <head>
|   <body>

Also pass tests through test 49:
<!DOCTYPE html><script>
</script>  <title>x</title>  </head>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5422043
2011-11-22 09:27:27 +11:00
Andrew Gerrand
86c08e9611 goinstall: support googlecode subrepos and add repo match tests
goinstall: don't hit network unless a checkout or update is required

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5343042
2011-11-22 07:10:25 +11:00
Adam Langley
7c161b05aa crypto/x509, crypto/tls: support PKCS#8 private keys.
OpenSSL 1.0.0 has switched to generating PKCS#8 format private keys by
default. This change allows http.ListenAndServeTLS to work with either
types of keys.

See http://groups.google.com/group/golang-nuts/browse_thread/thread/84715b5f0c9e3c30/63a8a27b53e102a6

R=bradfitz
CC=golang-dev
https://golang.org/cl/5416059
2011-11-21 14:18:42 -05:00
Benny Siegert
85255f9942 bcrypt: Correct typo in package comment.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5415062
2011-11-21 09:11:34 -08:00
Brad Fitzpatrick
6c9f466273 json: speed up encoding, caching reflect calls
Before
json.BenchmarkCodeEncoder  10  181232100 ns/op  10.71 MB/s
json.BenchmarkCodeMarshal  10  184578000 ns/op  10.51 MB/s

After:
json.BenchmarkCodeEncoder  10  146444000 ns/op  13.25 MB/s
json.BenchmarkCodeMarshal  10  151428500 ns/op  12.81 MB/s

R=rsc, r
CC=golang-dev
https://golang.org/cl/5416046
2011-11-21 07:49:14 -08:00
Charles L. Dorian
f3aa54e30d math: faster Cbrt
For amd64, from 127 to 105 ns/op; for 386, from 208 to 169 ns/op.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5412056
2011-11-21 09:56:07 -05:00
Lucio De Re
8ec32e8d84 syscall: fix for Plan 9 build
exec_plan9.go:
. Adjusted return argument to match other changes.
#mksyscall.pl:
. Replaced "err = e1" with "err = NewError(e1)".
* Change abandoned, Russ made a better suggestion involving
  syscall_plan9.go.
syscall_plan9.go:
. Removed redundant "err = nil" lines.
. Adjusted //sys lines for mksyscall.pl.
* Replaced "err string" with "err ErrorString" in return arguments.
zsyscall_plan9_386.go:
. This module ought to be generated, but as it exists in the
  repository, I rebuilt it and checked that it matched expectations.
  Anybody is welcome to remove this from the repository if
  they feel it should go, but remember that not all Plan 9
  installations have a working Perl.

R=rsc
CC=ality, golang-dev
https://golang.org/cl/5411046
2011-11-21 09:55:15 -05:00
Russ Cox
2e9d7a6d1c gofix: test and fix missorted renames
Also introduce a new insertion heuristic:
insert new import next to existing import
with the longest matching prefix.

R=golang-dev, adg, gri
CC=golang-dev
https://golang.org/cl/5412053
2011-11-21 09:41:25 -05:00
Brad Fitzpatrick
750d0e33fb sql: more driver docs & tests; no functional changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5415055
2011-11-20 14:56:49 -05:00
Dave Cheney
fb57134d47 exp/ssh: alter Session to match the exec.Cmd API
This CL inverts the direction of the Stdin/out/err members of the
Session struct so they reflect the API of the exec.Cmd. In doing so
it borrows heavily from the exec package.

Additionally Shell now returns immediately, wait for completion using
Wait. Exec calls Wait internally and so blocks until the remote
command is complete.

Credit to Gustavo Niemeyer for the impetus for this CL.

R=rsc, agl, n13m3y3r, huin, bradfitz
CC=cw, golang-dev
https://golang.org/cl/5322055
2011-11-20 11:46:35 -05:00
Andrew Balholm
05d8d112fe html: refactor parse test infrastructure
My excuse for doing this is that test cases with newlines in them didn't
work. But instead of just fixing that, I rearranged everything in
parse_test.go to use fewer channels and pipes, and just call a
straightforward function to read test cases from a file.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5410049
2011-11-20 22:42:28 +11:00
Nigel Tao
dbb591d8da exp/gui: delete exp/gui and exp/gui/x11. They are moving to
x-go-binding.googlecode.com.

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5406041
2011-11-20 21:56:17 +11:00
Sébastien Paolacci
e2467f047b syscall: add SUSv3 RLIMIT/RUSAGE constants
R=golang-dev, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/5369092
2011-11-19 15:17:40 +09:00
Robert Griesemer
8218251498 go/printer: cleanup more string/byte conversions
Slight slow-down for printer benchmark (-0.7%) before
applying CL 5416049 (which will wash it out). Code is
cleaner and simpler.

R=rsc
CC=golang-dev
https://golang.org/cl/5417053
2011-11-18 20:55:35 -08:00
Lucio De Re
7f417d8d66 libmach: fix for Plan 9 build
R=rsc
CC=golang-dev
https://golang.org/cl/5316059
2011-11-18 23:11:50 -05:00
Robert Griesemer
17e493a2b1 go/printer: remove gratuitous string/[]byte conversions
Cleanup and slight performance improvement (1.5%).

Before (best of 3 runs):
printer.BenchmarkPrint	      50	  47377420 ns/op

After (best of 3 runs):
printer.BenchmarkPrint	      50	  46707180 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5416049
2011-11-18 19:10:45 -08:00
Andrew Gerrand
6c864210fc html/template: fix documentation formatting
See http://weekly.golang.org/pkg/html/template/

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5413055
2011-11-19 10:54:44 +11:00
Lucio De Re
5b9d7825ed html/template, net/http, websocket: fix import paths in comments
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5411048
2011-11-18 18:33:44 -05:00
Rémy Oudompheng
29e3ef88af cgo: document export of Go functions to C.
R=mpimenov, rsc
CC=golang-dev, remy
https://golang.org/cl/5376082
2011-11-18 18:24:59 -05:00
Rob Pike
10e012c85f template/parse: rename Set to Parse
Preamble to the simplification of the template API.
Although the signature of Parse (nee Set) changes,
it's really an internal function, used only by
text/template.

R=golang-dev, rsc, gri, r
CC=golang-dev
https://golang.org/cl/5415052
2011-11-18 13:10:15 -08:00
Adam Langley
5cad861136 crypto/x509: fix documentation typos
Thanks to Jeff R. Allen for pointing them out.

R=bradfitz, gri
CC=golang-dev
https://golang.org/cl/5412052
2011-11-18 15:48:34 -05:00
Lucio De Re
aa3dbf2947 syscall: fix env routines for Plan 9
R=golang-dev
CC=ality, golang-dev, rsc
https://golang.org/cl/5364063
2011-11-18 13:36:06 -05:00
John Beisley
0e60804b4a exp/ssh: Add support for (most) of the ciphers from RFC4253, RFC4344 and RFC4345.
R=dave, agl, taruti, rsc, r
CC=golang-dev
https://golang.org/cl/5342057
2011-11-18 12:56:57 -05:00
Dmitriy Vyukov
151bcb11a8 exp/terminal: fix Makefile formatting for deps.bash
deps.bash does not understand current format,
so make.bash fails (with MAKEFLAGS=-j20).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5410046
2011-11-18 15:30:36 +03:00
Rob Pike
25d2987dd9 text/template: refactor set parsing
Parse {{define}} blocks during template parsing rather than separately as a set-specific thing.
This cleans up set parse significantly, and enables the next step, if we want, to unify the
API for templates and sets.
Other than an argument change to parse.Parse, which is in effect an internal function and
unused by client code, there is no API change and no spec change yet.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5393049
2011-11-17 22:53:23 -08:00
Gustavo Niemeyer
558d055352 exp/terminal: fix build after os.Errno changes
Also include exp/terminal in linux build so such failures
are noticed.

R=rsc
CC=golang-dev
https://golang.org/cl/5416044
2011-11-18 01:12:57 -02:00
Anthony Martin
4a2d30e13b runtime: add nanotime for Plan 9
R=paulzhol, rsc, dave, rminnich
CC=golang-dev
https://golang.org/cl/5327063
2011-11-17 22:09:28 -05:00
Gustavo Niemeyer
f6279b46f8 html: fix doc after Err method name change
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5411045
2011-11-18 01:06:59 -02:00
Alex Brainman
9bfe9dfde7 mime: remove ".wav" from tests (to fix build)
It looks like not all computers have
mime type for .wav extension.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5415045
2011-11-18 13:24:17 +11:00
Alex Brainman
ac17fd4cd2 mime: implement TypeByExtension for windows
Fixes #2071.

R=golang-dev, hcwfrichter, pascal, rsc
CC=golang-dev
https://golang.org/cl/5369056
2011-11-18 10:07:36 +11:00
Robert Griesemer
9859af879b godoc: provide mode for flat (non-indented) directory listings
This feature should make it easier to look at very large
directory trees.

- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
  indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
  now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
  presented with slightly less indentation
- there is an internal hook for programmatic control of the
  display mode (for specialized versions of godoc).

R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
2011-11-17 14:47:49 -08:00
Joel Sing
ea2c0cd88f os: re-enable hostname test on openbsd
Now that Sysctl() works, re-enable the hostname test.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5408042
2011-11-18 01:53:07 +11:00
Joel Sing
9b571a3120 syscall: hostname/domainname fix for openbsd
Work around a bug that was fixed after OpenBSD 5.0 - a request for
kern.hostname or kern.domainname with a nil value for oldp will result
in a length of zero being returned. If we hit this case use a length
of MAXHOSTNAMELEN (256).

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5408041
2011-11-18 01:52:39 +11:00
Joel Sing
773a921ccb syscall: implement nametomib for openbsd.
Move the existing darwin/freebsd specific nametomib implementation
into the respective operating system dependent files.

Provide a nametomib implementation for openbsd, which operates on a
sysctl MIB that has been pre-generated from the various system headers
by mksysctl_openbsd.pl.

R=rsc
CC=golang-dev
https://golang.org/cl/4935044
2011-11-17 23:13:49 +11:00
Andrew Balholm
a1dbfa6f09 html: parse <isindex>
Pass tests2.dat, test 42:
<isindex test=x name=x>

| <html>
|   <head>
|   <body>
|     <form>
|       <hr>
|       <label>
|         "This is a searchable index. Enter search keywords: "
|         <input>
|           name="isindex"
|           test="x"
|       <hr>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5399049
2011-11-17 13:12:13 +11:00
Andrew Gerrand
0b1bcf8f94 http: fix serving from CWD with http.ServeFile
http: make Dir("") equivalent to Dir(".")

Fixes #2471.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5370061
2011-11-17 11:42:25 +11:00
Alex Brainman
3ec82f6e09 exp/ssh: change test listen address, also exit test if fails
R=golang-dev, rsc
CC=dave, golang-dev
https://golang.org/cl/5364061
2011-11-17 11:20:42 +11:00
Russ Cox
a479a45548 reflect: make Value an opaque struct
Making Value opaque means we can drop the interface kludges
in favor of a significantly simpler and faster representation.
v.Kind() will be a prime candidate for inlining too.

On a Thinkpad X201s using -benchtime 10:

benchmark                           old ns/op    new ns/op    delta
json.BenchmarkCodeEncoder           284391780    157415960  -44.65%
json.BenchmarkCodeMarshal           286979140    158992020  -44.60%
json.BenchmarkCodeDecoder           717175800    388288220  -45.86%
json.BenchmarkCodeUnmarshal         734470500    404548520  -44.92%
json.BenchmarkCodeUnmarshalReuse    707172280    385258720  -45.52%
json.BenchmarkSkipValue              24630036     18557062  -24.66%

benchmark                            old MB/s     new MB/s  speedup
json.BenchmarkCodeEncoder                6.82        12.33    1.81x
json.BenchmarkCodeMarshal                6.76        12.20    1.80x
json.BenchmarkCodeDecoder                2.71         5.00    1.85x
json.BenchmarkCodeUnmarshal              2.64         4.80    1.82x
json.BenchmarkCodeUnmarshalReuse         2.74         5.04    1.84x
json.BenchmarkSkipValue                 77.92       103.42    1.33x

I cannot explain why BenchmarkSkipValue gets faster.
Maybe it is one of those code alignment things.

R=iant, r, gri, r
CC=golang-dev
https://golang.org/cl/5373101
2011-11-16 19:18:25 -05:00
Russ Cox
4d27f64863 gofmt: do not stop test.sh after 1 error
Fix bug377.go to be gofmt-compliant.

R=gri, r, r
CC=golang-dev
https://golang.org/cl/5400045
2011-11-16 18:44:21 -05:00
Andrew Balholm
3276afd4d4 html: parse </optgroup> and </option>
Pass tests2.dat, test 35:
<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|       <option>
|     <option>

Also pass tests through test 41:
<!DOCTYPE html><!-- XXX - XXX - XXX -->

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/5395045
2011-11-17 10:25:33 +11:00
Russ Cox
8c6461bcb1 exp/ssh: fix test?
Fixes use of c after Dial failure (causes crash).
May fix Dial failure by listening to 127.0.0.1:0
instead of 0.0.0.0:0 (tests should only listen on
localhost).

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5395052
2011-11-16 18:13:50 -05:00
Russ Cox
7d1d8fe430 go/printer: make //line formatting idempotent
Fixes "test.sh" (long test) in src/cmd/gofmt.

R=gri
CC=golang-dev
https://golang.org/cl/5307081
2011-11-16 17:55:35 -05:00
Lucio De Re
087a34869a syscall, os, time: fix Plan 9 build
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5371092
2011-11-16 17:37:54 -05:00
Christopher Wedgwood
8fdd6c05b1 exp/ssh: add to pkg Makefile
R=rsc, dave
CC=golang-dev
https://golang.org/cl/5399045
2011-11-16 17:34:18 -05:00
Anthony Martin
920df48fb1 gc: support for building with Plan 9 yacc
I've modified Plan 9's yacc to work with
the grammar in go.y.  These are the only
changes necessary on the Go side.

R=rsc
CC=golang-dev
https://golang.org/cl/5375104
2011-11-16 16:58:02 -05:00
Robert Griesemer
d0b9a84ab3 go/ast: remove unused receiver names (cleanup)
R=iant, iant
CC=golang-dev
https://golang.org/cl/5393047
2011-11-16 13:41:26 -08:00
Lucio De Re
293059ad85 cov: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5374086
2011-11-16 16:23:50 -05:00
Gustavo Niemeyer
c9355596cd net/http: fix EOF handling on response body
http.Response is currently returning 0, nil on EOF.

R=golang-dev, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/5394047
2011-11-16 17:35:47 -02:00
Brad Fitzpatrick
881f2076fb fcgi: fix server capability discovery
The wrong length was being sent, and two parameters
were also transposed. Made the record type be a type
and made the constants typed, to prevent that sort
of bug in the future.

Fixes #2469

R=golang-dev, edsrzf
CC=golang-dev
https://golang.org/cl/5394046
2011-11-16 10:11:39 -08:00
Rob Pike
f5db4d05f2 html/template: indirect top-level values before printing
text/template does this (in an entirely different way), so
make html/template do the same. Before this fix, the template
{{.}} given a pointer to a string prints its address instead of its
value.

R=mikesamuel, r
CC=golang-dev
https://golang.org/cl/5370098
2011-11-16 09:32:52 -08:00
Dave Cheney
00f9b7680a exp/ssh: fix unmarshal test
Ensure that empty NameLists always return
a zero length []string, not nil.

In practice NameLists are only used in a few
message types and always consumed by a for
range function so the difference between nil
and []string{} is not significant.

Also, add exp/ssh to pkg/Makefile as suggested
by rsc.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5400042
2011-11-16 10:19:56 -05:00
Andrew Balholm
3307597069 html: parse <optgroup> tags
Pass tests2.dat, test 34:
<!DOCTYPE html><select><option><optgroup>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <select>
|       <option>
|       <optgroup>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5393045
2011-11-16 19:25:55 +11:00