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

5560 Commits

Author SHA1 Message Date
Alex Brainman
238af7700e net: fix windows build
Ignore result of setting SO_BROADCAST.

Disable TestSimpleListenMulticastUDP as
setIPv4MulticastInterface is not implemented.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5610044
2012-02-01 12:13:46 +11:00
Robert Griesemer
f7d473dd33 go/doc: added error, rune to list of predeclared types
Don't throw away factory functions returning error or rune.

Fixes #2820.

R=rsc
CC=golang-dev
https://golang.org/cl/5604046
2012-01-31 15:41:25 -08:00
Russ Cox
d7c04517a0 fmt: fix caching bug in Scan
Black box test is too time-consuming, as the bug
does not appear until Scan has processed 2 GB of
input in total across multiple calls, so no test.

Thanks to Frederick Mayle for the diagnosis and fix.

Fixes #2809.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5611043
2012-01-31 18:38:33 -05:00
Brad Fitzpatrick
d3285f2a79 net: remove types InvalidConnError and UnknownSocketError
Both are unused and undocumented.

InvalidConnError is also non-idiomatic: a FooError type can
typically describe something, else it would be an ErrFoo
variable.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5609045
2012-01-31 15:04:42 -08:00
Rémy Oudompheng
e818536500 go: record location of failed imports for error reporting.
Fixes #2664.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5593047
2012-01-31 23:37:01 +01:00
Brad Fitzpatrick
549ca930a0 net: move DNSConfigError to a portable file
The type being unavailable on Windows was the only API
signature difference in the net package.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5608043
2012-01-31 13:01:34 -08:00
Robert Griesemer
3c6bebf5a7 go/doc: enable AllMethods flag (and fix logic)
- enable AllMethods flag (default: not set)
- fix logic determining which methods to show
- added respective test case in testdata/e.go for AllMethods = false
- added test case set for AllMethods = true

The critical changes/files to look at are:
- testdata/e{0,1,2}.golden: T4.M should only show up as method of T5 in e2.golden
- reader.go: always include top-level methods, and negate former logic for embedded methods
  (rewrote as a switch for better comprehensability)

Fixes #2791.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5576057
2012-01-31 09:48:10 -08:00
Brad Fitzpatrick
c0ecfb072b net/http: close client fd sooner on response read error
This fixes some test noise in TestStressSurpriseServerCloses when
ulimit -n something low, like 256 on a Mac.

Previously, when the server closed on us and we were expecting more
responses (like we are in that test), we'd read an "Unexpected EOF"
and just forget about the client's net.Conn.  Now it's closed,
rather than waiting on the finalizer to release the fd.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5602043
2012-01-31 09:45:13 -08:00
Mikio Hara
847197d339 net: disable normal multicast testing on linux/arm
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5603043
2012-02-01 02:42:56 +09:00
Adam Langley
2cc3351131 crypto/elliptic: p224Contract could produce a non-minimal representation.
I missed an overflow in contract because I suspected that the prime
elimination would take care of it. It didn't, and I forgot to get back
to the overflow. Because of this, p224Contract may have produced a
non-minimal representation, causing flakey failures ~0.02% of the
time.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5592045
2012-01-31 12:27:42 -05:00
Mikio Hara
2f63afdc7a net: ListenMulticastUDP to listen concurrently across multiple listeners
This CL introduces new function ListenMulticastUDP to fix
multicast UDP listening across multiple listeners issue,
to replace old multicast methods JoinGroup and LeaveGroup
on UDPConn.

This CL also enables multicast testing by default.

Fixes #2730.

R=rsc, paul.a.lalonde, fullung, devon.odell
CC=golang-dev
https://golang.org/cl/5562048
2012-02-01 01:53:26 +09:00
Adam Langley
c86e03975c crypto/tls: better error message when connecting to SSLv3 servers.
We support SSLv3 as a server but not as a client (and we don't want to
support it as a client). This change fixes the error message when
connecting to an SSLv3 server since SSLv3 support on the server side
made mutualVersion accept SSLv3.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5545073
2012-01-31 11:22:47 -05:00
Russ Cox
31d908baaf net: fix windows build
TBR=mikioh
CC=golang-dev
https://golang.org/cl/5588048
2012-01-31 11:20:34 -05:00
Adam Langley
8efb304440 crypto/x509: use case-insensitive hostname matching.
Fixes #2792.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5590045
2012-01-31 11:00:16 -05:00
Russ Cox
9a15c2186c build: move goapi, quietgcc, cgo, gotype, ebnflint into go-tool
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5552054
2012-01-31 10:38:07 -05:00
Mikio Hara
28397befab net: replace error variable name e, errno with err
R=rsc, r
CC=golang-dev
https://golang.org/cl/5593046
2012-02-01 00:36:45 +09:00
Joel Sing
1677f1a163 os/exec: TestExtraFiles - close any leaked file descriptors
Ensure that file descriptors have not already been leaked into our
environment - close any that are open at the start of the
TestExtraFiles test.

