Commit graph

15175 commits

Author SHA1 Message Date
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
Russ Cox 522562e712 AUTHORS: remove Vega Garcia Luis Alfonso (covered by Google CLA)
R=dsymonds, adg
CC=golang-dev
https://golang.org/cl/7180050
2013-01-22 22:42:08 -05:00
Oling Cat f1c397f0ea doc/articles/race_detector: fix some format.
R=golang-dev, bradfitz, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7137049
2013-01-23 14:22:03 +11: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
Russ Cox 92e3e15546 A+C: Vega Garcia Luis Alfonso (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7179054
2013-01-22 22:13:24 -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
Brad Fitzpatrick 93d92d51dd cmd/api: fix type scrubbing
It wasn't removing names from func parameters for func types,
and it was handling "a, b string" as "string", not "string, string".

Fixes #4688

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7181051
2013-01-22 14:29:38 -08:00
Akshat Kumar b9f0a6bf68 lib9: declare __fixargv0 before use in flag.c
The Plan 9 compilers complain about not
having type information for the function,
which sets off type signature problems
during the linking stage.

R=rsc, ality, iant
CC=golang-dev
https://golang.org/cl/7058054
2013-01-22 17:23:36 -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
Anthony Martin e6e60cda12 cmd/go: suppress extraneous newlines in list
Before:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe

time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe

$

After:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe
time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe
$

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7130052
2013-01-22 17:05:13 -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
Dustin Shields-Cloues a61dcef232 cmd/go: add hg ssh support
R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7133048
2013-01-22 14:43:37 -05:00
Russ Cox 2524c71b9d A+C: Dustin Shields-Cloues (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7184046
2013-01-22 14:43:25 -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
Russ Cox f8284b64ce doc/effective_go.html: add a section about the blank identifier
R=golang-dev, minux.ma, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7134056
2013-01-22 14:00:10 -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 a0b5b46ae4 doc/go_spec: cap doesn't apply to maps
Fixes #4682.

R=golang-dev, adg, dave
CC=golang-dev
https://golang.org/cl/7094062
2013-01-22 03:18:20 +08:00
Shenghou Ma faaa7c07d7 cmd/cgo: doc updates
1. note that to use C.free <stdlib.h> must be included
2. can also extract errno from a void C function

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6935045
2013-01-22 02:52:34 +08:00
Shenghou Ma e00c9f0dbb cmd/5l: move offset2 into Adr.u0 union to save 4/8 bytes for Adr/Prog resp.
sizeof(Adr) from 24 bytes down to 20 bytes.
sizeof(Prog) from 84 bytes down to 76 bytes.

5l linking cmd/godoc statistics:
Before:
Maximum resident set size (kbytes): 106668
After:
Maximum resident set size (kbytes):  99412

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7100059
2013-01-22 02:50:27 +08: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
Andrew Gerrand 0a40137bf8 C: add Bill Neubauer's Gmail account
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7172044
2013-01-21 10:53:39 +11:00
Dave Cheney 9b568ef2b8 cmd/5l: reduce the size of Prog and Sym
Prog
* Remove the unused Prog* dlink
* note that align is also unused, but removing it does not help due to alignment issues.

Saves 4 bytes, sizeof(Prog): 84 => 80.

Sym
* Align {u,}char fields on word boundaries

Saves 4 bytes, sizeof(Sym): 136 => 132.

Tested on linux/arm and freebsd/arm.

R=minux.ma, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7106050
2013-01-20 20:14:24 +11:00
Anthony Martin 42c86828b1 cmd/api: sort features
R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7141062
2013-01-19 22:20:46 -08: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
Dave Cheney 254caaf90b cmd/8l, cmd/6l: avoid zeroing zeroed fields
mal() returns zeroed memory, so zeroing these fields is redundant.

R=golang-dev, bradfitz, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7096049
2013-01-19 20:23:25 +11:00
Anthony Martin 2bddbf5e8f cmd/8g, cmd/dist, cmd/gc: fix warnings on Plan 9
cmd/8g/gsubr.c: unreachable code
cmd/8g/reg.c: overspecifed class
cmd/dist/plan9.c: unused parameter
cmd/gc/fmt.c: stkdelta is now a vlong
cmd/gc/racewalk.c: used but not set

R=golang-dev, seed, rsc
CC=golang-dev
https://golang.org/cl/7067052
2013-01-18 19:08:00 -08:00
Anthony Martin 60826e0be6 cmd/6c, cmd/8c: fix print format for Prog
The FmtLong flag should only be used with the %D verb
when printing an ATEXT Prog. It was erroneously used
for every Prog except ADATA. This caused a preponderance
of exclamation points, "!!", in the assembly listings.

I also cleaned up the code so that the list.c files look
very similar. Now the real differences are easily spotted
with a simple diff.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7128045
2013-01-18 19:00:38 -08:00
Nigel Tao c8c8ab08ed doc: fix effective_go: s/byte array/byte slice/.
R=rsc
CC=golang-dev, mdempsky
https://golang.org/cl/7062049
2013-01-19 13:36:59 +11:00
Russ Cox 1debf5bbd3 api: update next.txt
R=golang-dev, minux.ma, dave
CC=golang-dev
https://golang.org/cl/7135061
2013-01-18 17:57:07 -05: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
Matthew Dempsky bb192d1399 cmd/6c: Optimize rotate expressions to use rotate instructions.
For simplicity, only recognizes expressions of the exact form
"(x << a) | (x >> b)" where x is a variable and a and b are
integer constant expressions that add to x's bit width.

Fixes #4629.

$ cat rotate.c
unsigned int
rotate(unsigned int x)
{
        x = (x << 3) | (x >> (sizeof(x) * 8 - 3));
        return x;
}

## BEFORE
$ go tool 6c -S rotate.c
(rotate.c:2)	TEXT	rotate+0(SB),$0-8
(rotate.c:2)	MOVL	x+0(FP),!!DX
(rotate.c:4)	MOVL	DX,!!AX
(rotate.c:4)	SALL	$3,!!AX
(rotate.c:4)	MOVL	DX,!!CX
(rotate.c:4)	SHRL	$29,!!CX
(rotate.c:4)	ORL	CX,!!AX
(rotate.c:5)	RET	,!!
(rotate.c:5)	RET	,!!
(rotate.c:5)	END	,!!

## AFTER
$ go tool 6c -S rotate.c
(rotate.c:2)	TEXT	rotate+0(SB),$0-8
(rotate.c:4)	MOVL	x+0(FP),!!AX
(rotate.c:4)	ROLL	$3,!!AX
(rotate.c:5)	RET	,!!
(rotate.c:5)	RET	,!!
(rotate.c:5)	END	,!!

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7069056
2013-01-18 17:29:53 -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
Robert Griesemer d3679726b4 spec: clarify lhs syntax for range and select
Fixes #4653.

R=rsc, r, iant, ken, thakis
CC=golang-dev
https://golang.org/cl/7135058
2013-01-18 13:59:25 -08: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
Rémy Oudompheng 09cb91eddc test: re-enable issue4348.go.
The test array is too large to fit a stack frame
but can be a global.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7127059
2013-01-18 22:54:27 +01:00
Daniel Morsing c0d9bf5650 cmd/gc: more robust checking of OIND nodes.
Fixes #4610.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev, nigeltao
https://golang.org/cl/7058057
2013-01-18 22:46:10 +01:00