]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agosyscall, net: Fix unix socket autobind on Linux.
Albert Strasheim [Wed, 6 Feb 2013 14:45:57 +0000 (06:45 -0800)]
syscall, net: Fix unix socket autobind on Linux.

R=rsc, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7300047

12 years agoexp/cookiejar: infrastructure for upcoming implementation
Volker Dobler [Wed, 6 Feb 2013 11:37:34 +0000 (22:37 +1100)]
exp/cookiejar: infrastructure for upcoming implementation

This CL is the first of a handful of CLs which will provide
the implementation of cookiejar. It contains several helper
functions and the skeleton of Cookies and SetCookies.

Proper host name handling requires the ToASCII transformation
from package idna which currently lives in the go.net
subrepo. This CL thus contains just a TODO for this issue.

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

12 years agodoc/articles/error_handling: no more os.Error
Shenghou Ma [Wed, 6 Feb 2013 10:32:54 +0000 (18:32 +0800)]
doc/articles/error_handling: no more os.Error

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7304053

12 years agoruntime/race: switch to explicit race context instead of goroutine id's
Dmitriy Vyukov [Wed, 6 Feb 2013 07:40:54 +0000 (11:40 +0400)]
runtime/race: switch to explicit race context instead of goroutine id's
Removes limit on maximum number of goroutines ever existed.
code.google.com/p/goexecutor tests now pass successfully.
Also slightly improves performance.
Before: $ time ./flate.test -test.short
real 0m9.314s
After:  $ time ./flate.test -test.short
real 0m8.958s
Fixes #4286.
The runtime is built from llvm rev 174312.

R=rsc
CC=golang-dev
https://golang.org/cl/7218044

12 years agolog/syslog: retry once if write fails
Jeff R. Allen [Tue, 5 Feb 2013 17:54:01 +0000 (09:54 -0800)]
log/syslog: retry once if write fails

Implements deferred connections + single-attempt automatic
retry. Based on CL 5078042 from kuroneko.

Fixes #2264.

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

12 years agoruntime: save LR to stack when panicking to handle leaf function traceback
Shenghou Ma [Tue, 5 Feb 2013 17:18:37 +0000 (01:18 +0800)]
runtime: save LR to stack when panicking to handle leaf function traceback

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

12 years agolib9: fix build for windows
Shenghou Ma [Tue, 5 Feb 2013 16:33:25 +0000 (00:33 +0800)]
lib9: fix build for windows

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

12 years agoexp/inotify: close event channel before file descriptor
Ian Lance Taylor [Tue, 5 Feb 2013 14:11:10 +0000 (06:11 -0800)]
exp/inotify: close event channel before file descriptor

Closing the inotify file descriptor can take over a second
when running on Ubuntu Precise in an NFS directory, leading to
the test error in issue 3132.  Closing the event channel first
lets a client that does not care about the error channel move
on.

Fixes #3132.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7300045

12 years agocmd/dist: add -Wstrict-prototypes to CFLAGS and fix all the compiler errors
Shenghou Ma [Tue, 5 Feb 2013 13:43:04 +0000 (21:43 +0800)]
cmd/dist: add -Wstrict-prototypes to CFLAGS and fix all the compiler errors
Plan 9 compilers insist this but as we don't have Plan 9
builders, we'd better let gcc check the prototypes.

Inspired by CL 7289050.

R=golang-dev, seed, dave, rsc, lucio.dere
CC=akumar, golang-dev
https://golang.org/cl/7288056

12 years agocontainer/heap: fix comment typo in example test
Caleb Spare [Tue, 5 Feb 2013 12:06:00 +0000 (07:06 -0500)]
container/heap: fix comment typo in example test

This updates a bad reference to a method name in the example priority queue test.

The error was introduced in the example refactoring in rev. 2ea8f07b2ffe.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7279045

12 years agocmd/gc: add way to specify 'noescape' for extern funcs
Russ Cox [Tue, 5 Feb 2013 12:00:38 +0000 (07:00 -0500)]
cmd/gc: add way to specify 'noescape' for extern funcs

A new comment directive //go:noescape instructs the compiler
that the following external (no body) func declaration should be
treated as if none of its arguments escape to the heap.

Fixes #4099.

R=golang-dev, dave, minux.ma, daniel.morsing, remyoudompheng, adg, agl, iant
CC=golang-dev
https://golang.org/cl/7289048

12 years agomisc/dashboard/app: trim old builds from the history
Dave Cheney [Tue, 5 Feb 2013 09:50:20 +0000 (20:50 +1100)]
misc/dashboard/app: trim old builds from the history