Also use the appropriate command for listing open files.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5574062
2012-01-31 22:09:06 +11:00
Damian Gryski
85aeeadaec runtime: use per-map hash seeds
This patch adds a hash seed to the Hmap struct.  Each seed is
initialized by runtime.fastrand1().  This is the first step of a
solution to issue 2630.  Fastrand1 still needs to be updated to provide
us with actually random bits.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5599046
2012-01-31 00:37:03 -05:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Russ Cox
56e6a02490 runtime: fix mkasmh.sh for arm?
The builder is Debian, so maybe running dash,
the shell that time forgot.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5600053
2012-01-30 23:17:11 -05:00
Anthony Martin
bacb1b70f7 runtime: fix mkasmh.h
We weren't properly deleting the various header
files (that were temporarily renamed) if a $CC
for the current $GOARCH didn't exist.  And since
the compiler checks the current directory for
headers before any -I arguments, this had the
unfortunate side effect of including the last
generated headers instead of the correct ones.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5581055
2012-01-30 19:25:40 -08:00
Nigel Tao
10498f4d33 image: remove image/bmp and image/tiff from std.
They have moved to the code.google.com/p/go.image subrepo.

R=rsc
CC=golang-dev
https://golang.org/cl/5552052
2012-01-31 14:01:53 +11:00
Rob Pike
91cb3489ab go: move compilers into the go-tool directory
Also delete gotest, since it's messy to fix and slated for deletion anyway.
A couple of things outside src can't be tested any more. "go test" will be
fixed and these tests will be re-enabled. They're noisy for now.

Fixes #284.

R=rsc
CC=golang-dev
https://golang.org/cl/5598049
2012-01-30 14:46:31 -08:00
Brad Fitzpatrick
eb53d472ef doc: use consistent receiver names, when it makes sense.
Makes for prettier docs.

R=golang-dev, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5576056
2012-01-30 11:58:49 -08:00
Brad Fitzpatrick
25c96cba2e json: remove old optimization that inlining covers now
Benchmarks look the same.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5572080
2012-01-30 11:42:09 -08:00
Gustavo Niemeyer
9c497443ae encoding/xml: fix decoding of xml.Name with sub-elements
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5569090
2012-01-30 16:32:48 -02:00
Russ Cox
cb34f5c357 compress/flate: undo misuse of skipNever
I assume this was a too aggressive search-and-replace.

R=imkrasin
CC=golang-dev
https://golang.org/cl/5580047
2012-01-30 13:24:20 -05:00
Russ Cox
e451fb8ffb fmt: add test of NaN map keys
R=r
CC=golang-dev
https://golang.org/cl/5564063
2012-01-30 13:20:38 -05:00
Olivier Duperray
74e8a1308a pkg/go/scanner: Fix Typical use output
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5595045
2012-01-30 09:58:25 -08:00
Russ Cox
022aac7883 runtime: fix float64 hash
R=ken2
CC=golang-dev
https://golang.org/cl/5580046
2012-01-30 11:10:59 -05:00
Volker Dobler
ed7a8f7159 net/http: Fix nil pointer dereference in error case.
R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/5598044
2012-01-30 07:57:50 -08:00
Alex Brainman
dcbc77d2cf os/user: windows implementation
pjmlp gets credit for initial version.

Fixes #1789.

R=paulo.jpinto, bradfitz, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/5543069
2012-01-30 22:59:10 +11:00
Gustavo Niemeyer
1e5b7e706e cmd/goinstall: remove now that 'go get' works
The changes to builder were not tested.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5572083
2012-01-29 17:22:20 -02:00
Volker Dobler
d91ade02e7 net/http: set cookies in client jar on POST requests.
Cookies recieved in a response to a POST request are stored
in the client's jar like they are for GET requests.

