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

7008 Commits

Author SHA1 Message Date
Mikkel Krautz
249af5c85e crypto/x509: skip SystemRootsError test on Windows
On Windows, crypto/x509 passes through to Windows's CryptoAPI
to verify certificate chains. This method can't produce a
SystemRootsError, so make sure we always skip the test on
Windows.

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

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

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

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

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

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

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

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

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

Using bytes.Buffer:

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

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

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

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

Fixes #4189.

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

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

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

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

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

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

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

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

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

Fixes #4660.

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

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

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

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

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

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

Fixes #4364.

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

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

This mirrors Apache's SSLHonorCipherOrder directive.

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

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

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

Fixes #4657.

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

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

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

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

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

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

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

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

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

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

Mac OSX, median of 10 runs:

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

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

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

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

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

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

Fixes #3528.

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

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

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

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

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

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

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

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

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

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

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

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

R=adonovan
CC=golang-dev
https://golang.org/cl/7107043
2013-01-14 09:43:27 -08:00