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

5265 Commits

Author SHA1 Message Date
Luuk van Dijk
8dd3de4d4b pkg/math: undo manual inlining of IsInf and IsNaN
R=rsc
CC=golang-dev
https://golang.org/cl/5484076
2012-02-01 16:08:31 +01:00
David Symonds
2f2b6e55ef encoding/base64: ignore new line characters during decode.
Fixes #2541.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5610045
2012-02-01 19:13:38 +11:00
Mikio Hara
804f1882c5 net, syscall: add IPv4 multicast helpers for windows
Also re-enable simple IPv4 multicast testing on windows.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5605048
2012-02-01 14:14:04 +09:00
Andrew Gerrand
63f68a2eda go/build: update syslist.go package comment
It's no longer generated by make.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5602047
2012-02-01 15:12:24 +11:00
Anthony Martin
1583931bcf syscall: cache environment variables on Plan 9.
This can drastically reduce the number of system
calls made by programs that repeatedly query the
environment.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5599054
2012-01-31 18:14:02 -08:00
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