R=golang-dev, rsc
CC=bradfitz, golang-dev
https://golang.org/cl/5576065
2012-01-29 14:16:11 -05:00
Rob Pike
71d83b72ef cmd/go: add go tools to rearrangement
fix, vet
yacc is also fixed (it was wrong before)
All that's left is the commands used during compilation
This looks like a huge CL, but it's almost all file renames.
The action is in cmd/go/pkg.go, the Makefiles, and .../doc.go.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5595044
2012-01-29 11:07:25 -08:00
Rob Pike
79dc34413e cmd/go: first piece of tool rearrangement
1) create go-tool dir in make.bash
2) clean up stale binaries in make.bash
3) add 'tool' command to go
4) convert goyacc->yacc as a first test tool
Since goyacc stands alone, it's a safe trial.

R=rsc
CC=golang-dev
https://golang.org/cl/5576061
2012-01-29 09:19:05 -08:00
Mikio Hara
3d400db5de net: update comments to remove redundant "net" prefix
R=rsc, r
CC=golang-dev
https://golang.org/cl/5569087
2012-01-29 19:11:05 +09:00
Brad Fitzpatrick
a3fdd6e649 os: remove SIGXXX signals variables.
They're not portable, and pkg os is supposed to be portable.

Fixes #2562

R=golang-dev, mikioh.mikioh, r, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5574078
2012-01-27 14:47:02 -08:00
Robert Griesemer
b3a5f9e51b go/doc: don't show methods of exported anonymous fields
Added flag AllMethods: if not set (future default), embedded
methods of exported (and thus visible) embedded fields are not
shown in the final package documentation

The actual change for AllMethods is just in sortedFuncs. All
other changes are simplifications of the existing logic (mostly
deletion of code): Because method conflicts due to embedding
must always be detected, remove any premature elimination of
types and methods. Instead collect all named types and all
methods and do the filtering at the end.

Miscellaneous:
- renamed baseType -> namedType
- streamline logic for recording embedded types
- record embedded types via a map (simpler data structures)

AllMethods is set by default; so the output is unchanged and
the tests pass. The next CL will enable the AllMethods flag
and have adjusted tests (and fix issue 2791).

R=rsc
CC=golang-dev
https://golang.org/cl/5572076
2012-01-27 14:45:47 -08:00
Robert Griesemer
a0d0ed2002 go/doc: added test case
Don't show conflicting method embedded via
a visible and invisible anonymous field.

R=rsc
CC=golang-dev
https://golang.org/cl/5564064
2012-01-27 14:45:31 -08:00
Russ Cox
c4303aa59f reflect: add comment about Type.Field allocation
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5586044
2012-01-27 16:11:17 -05:00
Ivan Krasin
903752f484 compress/flate: remove unused huffmanEncoder.generateChains.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5577061
2012-01-27 09:52:58 -08:00
Brad Fitzpatrick
b79ba6a609 flag: allow a FlagSet to not write to os.Stderr
Fixes #2747

R=golang-dev, gri, r, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5564065
2012-01-27 09:23:06 -08:00
Dmitriy Vyukov
75397e65ee net/rpc: fix data race on Call.Error
+eliminates a possibility of sending a call to Done several times.
+fixes memory leak in case of temporal Write errors.
+fixes data race on Client.shutdown.
+fixes data race on Client.closing.
+fixes comments.
Fixes #2780.

R=r, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5571063
2012-01-27 11:27:05 +04:00
Brad Fitzpatrick
b62a5099e4 archive/zip: add functions to convert between os.FileInfo & FileHeader
Fixes #2186

R=golang-dev, gri, adg
CC=golang-dev
https://golang.org/cl/5579044
2012-01-26 15:31:09 -08:00
James P. Cooper
2a22f35598 database/sql: convert SQL null values to []byte as nil.
Also allow string values to scan into []byte.
Fixes #2788.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5577054
2012-01-26 15:12:48 -08:00
Brad Fitzpatrick
899cd04e21 net/http: add Request.RequestURI field
The new url.URL's parsing can be too canonicalizing for
certain applications. By keeping the original request URI
around, we give applications a gross escape hatch while
keeping the URL package clean and simple for normal uses.

(From a discussion with Gary Burd, Gustavo Niemeyer,
and Russ Cox.)

Fixes #2782

R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5580044
2012-01-26 14:37:14 -08:00
Russ Cox
408f0b1f74 gc, runtime: handle floating point map keys
Fixes #2609.

R=ken2
CC=golang-dev
https://golang.org/cl/5572069
2012-01-26 16:25:07 -05:00
Robert Griesemer
8a90a8861f math/big: test both bitLen and bitLen_g
Also: simpler, more direct test.