The dashboard is currently failing to store results of new builds for some keys, notable the go.codereview sub repository. This is causing the builders to mark the entire triggering commit as failed. With the help of David Symonds we think it is because the results value has breached the 1mb datastore limit on AppEngine.

R=dsymonds, adg
CC=golang-dev
https://golang.org/cl/6858094

12 years agoruntime/race: do not include pthread.h
Dmitriy Vyukov [Tue, 5 Feb 2013 09:08:07 +0000 (13:08 +0400)]
runtime/race: do not include pthread.h
Fixes #4721.

R=alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7275048

12 years agoarchive/tar: small simplification using FileMode.
David Symonds [Tue, 5 Feb 2013 04:39:55 +0000 (15:39 +1100)]
archive/tar: small simplification using FileMode.

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

12 years agonet/http: fix Server blocking after a Handler's Write fails
Brad Fitzpatrick [Tue, 5 Feb 2013 04:26:25 +0000 (20:26 -0800)]
net/http: fix Server blocking after a Handler's Write fails

If a Handle's Write to a ResponseWriter fails (e.g. via a
net.Conn WriteDeadline via WriteTimeout on the Server), the
Server was blocking forever waiting for reads on that
net.Conn, even after a Write failed.

Instead, once we see a Write fail, close the connection,
since it's then dead to us anyway.

Fixes #4741

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

12 years agopath/filepath: document that Walk does not follow symlinks
Russ Cox [Tue, 5 Feb 2013 03:59:30 +0000 (22:59 -0500)]
path/filepath: document that Walk does not follow symlinks

Fixes #4759.

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

12 years agocmd/gc: fix escape analysis
Russ Cox [Tue, 5 Feb 2013 03:48:31 +0000 (22:48 -0500)]
cmd/gc: fix escape analysis

If the analysis reached a node twice, then the analysis was cut off.
However, if the second arrival is at a lower depth (closer to escaping)
then it is important to repeat the traversal.

The repeating must be cut off at some point to avoid the occasional
infinite recursion. This CL cuts it off as soon as possible while still
passing all tests.

Fixes #4751.

R=ken2
CC=golang-dev, lvd
https://golang.org/cl/7303043

12 years agosyscall: fix marshaling of stat messages on Plan 9
Anthony Martin [Tue, 5 Feb 2013 03:47:23 +0000 (19:47 -0800)]
syscall: fix marshaling of stat messages on Plan 9

The order of the Qid fields was reversed. Mea culpa.

R=seed
CC=golang-dev
https://golang.org/cl/7231062

12 years agonet/http: add Next Protocol Negotation upgrade support to the Server
Brad Fitzpatrick [Mon, 4 Feb 2013 21:55:38 +0000 (13:55 -0800)]
net/http: add Next Protocol Negotation upgrade support to the Server

This provides the mechanism to connect SPDY support to the http
package, without pulling SPDY into the standard library.

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

12 years agosyscall: regenerate ztype files for linux
Mikio Hara [Mon, 4 Feb 2013 21:53:58 +0000 (06:53 +0900)]
syscall: regenerate ztype files for linux

This CL adds TCPInfo struct to linux/386,arm.
It's already added to linux/amd64.

Note that not sure the reason but cgo godefs w/ latest gcc
translates a flexible array member in structures correctly,
handles it as a non-incomplete, non-opaque type, on Go 1.
This CL reverts such changes by hand for the Go 1 contract.

R=minux.ma, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7197046

12 years agonet/http: fix when server deadlines get extended
Brad Fitzpatrick [Mon, 4 Feb 2013 21:52:45 +0000 (13:52 -0800)]
net/http: fix when server deadlines get extended

Deadlines should be extended at the beginning of
a request, not at the beginning of a connection.

Fixes #4676

R=golang-dev, fullung, patrick.allen.higgins, adg
CC=golang-dev
https://golang.org/cl/7220076

12 years agocmd/go: update doc.go
Shenghou Ma [Mon, 4 Feb 2013 21:45:35 +0000 (05:45 +0800)]
cmd/go: update doc.go

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