R=golang-dev, dave.andersen
CC=golang-dev
https://golang.org/cl/5573070
2012-01-26 10:08:21 -08:00
Roger Peppe
32d7a7364f net/http: make ParseForm ignore unknown content types.
Also fix a shadowed error variable bug.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5573072
2012-01-26 16:50:56 +00:00
Mikio Hara
974fa75557 net: make WriteTo fail when UDPConn is already connected
Fixes #2773.

R=rsc
CC=golang-dev
https://golang.org/cl/5571056
2012-01-27 01:31:42 +09:00
Dmitriy Vyukov
eaa8b30d5a net/rpc: log Call reply discard
It means serious user error that can lead to
hard to debug issues under load, log entry
will not harm.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574075
2012-01-26 20:09:09 +04:00
Dmitriy Vyukov
290921bbb5 net/rpc: fix data race in benchmark
Fixes #2781.

R=golang-dev, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5577053
2012-01-26 20:06:27 +04:00
Dmitriy Vyukov
fa32b16413 net/rpc: fix race in TestClientWriteError test
Fixes #2752.

R=golang-dev, mpimenov, r
CC=golang-dev
https://golang.org/cl/5571062
2012-01-26 11:37:07 +04:00
Rob Pike
f8a28ecc9f path/filepath: fix test
If there's an error, sometimes you need to stop.
Part of issue 2787.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5570068
2012-01-25 20:19:55 -08:00
Blake Mizerany
bcb976c5b2 database/sql: fix Tx.Query
Fixes #2784

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5574073
2012-01-25 17:49:30 -08:00
James P. Cooper
c21b343438 database/sql: add NullInt64, NullFloat64, NullBool
Fixes #2699

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5557063
2012-01-25 17:47:32 -08:00
Robert Griesemer
ea347c0142 go/doc: fix typo
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5574071
2012-01-25 17:09:50 -08:00
Robert Griesemer
d571c5ca78 go/doc: revert API change (per former discussion) and cleanup
Separating Method from Func made the code only more complicated
without adding much to the useability/readability of the API.
Reverted to where it was, but leaving the new method-specific
fields Orig and Level.

Former clients (godoc) of doc.Method only used the Func fields;
and because Func was embedded, no changes are needed with respect
to the removal of Method.

Changed type of Func.Recv from ast.Expr to string. This was a
long-standing TODO. Also implemented Func.Orig field (another TODO).

No further go/doc API changes are expected for Go 1.

R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5577043
2012-01-25 16:48:06 -08:00
David G. Andersen
1e09031f7f math/big: return type of bitLen is an int; use MOVL on amd64.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5577050
2012-01-25 16:09:12 -08:00
David G. Andersen
316f81bb1d math/big: assembly versions of bitLen for x86-64, 386, and ARM.
Roughly 2x speedup for the internal bitLen function in arith.go.  Added TestWordBitLen test.

Performance differences against the new version of
bitLen generic:

x86-64 Macbook pro (current tip):

benchmark                old ns/op    new ns/op    delta
big.BenchmarkBitLen0             6            4  -37.40%
big.BenchmarkBitLen1             6            2  -51.79%
big.BenchmarkBitLen2             6            2  -65.04%
big.BenchmarkBitLen3             6            2  -66.10%
big.BenchmarkBitLen4             6            2  -60.96%
big.BenchmarkBitLen5             6            2  -55.80%
big.BenchmarkBitLen8             6            2  -56.19%
big.BenchmarkBitLen9             6            2  -64.73%
big.BenchmarkBitLen16            7            2  -68.84%
big.BenchmarkBitLen17            6            2  -67.11%
big.BenchmarkBitLen31            7            2  -61.57%

386 Intel Atom (current tip):
benchmark                old ns/op    new ns/op    delta
big.BenchmarkBitLen0            23           20  -13.04%
big.BenchmarkBitLen1            23           20  -14.77%
big.BenchmarkBitLen2            24           20  -19.28%
big.BenchmarkBitLen3            25           20  -21.57%
big.BenchmarkBitLen4            24           20  -16.94%
big.BenchmarkBitLen5            25           20  -20.78%
big.BenchmarkBitLen8            24           20  -19.28%
big.BenchmarkBitLen9            25           20  -20.47%
big.BenchmarkBitLen16           26           20  -23.37%
big.BenchmarkBitLen17           26           20  -25.09%
big.BenchmarkBitLen31           32           20  -35.51%

ARM v5 SheevaPlug, previous weekly patched with bitLen:
benchmark                old ns/op    new ns/op    delta
big.BenchmarkBitLen0            50           29  -41.73%
big.BenchmarkBitLen1            51           29  -42.75%
big.BenchmarkBitLen2            59           29  -50.08%
big.BenchmarkBitLen3            60           29  -50.75%
big.BenchmarkBitLen4            59           29  -50.08%
big.BenchmarkBitLen5            60           29  -50.75%
big.BenchmarkBitLen8            59           29  -50.08%
big.BenchmarkBitLen9            60           29  -50.75%
big.BenchmarkBitLen16           69           29  -57.35%
big.BenchmarkBitLen17           70           29  -57.89%
big.BenchmarkBitLen31           95           29  -69.07%

R=golang-dev, minux.ma, gri
CC=golang-dev
https://golang.org/cl/5574054
2012-01-25 15:04:16 -08:00
Yoshiyuki Kanno
d645adc3d0 net/http: fix Transport deadlock
This patch intend to fix following issues.
http://code.google.com/p/go/issues/detail?id=2616

Fixes #2616.

R=golang-dev, bradfitz, nekotaroh
CC=golang-dev
https://golang.org/cl/5532057
2012-01-25 15:00:39 -08:00
Brad Fitzpatrick
73ce14d0aa regexp: remove vestigial Error type
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5573069
2012-01-25 14:50:37 -08:00
Mikio Hara
9acea02de2 net: fix dialing google test
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5573060
2012-01-26 07:38:49 +09:00
Robert Griesemer
dbce368ef9 go/doc: test cases for sort order
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569059
2012-01-25 13:56:12 -08:00
Robert Figueiredo
82d06e8f3c syscall: add NOTE_* constants on OS X
R=rsc
CC=golang-dev
https://golang.org/cl/5570043
2012-01-25 15:50:23 -05:00
Russ Cox
bf67a7b9b1 build: fix build
I said rm, but not hg rm.
I never was good at Simon says.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/5574066
2012-01-25 15:41:49 -05:00
Brad Fitzpatrick
cf09a9d3bf net/http: disabled test for Transport race / deadlock bug
The real fix for Issue 2616 is in
https://golang.org/cl/5532057, to be submitted
following this CL, without the test there which doesn't work
reliably. This one seems to.

R=rsc
CC=golang-dev
https://golang.org/cl/5569063
2012-01-25 12:31:06 -08:00
Russ Cox
0368ca138b build: remove code now in subrepositories
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5569064
2012-01-25 15:30:42 -05:00
Robert Griesemer
8efc020d7c go/printer: factor some frequently used code
Added a cache to compensate for extra call overhead.
go test -bench=Print marginally faster (in the noise).

R=r
CC=golang-dev
https://golang.org/cl/5574061
2012-01-25 10:45:16 -08:00
Robert Griesemer
d665ea98f3 go/printer, gofmt: respect line breaks in signatures
No changes when applying gofmt to src, misc.

Fixes #2597.

R=r
CC=golang-dev
https://golang.org/cl/5564056
2012-01-25 10:21:13 -08:00
Robert Griesemer
57af5429e6 go/doc: test case for corner case (override of predecl. type)
R=rsc
CC=golang-dev
https://golang.org/cl/5575055
2012-01-25 09:54:10 -08:00
Robert Griesemer
6d68be46dd go/doc: clean rewrite of go/doc internals
The implementation is divided into 4 phases:
1) export filtering of an incoming AST if necessary (exports.go)
2) reading of a possibly filtered AST (reader.go: type reader)
3) method set computation (reader.go)
4) sorting and creation of final documentation (reader.go)

In contrast to the old implementation, the presentation data
(Names, Docs, Decls, etc.) are created immediately upon reading
the respective AST node. Also, all types are collected (embedded
or not) in a uniform way.

Once the entire AST has been processed, all methods and types
have been collected and the method sets for each type can be
computed (phase 3).

To produce the final documentation, the method sets and value
maps are sorted.

There are no API changes. Passes the existing test suite unchanged.

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5554044
2012-01-25 09:53:26 -08:00
Fazlul Shahriar
c93ca600ec os: pass tests on Plan 9 again
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5563046
2012-01-25 00:15:44 -08:00
David Symonds
0ae9d812c8 runtime: move NumCPU declaration into debug.go.
R=rsc
CC=golang-dev
https://golang.org/cl/5574060
2012-01-25 14:13:11 +11:00
Joel Sing
e3e1804ed2 archive/tar: fix race in TestNonSeekable
Reimplement the test based on code from adg@golang.org.

The previous version has a race since the file is closed via defer
rather than in the go routine. This meant that the file could be
closed before the go routine has actually received io.EOF. It then
receives EBADF and continues to do zero-byte writes to the pipe.