12 years agoexp/ssa: (#4 of 5): the SSA builder.
Alan Donovan [Mon, 4 Feb 2013 17:22:35 +0000 (12:22 -0500)]
exp/ssa: (#4 of 5): the SSA builder.

R=iant, gri, iant, rogpeppe
CC=golang-dev
https://golang.org/cl/7196053

12 years agocmd/gc: fix &^ code generation bug
Russ Cox [Mon, 4 Feb 2013 05:21:44 +0000 (00:21 -0500)]
cmd/gc: fix &^ code generation bug

Was not re-walking the new AND node, so that its ullman
count was wrong, so that the code generator attempted to
store values in registers across the call.

Fixes #4752.

R=ken2
CC=golang-dev
https://golang.org/cl/7288054

12 years agonet: use windows sysSocket everywhere
Alex Brainman [Mon, 4 Feb 2013 05:03:41 +0000 (16:03 +1100)]
net: use windows sysSocket everywhere

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7273046

12 years agoruntime/debug: add controls for garbage collector
Russ Cox [Mon, 4 Feb 2013 05:00:55 +0000 (00:00 -0500)]
runtime/debug: add controls for garbage collector

Fixes #4090.

R=golang-dev, iant, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/7229070

12 years agotime: fix error message from Parse
Russ Cox [Mon, 4 Feb 2013 05:00:36 +0000 (00:00 -0500)]
time: fix error message from Parse

Was incorrectly discarding the offending text in some cases.

Fixes #4493.

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

12 years agoregexp: update comment on (*Regexp).Longest
Andrew Gerrand [Mon, 4 Feb 2013 04:57:32 +0000 (15:57 +1100)]
regexp: update comment on (*Regexp).Longest

Missed this review comment.

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

12 years agocmd/go, testing: revise docs for test flags
Russ Cox [Mon, 4 Feb 2013 04:47:03 +0000 (23:47 -0500)]
cmd/go, testing: revise docs for test flags

In cmd/go's 'go help testflag':
* Rewrite list of flags to drop test. prefix on every name.
* Sort list of flags.
* Add example of using -bench to match all benchmarks.

In testing:
* Remove mention of undefined 'CPU group' concept.

Fixes #4488.
Fixes #4508.

R=adg
CC=golang-dev
https://golang.org/cl/7288053

12 years agocontainer/heap: fix package doc comment about ordering.
Nigel Tao [Mon, 4 Feb 2013 04:30:41 +0000 (15:30 +1100)]
container/heap: fix package doc comment about ordering.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/7280044

12 years agoregexp: add (*Regexp).Longest
Andrew Gerrand [Mon, 4 Feb 2013 04:28:55 +0000 (15:28 +1100)]
regexp: add (*Regexp).Longest

Fixes #3696.

R=rsc
CC=golang-dev
https://golang.org/cl/7133051

12 years agotime: deal a bit better with time zones in Parse
Russ Cox [Mon, 4 Feb 2013 04:02:12 +0000 (23:02 -0500)]
time: deal a bit better with time zones in Parse

* Document Parse's zone interpretation.
* Add ParseInLocation (API change).
* Recognize "wrong" time zone names, like daylight savings time in winter.
* Disambiguate time zone names using offset (like winter EST vs summer EST in Sydney).

The final two are backwards-incompatible changes, but I believe
they are both buggy behavior in the Go 1.0 versions; the old results
were more wrong than the new ones.

Fixes #3604.
Fixes #3653.
Fixes #4001.

R=adg
CC=golang-dev
https://golang.org/cl/7288052

12 years agoC: add Alex Bramley (Google CLA)
Russ Cox [Mon, 4 Feb 2013 03:41:24 +0000 (22:41 -0500)]
C: add Alex Bramley (Google CLA)

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

12 years agotime: handle zone file with no transitions
Russ Cox [Mon, 4 Feb 2013 03:41:00 +0000 (22:41 -0500)]
time: handle zone file with no transitions

Code fix by Alex Bramley.

Fixes #4064.

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

12 years agoarchive/tar: add Copyright notice to example_test.go
Andrew Gerrand [Mon, 4 Feb 2013 03:34:35 +0000 (14:34 +1100)]
archive/tar: add Copyright notice to example_test.go

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7278050

12 years agonet: prevent races during windows lookup calls
Alex Brainman [Mon, 4 Feb 2013 02:05:20 +0000 (13:05 +1100)]
net: prevent races during windows lookup calls

This only affects code (with exception of lookupProtocol)
that is only executed on older versions of Windows.

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

12 years agoarchive/tar: Add reader and writer code example.
Robin Eklind [Mon, 4 Feb 2013 01:37:18 +0000 (12:37 +1100)]
archive/tar: Add reader and writer code example.

Remove the previous comment examples.

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7220048

12 years agocmd/gc: slightly better code generation
Russ Cox [Sun, 3 Feb 2013 19:51:21 +0000 (14:51 -0500)]
cmd/gc: slightly better code generation

* Avoid treating CALL fn(SB) as justification for introducing
and tracking a registerized variable for fn(SB).

* Remove USED(n) after declaration and zeroing of n.
It was left over from when the compiler emitted more
aggressive set and not used errors, and it was keeping
the optimizer from removing a redundant zeroing of n
when n was a pointer or integer variable.

Update #597.

R=ken2
CC=golang-dev
https://golang.org/cl/7277048

12 years agoA+C: add Yusuke Kagiwada (Individual CLA)
Brad Fitzpatrick [Sun, 3 Feb 2013 19:42:51 +0000 (11:42 -0800)]
A+C: add Yusuke Kagiwada (Individual CLA)

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

12 years agocmd/gc: implement latest rules for checking make sizes
Russ Cox [Sun, 3 Feb 2013 19:28:44 +0000 (14:28 -0500)]
cmd/gc: implement latest rules for checking make sizes

Fixes #4085.

R=ken2
CC=golang-dev
https://golang.org/cl/7277047

12 years agocmd/go: update 'go get' help message
Russ Cox [Sun, 3 Feb 2013 18:08:23 +0000 (13:08 -0500)]
cmd/go: update 'go get' help message

It accepts all the build flags.
Say that instead of making a copy that will go stale.

Fixes #4742.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7229081

12 years agocmd/5l, cmd/ld: support generating ELF binaries for NetBSD/ARM
Shenghou Ma [Sun, 3 Feb 2013 16:40:11 +0000 (00:40 +0800)]
cmd/5l, cmd/ld: support generating ELF binaries for NetBSD/ARM

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7261043

12 years agoxml: omit newline at beginning of MarshalIndent output
Shivakumar GN [Sun, 3 Feb 2013 16:21:07 +0000 (11:21 -0500)]
xml: omit newline at beginning of MarshalIndent output

(Still valid XML.)

Fixes #3354.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7288047

12 years agocmd/gc: make inlined labels distinct
Russ Cox [Sun, 3 Feb 2013 16:19:22 +0000 (11:19 -0500)]
cmd/gc: make inlined labels distinct

Fixes #4748.

R=ken2
CC=golang-dev
https://golang.org/cl/7261044

12 years agocmd/gc: clean up string index errors
Russ Cox [Sun, 3 Feb 2013 07:01:05 +0000 (02:01 -0500)]
cmd/gc: clean up string index errors

Unify with array/slice errors, which were already good.

Fixes #4232.

R=ken2
CC=golang-dev
https://golang.org/cl/7271046

12 years agocmd/gc: update ideal bool rules to match latest spec
Russ Cox [Sun, 3 Feb 2013 06:44:03 +0000 (01:44 -0500)]
cmd/gc: update ideal bool rules to match latest spec

Fixes #3915.
Fixes #3923.

R=ken2
CC=golang-dev
https://golang.org/cl/7281044

12 years agoexp/gotype: disable broken test
Russ Cox [Sun, 3 Feb 2013 06:25:58 +0000 (01:25 -0500)]
exp/gotype: disable broken test

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

12 years agocmd/gc: remove reference to ? and @ symbols in error message
Russ Cox [Sun, 3 Feb 2013 06:25:47 +0000 (01:25 -0500)]
cmd/gc: remove reference to ? and @ symbols in error message

Those symbols are only allowed during imports;
the parser may expect them but saying that doesn't help users.

Fixes #3434.

R=ken2
CC=golang-dev
https://golang.org/cl/7277045

12 years agocmd/gc: elide self-assignment during return
Russ Cox [Sun, 3 Feb 2013 06:18:28 +0000 (01:18 -0500)]
cmd/gc: elide self-assignment during return

More efficient, less racy code.

Fixes #4014.

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7275047

12 years agocmd/gc: allow new conversion syntax
Russ Cox [Sun, 3 Feb 2013 05:03:10 +0000 (00:03 -0500)]
cmd/gc: allow new conversion syntax

For consistency with conversions that look like function calls,
conversions that don't look like function calls now allow an
optional trailing comma.

That is, int(x,) has always been syntactically valid.
Now []int(x,) is valid too.

Fixes #4162.

R=ken2
CC=golang-dev
https://golang.org/cl/7288045

12 years agocmd/gc: treat &T{} like new(T): allocate on stack if possible
Russ Cox [Sun, 3 Feb 2013 04:54:21 +0000 (23:54 -0500)]
cmd/gc: treat &T{} like new(T): allocate on stack if possible

Fixes #4618.

R=ken2
CC=golang-dev
https://golang.org/cl/7278048

12 years agocmd/gc: avoid duplicate allocation during inlining
Russ Cox [Sun, 3 Feb 2013 04:17:25 +0000 (23:17 -0500)]
cmd/gc: avoid duplicate allocation during inlining

Fixes #4667.

R=ken2
CC=golang-dev
https://golang.org/cl/7275046

12 years agocmd/gc: remove spurious newline from node dump
Russ Cox [Sun, 3 Feb 2013 04:09:49 +0000 (23:09 -0500)]
cmd/gc: remove spurious newline from node dump

R=ken2
CC=golang-dev
https://golang.org/cl/7276048

12 years agotesting: add AllocsPerRun
Kyle Lemons [Sun, 3 Feb 2013 03:52:29 +0000 (22:52 -0500)]
testing: add AllocsPerRun

This CL also replaces similar loops in other stdlib
package tests with calls to AllocsPerRun.

Fixes #4461.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7002055

12 years agolib9/main.c: don't show the crash dialog on windows
Shenghou Ma [Sat, 2 Feb 2013 22:11:25 +0000 (06:11 +0800)]
lib9/main.c: don't show the crash dialog on windows
Fixes #3202. (Or rather, work around issue 3202)

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7202053

12 years agocmd/go: run examples in source order, not name order
Russ Cox [Sat, 2 Feb 2013 21:26:12 +0000 (16:26 -0500)]
cmd/go: run examples in source order, not name order

Add Order field to doc.Example and write doc comments there.

Fixes #4662.

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

12 years agoruntime: fix windows build
Ian Lance Taylor [Sat, 2 Feb 2013 19:41:04 +0000 (11:41 -0800)]
runtime: fix windows build

Fixes #4743.

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

12 years agosyscall: (*Proc).Call should return nil error when no error occurs
Shenghou Ma [Sat, 2 Feb 2013 17:42:17 +0000 (01:42 +0800)]
syscall: (*Proc).Call should return nil error when no error occurs
Fixes #4686.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7174047

12 years agosrc: add race.bat
Shenghou Ma [Sat, 2 Feb 2013 16:49:37 +0000 (00:49 +0800)]
src: add race.bat

R=golang-dev, dave, alex.brainman
CC=golang-dev
https://golang.org/cl/7133064

12 years agocmg/gc: Fix evaluation order of map indexing during multiple assignments
Daniel Morsing [Sat, 2 Feb 2013 11:39:04 +0000 (12:39 +0100)]
cmg/gc: Fix evaluation order of map indexing during multiple assignments

Fixes #4620.

R=rsc
CC=golang-dev
https://golang.org/cl/7241051

12 years agocmd/gc: reject non-Go constants
Russ Cox [Sat, 2 Feb 2013 04:10:02 +0000 (23:10 -0500)]
cmd/gc: reject non-Go constants

Expressions involving nil, even if they can be evaluated
at compile time, do not count as Go constants and cannot
be used in const initializers.

Fixes #4673.
Fixes #4680.

R=ken2
CC=golang-dev
https://golang.org/cl/7278043

12 years agocmd/gc: silence redundant error prints for misuse of [...]int
Russ Cox [Sat, 2 Feb 2013 02:21:27 +0000 (21:21 -0500)]
cmd/gc: silence redundant error prints for misuse of [...]int

Fixes #4452.

R=ken2
CC=golang-dev
https://golang.org/cl/7241065

12 years agocmd/gc: put 'not used' message on correct line
Russ Cox [Sat, 2 Feb 2013 02:13:41 +0000 (21:13 -0500)]
cmd/gc: put 'not used' message on correct line

Fixes #4663.

R=ken2
CC=golang-dev
https://golang.org/cl/7235081

12 years agocmd/gc: clearer error for defer/go of conversion or invalid function call
Russ Cox [Sat, 2 Feb 2013 02:02:15 +0000 (21:02 -0500)]
cmd/gc: clearer error for defer/go of conversion or invalid function call

Fixes #4654.

R=ken2
CC=golang-dev
https://golang.org/cl/7229072

12 years agoreflect: explain StructField.Anonymous field as 'embedded'
Russ Cox [Sat, 2 Feb 2013 02:01:46 +0000 (21:01 -0500)]
reflect: explain StructField.Anonymous field as 'embedded'

The spec mostly uses the term embedded.
It's too late to change the field name but at least fix the docs.

Fixes #4514.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7235080

12 years agotesting: SkipNow, FailNow must be called from test goroutine
Russ Cox [Sat, 2 Feb 2013 02:01:32 +0000 (21:01 -0500)]
testing: SkipNow, FailNow must be called from test goroutine

Impossible for us to check (without sleazily reaching into the
runtime) but at least document it.

Fixes #3800.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7268043

12 years agonet: use windows GetAddrInfoW in LookupPort when possible
Alex Brainman [Fri, 18 Jan 2013 06:05:04 +0000 (17:05 +1100)]
net: use windows GetAddrInfoW in LookupPort when possible

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

12 years agoruntime, cmd/ld: make code more position-independent
Elias Naur [Fri, 1 Feb 2013 19:24:49 +0000 (11:24 -0800)]
runtime, cmd/ld: make code more position-independent

Change the stack unwinding code to compensate for the dynamic
relocation of symbols.
Change the gc instruction GC_CALL to use a relative offset instead of
an absolute address.

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

12 years agoreflect: document that Value.Slice panics on an unaddressable array.
Robert Daniel Kortschak [Fri, 1 Feb 2013 18:02:23 +0000 (10:02 -0800)]
reflect: document that Value.Slice panics on an unaddressable array.

Fixes #4736.

R=rsc
CC=golang-dev
https://golang.org/cl/7239045

12 years agosort: delete now-duplicate example, fix build
Brad Fitzpatrick [Fri, 1 Feb 2013 17:08:25 +0000 (09:08 -0800)]
sort: delete now-duplicate example, fix build

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7220075

12 years agosort: add Reverse as a function
Miek Gieben [Fri, 1 Feb 2013 16:44:45 +0000 (08:44 -0800)]
sort: add Reverse as a function

This updates: https://golang.org/cl/6909059/
Fixes #4511.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6932054

12 years agobytes, strings: add TrimPrefix and TrimSuffix
Brad Fitzpatrick [Fri, 1 Feb 2013 16:41:25 +0000 (08:41 -0800)]
bytes, strings: add TrimPrefix and TrimSuffix

Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044

12 years agocmd/6c, cmd/6g: add flag to support large-model code generation
Elias Naur [Fri, 1 Feb 2013 16:35:33 +0000 (08:35 -0800)]
cmd/6c, cmd/6g: add flag to support large-model code generation

Added the -pic flag to 6c and 6g to avoid assembler instructions that
cannot use RIP-relative adressing. This is needed to support the -shared mode
in 6l.

See also:
https://golang.org/cl/6926049
https://golang.org/cl/6822078

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

12 years agoruntime: cgo-related fixes
Russ Cox [Fri, 1 Feb 2013 16:34:41 +0000 (08:34 -0800)]
runtime: cgo-related fixes

* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.

Fixes #3774.
Fixes #3775.
Fixes #3797.

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

12 years agocmd/go: clean cgo compiler errors
Russ Cox [Fri, 1 Feb 2013 16:34:21 +0000 (08:34 -0800)]
cmd/go: clean cgo compiler errors

Cut out temporary cgo file in error message.
Show C.foo instead of _Ctype_foo.

Before:
x.go:20[/var/folders/00/05_b8000h01000cxqpysvccm000n9d/T/go-build242036121/command-line-arguments/_obj/x.cgo1.go:19]: cannot use tv.Usec (type int32) as type _Ctype___darwin_suseconds_t in assignment

After:
x.go:20: cannot use tv.Usec (type int32) as type C.__darwin_suseconds_t in assignment

Fixes #4255.

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

12 years agocmd/cgo: fix line number annotations in generated C code
Russ Cox [Fri, 1 Feb 2013 16:34:08 +0000 (08:34 -0800)]
cmd/cgo: fix line number annotations in generated C code

The old version was using go/ast's CommentGroup.Text method,
but that method drops leading blank lines from the result, so that
if the comment looked like one of

//
// syntax error
import "C"

/*
syntax error
*/
import "C"

then the line numbers for the syntax error would be off by the
number of leading blank lines (1 in each of the above cases).

The new text extractor preserves blank lines.

Fixes #4019.

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

12 years agocmd/cgo: document //export preamble restriction
Russ Cox [Fri, 1 Feb 2013 16:33:52 +0000 (08:33 -0800)]
cmd/cgo: document //export preamble restriction

Fixes #3497.

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

12 years agocmd/dist: fix build
Russ Cox [Fri, 1 Feb 2013 06:57:30 +0000 (22:57 -0800)]
cmd/dist: fix build

The Unix and Plan 9 readfile call breset(b) but Windows was not,
leaving dregs in the buffer.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7229069

12 years agocmd/dist: redirect acid output to file to separate from errors
Russ Cox [Fri, 1 Feb 2013 06:02:20 +0000 (22:02 -0800)]
cmd/dist: redirect acid output to file to separate from errors

If runtime's proc.c does not compile, cmd/dist used to show
the compile errors in a sea of acid output, making them impossible
to find. Change the command invocation to write the acid output
to a file, so that the errors are the only thing shown on failure.

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

12 years agocmd/8l: fix build
Russ Cox [Fri, 1 Feb 2013 00:13:48 +0000 (16:13 -0800)]
cmd/8l: fix build

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7241061

12 years agotest: add test that caused a gccgo compilation failure
Ian Lance Taylor [Thu, 31 Jan 2013 23:59:30 +0000 (15:59 -0800)]
test: add test that caused a gccgo compilation failure

Updates #4734.

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

12 years agoexp/cookiejar: remove external storage
Volker Dobler [Thu, 31 Jan 2013 23:56:08 +0000 (10:56 +1100)]
exp/cookiejar: remove external storage

This CL removes the external storage of a cookie jar
and minimized the exported API as discussed in [1].

[1] https://groups.google.com/d/topic/golang-dev/ygDB3nbir00/discussion

Update #1960.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7235065

12 years agoencoding/base64: fix test for ReadFull change
Russ Cox [Thu, 31 Jan 2013 22:42:56 +0000 (14:42 -0800)]
encoding/base64: fix test for ReadFull change

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

12 years agocmd/vet: add missing -all logic
Russ Cox [Thu, 31 Jan 2013 22:37:47 +0000 (14:37 -0800)]
cmd/vet: add missing -all logic

R=golang-dev, cookieo9, bradfitz
CC=golang-dev
https://golang.org/cl/7260043

12 years agocmd/ld: support for linking with host linker
Russ Cox [Thu, 31 Jan 2013 22:11:32 +0000 (14:11 -0800)]
cmd/ld: support for linking with host linker

A step toward a fix for issue 4069.

To allow linking with arbitrary host object files, add a linker mode
that can generate a host object file instead of an executable.
Then the host linker can be invoked to generate the final executable.

This CL adds a new -hostobj flag that instructs the linker to write
a host object file instead of an executable.

That is, this works:

        go tool 6g x.go
        go tool 6l -hostobj -o x.o x.6
        ld -e _rt0_amd64_linux x.o
        ./a.out

as does:

        go tool 8g x.go
        go tool 8l -hostld ignored -o x.o x.8
        ld -m elf_i386 -e _rt0_386_linux x.o
        ./a.out

Because 5l was never updated to use the standard relocation scheme,
it will take more work to get this working on ARM.

This is a checkpoint of the basic functionality. It does not work
with cgo yet, and cgo is the main reason for the change.
The command-line interface will likely change too.
The gc linker has other information that needs to be returned to
the caller for use when invoking the host linker besides the single
object file.

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

12 years agocmd/vet: check for misplaced and malformed build tags
Russ Cox [Thu, 31 Jan 2013 21:52:27 +0000 (13:52 -0800)]
cmd/vet: check for misplaced and malformed build tags

Fixes #4184.

R=golang-dev, bradfitz, minux.ma, cookieo9
CC=golang-dev
https://golang.org/cl/7251044

12 years agoio: guarantee err == nil for full reads in ReadFull and ReadAtLeast
Russ Cox [Thu, 31 Jan 2013 21:46:12 +0000 (13:46 -0800)]
io: guarantee err == nil for full reads in ReadFull and ReadAtLeast

This is a backwards compatible API change that fixes broken code.

In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
Most code expects only the former, so do that and document the guarantee.

Code that was correct before is still correct.
Code that was incorrect before, by assuming the guarantee, is now correct too.

The same applies to ReadAtLeast.

Fixes #4544.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7235074

12 years agonet/url: normalize scheme to lower case (http not HTTP)
Russ Cox [Thu, 31 Jan 2013 21:45:43 +0000 (13:45 -0800)]
net/url: normalize scheme to lower case (http not HTTP)

Also document %2f vs / ambiguity in URL.Path.

Fixes #3913.
Fixes #3659.

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

12 years agodoc/codewalk: gofmt pig.go
Russ Cox [Thu, 31 Jan 2013 21:42:26 +0000 (13:42 -0800)]
doc/codewalk: gofmt pig.go

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

12 years agocrypto/x509: test for negative RSA parameters.
Adam Langley [Thu, 31 Jan 2013 17:54:37 +0000 (12:54 -0500)]
crypto/x509: test for negative RSA parameters.

Someone found software that generates negative numbers for the RSA
modulus in an X.509 certificate. Our error messages were very poor in
this case so this change improves that.

Update #4728
Return more helpful errors when RSA parameters are negative or zero.

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

12 years agocmd/go: many bug fixes
Russ Cox [Thu, 31 Jan 2013 16:06:38 +0000 (08:06 -0800)]
cmd/go: many bug fixes

* Reject import paths of the form cmd/x/y.
* Reject 'go install' of command outside GOPATH
* Clearer error rejecting 'go install' of package outside GOPATH.
* Name temporary binary for first file in 'go run' list or for test.
* Provide a way to pass -ldflags arguments with spaces.
* Pass all Go files (even +build ignored ones) to go fix, go fmt, go vet.
* Reject 'go run foo_test.go'.
* Silence 'exit 1' prints from 'go tool' invocations.
* Make go test -xxxprofile leave binary behind for analysis.
* Reject ~ in GOPATH except on Windows.
* Get a little less confused by symlinks.
* Document that go test x y z runs three test binaries.
* Fix go test -timeout=0.
* Add -tags flag to 'go list'.
* Use pkg/gccgo_$GOOS_$GOARCH for gccgo output.

Fixes #3389.
Fixes #3500.
Fixes #3503.
Fixes #3760.
Fixes #3941.
Fixes #4007.
Fixes #4032.
Fixes #4074.
Fixes #4127.
Fixes #4140.
Fixes #4311.
Fixes #4568.
Fixes #4576.
Fixes #4702.

R=adg
CC=golang-dev
https://golang.org/cl/7225074

12 years agocmd/vet: handle added string constants in printf format check
Russ Cox [Thu, 31 Jan 2013 15:53:38 +0000 (07:53 -0800)]
cmd/vet: handle added string constants in printf format check

Fixes #4599.

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

12 years agoos: use signal strings where possible in ProcessState.String
Russ Cox [Thu, 31 Jan 2013 15:53:18 +0000 (07:53 -0800)]
os: use signal strings where possible in ProcessState.String

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

12 years agocmd/ld: retry short writes, to get error detail
Russ Cox [Thu, 31 Jan 2013 15:49:33 +0000 (07:49 -0800)]
cmd/ld: retry short writes, to get error detail

Fixes #3802.

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

12 years agoencoding/json: document case-insensitive Unmarshal key matching
Russ Cox [Thu, 31 Jan 2013 15:49:23 +0000 (07:49 -0800)]
encoding/json: document case-insensitive Unmarshal key matching

Fixes #4664.

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

12 years agocmd/8l: fix misassembling of MOVB involving (AX)(BX*1)
Rémy Oudompheng [Thu, 31 Jan 2013 07:52:46 +0000 (08:52 +0100)]
cmd/8l: fix misassembling of MOVB involving (AX)(BX*1)

The linker accepts MOVB involving non-byte-addressable
registers, by generating XCHG instructions to AX or BX.
It does not handle the case where nor AX nor BX are available.

See also revision 1470920a2804.

Assembling
    TEXT ·Truc(SB),7,$0
    MOVB BP, (BX)(AX*1)
    RET

gives before:
   08048c60 <main.Truc>:
    8048c60:       87 dd         xchg   %ebx,%ebp
    8048c62:       88 1c 03      mov    %bl,(%ebx,%eax,1)
    8048c65:       87 dd         xchg   %ebx,%ebp
    8048c67:       c3            ret

and after:
   08048c60 <main.Truc>:
    8048c60:       87 cd         xchg   %ecx,%ebp
    8048c62:       88 0c 03      mov    %cl,(%ebx,%eax,1)
    8048c65:       87 cd         xchg   %ecx,%ebp
    8048c67:       c3            ret

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

12 years agocmd/gc: inlining of variadic functions.
Rémy Oudompheng [Thu, 31 Jan 2013 07:40:59 +0000 (08:40 +0100)]
cmd/gc: inlining of variadic functions.

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

12 years agocontainer/heap: split example into two
Caleb Spare [Thu, 31 Jan 2013 07:14:29 +0000 (23:14 -0800)]
container/heap: split example into two

This adds a simple IntHeap example, and modifies the more complex
PriorityQueue example to make use of the index field it maintains.

Fixes #4331.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/7068048

12 years agoos: provide access to file LastAccessTime and CreationTime on windows
Alex Brainman [Thu, 31 Jan 2013 06:17:37 +0000 (17:17 +1100)]
os: provide access to file LastAccessTime and CreationTime on windows

Fixes #4569.

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

12 years agoexp/cookiejar: update PublicSuffixList doc comment to match the
Nigel Tao [Thu, 31 Jan 2013 03:12:43 +0000 (14:12 +1100)]
exp/cookiejar: update PublicSuffixList doc comment to match the
examples at http://publicsuffix.org/.

That website previously listed pvt.k12.wy.us, but that was an error,
as confirmed by correspondance with submissions@publicsuffix.org, and
the website was fixed on 2013-01-23.

R=adg
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7241053