This addresses an issue seen on FreeBSD and OpenBSD, where the test
passes but exits with a SIGPIPE, resulting in a failure.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5554083
2012-01-25 13:44:53 +11:00
Robert Griesemer
8b60613b92 go/scanner: Use explicit scanner.Mode type.
R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5574059
2012-01-24 16:49:03 -08:00
Andrew Balholm
c3b9650caa net/http: parse CONNECT requests
Fixes #2755

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5571052
2012-01-25 11:42:00 +11:00
Robert Griesemer
e7d513eab0 go/parser: Use explicit parser.Mode type.
R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5574058
2012-01-24 16:36:20 -08:00
Nigel Tao
324513bc5f html: move the HTML parser to an exp/html package. The parser is a
work in progress, and we are not ready to freeze its API for Go 1.

Package html still exists, containing just two functions: EscapeString
and UnescapeString.

Both the packages at exp/html and html are "package html". The former
is a superset of the latter.

At some point in the future, the exp/html code will move back into
html, once we have finalized the parser API.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5571059
2012-01-25 10:54:59 +11:00
Gustavo Niemeyer
66599c4070 encoding/xml: remove Marshaler support
Marshaler has a number of open areas that need
further thought (e.g. it doesn't handle attributes,
it's supposed to handle tag names internally but has
no information to do so, etc).

We're removing it now and will bring it back with an
interface that covers these aspects, after Go 1.

Related to issue 2771, but doesn't fix it.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574057
2012-01-24 21:51:15 -02:00
Andrew Gerrand
ddd67f2ecd math/big: add examples for Rat and Int's SetString and Scan methods
R=golang-dev, bradfitz, rsc, r, gri, r
CC=golang-dev
https://golang.org/cl/5543047
2012-01-25 10:29:44 +11:00
Gustavo Niemeyer
e3ab30bbc1 encoding/xml: add docs for ignoring tag
That was supposed to be in the original CL, but missed
the files.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570052
2012-01-24 21:04:40 -02:00
Andrew Gerrand
0bb8ce2984 text/template: add example for Template
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5564050
2012-01-25 09:24:25 +11:00
Brad Fitzpatrick
2c2c20224a encoding/binary: document that PutVarint, PutUvarint may panic
Fixes #2628

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5571058
2012-01-24 14:19:59 -08:00
Brad Fitzpatrick
fe30ed2dcf net: actually reset deadline when time is zero
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5570056
2012-01-24 14:06:12 -08:00
Shenghou Ma
0ae6084fef build: do not build all C compilers
In order to allow buildscript.sh to generate buildscripts for all
        $GOOS/$GOARCH combinations, we have to generate dummy files for cmd/go.
        Fixes #2586.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5557050
2012-01-24 15:03:41 -05:00
Brad Fitzpatrick
37d2f8190d rename FooError vars to ErrFoo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574056
2012-01-24 11:48:48 -08:00
Brad Fitzpatrick
fce2416b13 go/build: typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5575049
2012-01-24 11:24:55 -08:00
Ivan Krasin
565e140a16 compress/flate: increase the length of hash table from 1<<15 to 1<<17. 0%-16% speedup.
R=rsc, imkrasin
CC=golang-dev
https://golang.org/cl/5569048
2012-01-24 13:52:45 -05:00
Brad Fitzpatrick
da6d835b90 crypto: rename some FooError to ErrFoo
Also, add an explicit error type when the right hand side is an unexported
function.

R=golang-dev, gri, rogpeppe, agl, rsc
CC=golang-dev
https://golang.org/cl/5564048
2012-01-24 08:32:43 -08:00
Gustavo Niemeyer
0442087f93 encoding/xml: bring API closer to other packages
Includes gofix module. The only case not covered should be
xml.Unmarshal, since it remains with a similar interface, and
would require introspecting the type of its first argument
better.

Fixes #2626.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5574053
2012-01-24 01:10:32 -02:00
Robert Griesemer
6d7e9382b4 go/doc: removed unused field "Type.Type"
CL 5572043 removed the last uses of this field.
The information is readily available from Type.Decl.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5570049
2012-01-23 16:53:19 -08:00
David G. Andersen
1dc37bbf46 math/big: slight improvement to algorithm used for internal bitLen function
The bitLen function currently shifts out blocks of 8 bits at a time.
This change replaces this sorta-linear algorithm with a log(N)
one (shift out 16 bits, then 8, then 4, then 2, then 1).
I left the start of it linear at 16 bits at a time so that
the function continues to work with 32 or 64 bit values
without any funkiness.
The algorithm is similar to several of the nlz ("number of
leading zeros") algorithms from "Hacker's Delight" or the
"bit twiddling hacks" pages.

Doesn't make a big difference to the existing benchmarks, but
I'm using the code in a different context that calls bitLen
much more often, so it seemed worthwhile making the existing
codebase faster so that it's a better building block.

Microbenchmark results on a 64-bit Macbook Pro using 6g from weekly.2012-01-20:

benchmark                old ns/op    new ns/op    delta
big.BenchmarkBitLen0             4            6  +50.12%
big.BenchmarkBitLen1             4            6  +33.91%
big.BenchmarkBitLen2             6            6   +3.05%
big.BenchmarkBitLen3             7            6  -19.05%
big.BenchmarkBitLen4             9            6  -30.19%
big.BenchmarkBitLen5            11            6  -42.23%
big.BenchmarkBitLen8            16            6  -61.78%
big.BenchmarkBitLen9             5            6  +18.29%
big.BenchmarkBitLen16           18            7  -60.99%
big.BenchmarkBitLen17            7            6   -4.64%
big.BenchmarkBitLen31           19            7  -62.49%

On an ARM machine (with the previous weekly):

benchmark                old ns/op    new ns/op    delta
big.BenchmarkBitLen0            37           50  +36.56%
big.BenchmarkBitLen1            59           51  -13.69%
big.BenchmarkBitLen2            74           59  -20.40%
big.BenchmarkBitLen3            92           60  -34.89%
big.BenchmarkBitLen4           110           59  -46.09%
big.BenchmarkBitLen5           127           60  -52.68%
big.BenchmarkBitLen8           181           59  -67.24%
big.BenchmarkBitLen9            78           60  -23.05%
big.BenchmarkBitLen16          199           69  -65.13%
big.BenchmarkBitLen17           91           70  -23.17%
big.BenchmarkBitLen31          210           95  -54.43%

R=golang-dev, dave, edsrzf, gri
CC=golang-dev
https://golang.org/cl/5570044
2012-01-23 13:46:28 -08:00
Russ Cox
4417bc3742 exp/ebnflint: test spec during 'go test'
This avoids the need for a custom Makefile.

R=gri
CC=golang-dev
https://golang.org/cl/5575045
2012-01-23 16:35:25 -05:00
Russ Cox
b5777571b3 go/build: add BuildTags to Context, allow !tag
This lets the client of go/build specify additional tags that
can be recognized in a // +build directive.  For example,
a build for a custom environment like App Engine might
include "appengine" in the BuildTags list, so that packages
can be written with some files saying

        // +build appengine   (build only on app engine)

or

        // +build !appengine  (build only when NOT on app engine)

App Engine here is just a hypothetical context.  I plan to use
this in the cmd/go sources to distinguish the bootstrap version
of cmd/go (which will not use networking) from the full version
using a custom tag.  It might also be useful in App Engine.

Also, delete Build and Script, which we did not end up using for
cmd/go and which never got turned on for real in goinstall.

R=r, adg
CC=golang-dev
https://golang.org/cl/5554079
2012-01-23 15:16:38 -05:00
Robert Griesemer
370f4e49cd go/doc: test all operation modes
Golden files have extension .d.golden where d is the mode value (0 or 1 for now)
(i.e., testdata/file.out is now testdata/file.0.golden, and there is a new file
testdata/file.1.golden for each testcase)

R=rsc
CC=golang-dev
https://golang.org/cl/5573046
2012-01-23 10:41:54 -08:00
Marcel van Lohuizen
110964ac81 exp/norm: fixes a subtle bug introduced by change 10087: random offset
for map iteration.  New code makes table output predictable and fixes
bug.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5573044
2012-01-23 19:36:52 +01:00
Mikio Hara
77cb8956a0 net: consistent OpError message
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5562047
2012-01-24 02:59:43 +09:00
Rob Pike
a937bff52c gob: annotate debug.go so it's not normally built
So it's not included in the package by the go tool.

R=iant, fullung, rsc
CC=golang-dev
https://golang.org/cl/5563049
2012-01-23 08:40:34 -08:00
Ivan Krasin
858f0b4d95 compress/flate: delete unused util functions.
R=rsc
CC=golang-dev
https://golang.org/cl/5555071
2012-01-23 10:31:51 -05:00
Ivan Krasin
b35cef6704 compress/flate: use append instead of slice+counter.
R=rsc, nigeltao
CC=golang-dev
https://golang.org/cl/5561056
2012-01-23 09:26:14 -05:00
Ivan Krasin
d7e34051fc compress/flate: reduce memory pressure at cost of additional arithmetic operation.
R=rsc
CC=golang-dev
https://golang.org/cl/5555070
2012-01-23 09:19:39 -05:00
Gustavo Niemeyer
5fde5cd5cb encoding/xml: support ignoring fields with "-"
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5564045
2012-01-23 01:34:35 -02:00
Gustavo Niemeyer
fd9c99511e encoding/xml: minor doc fixup
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5564046
2012-01-23 01:32:07 -02:00
Robert Griesemer
abd5bd7d54 go/doc: add more test cases
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5571043
2012-01-22 18:53:18 -08:00
Robert Griesemer
e37792191f go/doc: set Type.Name field
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5569043
2012-01-22 18:52:38 -08:00
Gustavo Niemeyer
57007fe12b encoding/xml: improve []byte handling
Marshalling of []byte in attributes and the general
marshalling of named []byte types was fixed.

A []byte field also won't be nil if an XML element
was mapped to it, even if the element is empty.

Tests were introduced to make sure that *struct{}
fields works correctly for element presence testing.
No changes to the logic made in that regard.

R=rsc
CC=golang-dev
https://golang.org/cl/5539070
2012-01-23 00:50:05 -02:00
Andrew Gerrand
191873981a go/build: silence all warnings
R=rsc
CC=golang-dev
https://golang.org/cl/5529055
2012-01-23 09:26:46 +11:00
Rob Pike
6e1c0df104 gob: reduce the maximum message size
It was 2^31, but that could cause overflow and trouble.
Reduce it to 2^30 and add a TODO.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5562049
2012-01-22 12:01:12 -08:00
Shenghou Ma
e021357673 runtime: update out-of-date comment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532118
2012-01-22 10:34:17 -08:00
Rob Pike
87079cc14c bytes: delete the test for huge buffers
It takes too much memory to be reliable and causes
trouble on 32-bit machines.
Sigh.

Fixes #2756.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5567043
2012-01-22 09:25:47 -08:00
Robert Griesemer
e17afa4d0c bytes.Buffer: remove dead code, complete documentation
R=r, dave, r
CC=golang-dev
https://golang.org/cl/5533086
2012-01-21 21:31:21 -08:00
Rob Pike
b0d2713b77 bytes.Buffer: restore panic on out-of-memory
Make the panic detectable, and use that in ioutil.ReadFile to
give an error if the file is too big.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5563045
2012-01-21 09:46:59 -08:00
Ivan Krasin
4d3b9d9757 compress/flate: fix a typo, improve compression rate by 3-4%.
R=rsc
CC=golang-dev
https://golang.org/cl/5556077
2012-01-21 12:18:15 -05:00
Mikio Hara
68daa41d1b net: Dial, ListenPacket with "ip:protocol" network for raw IP sockets
Fixes #2654.

R=rsc
CC=golang-dev
https://golang.org/cl/5545058
2012-01-21 21:51:53 +09:00
Ivan Krasin
c4b16a3864 compress/flate: make lazy matching work.
R=rsc, imkrasin
CC=golang-dev
https://golang.org/cl/5554066
2012-01-20 23:35:18 -05:00
Anthony Martin
fb3b27329e os: fix Plan 9 build after more FileMode changes
This should go in after Brad's CL 5553064.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #2480 again.

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

Fixes #2739.

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

Helps issue 2644.

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #2732.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #2723

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

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

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

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

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

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

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

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

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

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

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

Fixes #2722.

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

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

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

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

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

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

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

Fixes #2653.

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

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

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

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

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

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

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

What was previous built as:

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

Is now built as:

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

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

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

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

Fixes #2692

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

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

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

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

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

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

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

Fixes #1692.

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

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

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

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

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

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

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

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

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

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

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

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

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

Also: minor cleanup in godoc.go.

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

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

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

What follows is a detailed list of those changes.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  Old:

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

  New:

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

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

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

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

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

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

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

Fixes #1000.

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

Also: minor cleanups.

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

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

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

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

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

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

Fixes #2625.

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

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

Fixes #2683 comment #3.

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

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

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

        t.signal <- t
        runtime.Goexit()

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

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

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

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

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

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

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

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

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

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

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

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

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

- Both these changes were long-standing TODOs.

- Added BenchmarkScan.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

R=golang-dev, dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/5533058
2012-01-10 09:48:10 -08:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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