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

9565 Commits

Author SHA1 Message Date
Rob Pike
d781603931 time: add a comment about how to use the Duration constants
R=golang-dev, bradfitz, r, dsymonds
CC=golang-dev
https://golang.org/cl/5696078
2012-02-26 22:24:51 +11:00
Shenghou Ma
bdca78e1a7 cmd/yacc/units.y: update comment, give better error messages when $GOROOT not set
R=r, golang-dev
CC=golang-dev
https://golang.org/cl/5698062
2012-02-26 01:36:26 +08:00
Robert Griesemer
5c7799f108 go: fix help text documenting example functions
R=adg, r
CC=golang-dev
https://golang.org/cl/5695062
2012-02-24 15:42:25 -08:00
Robert Griesemer
34e60a81d5 go/ast: examples for ast.Print, ast.Inspect
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5700057
2012-02-24 13:44:36 -08:00
Robert Griesemer
0a33b703e6 go/doc, godoc: fix range of type declarations
For grouped type declarations, go/doc introduces
fake individual declarations. Don't use the original
location of the "type" keyword because it will lead
to an overly large source code range for that fake
declaration, and thus an overly large selection shown
via godoc (e.g.: click on the AssignStmt link for:
http://golang.org/pkg/go/ast/#AssignStmt ).

Also: Don't create a fake declaration if not needed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694061
2012-02-24 13:44:22 -08:00
Rob Pike
1086dd7cfb cmd/go: in list, don't print blank lines for no output
Otherwise
        go list -f "{{if .Stale}}{{.ImportPath}}{{end}}" all
and similar commands can print pages of empty lines.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696058
2012-02-25 08:00:55 +11:00
Russ Cox
102274a30e runtime: size arena to fit in virtual address space limit
For Brad.
Now FreeBSD/386 binaries run on nearlyfreespeech.net.

Fixes #2302.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5700060
2012-02-24 15:28:51 -05:00
Russ Cox
d8ccebfffa net/http/cgi: fix empty response
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5693058
2012-02-24 15:10:46 -05:00
Anthony Martin
dc38756ce1 gc: reject import paths containing special characters
Also allow multiple invalid import statements in a
single file.

Fixes #3021. The changes to go/parser and the
language specifcation have already been committed.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5672084
2012-02-24 14:48:36 -05:00
Gustavo Niemeyer
490c3d4a42 encoding/xml: fix anonymous field Unmarshal example
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5697043
2012-02-24 14:45:32 -05:00
Shenghou Ma
04f110e530 cmd/vet: don't give error for Printf("%+5.2e", x)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5696048
2012-02-25 01:16:17 +08:00
Sanjay Menakuru
27e07a2666 os: fix minor typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5697051
2012-02-24 22:42:16 +11:00
Rob Pike
3a1c226a38 reflect.DeepEqual: don't panic comparing functions
Functions are equal iff they are both nil.

Fixes #3122.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5693057
2012-02-24 16:25:39 +11:00
Russ Cox
51a84bbfaa runtime: fix arm
signal.test binary passes on my phone; should fix builder

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5694064
2012-02-23 23:10:38 -05:00
Russ Cox
075eef4018 gc: fix escape analysis + inlining + closure bug
R=ken2
CC=golang-dev, lvd
https://golang.org/cl/5693056
2012-02-23 23:09:53 -05:00
Russ Cox
15d8b05f0c ld: fix alignment of rodata section
We were not aligning the code size,
so read-only data, which follows in the same
segment, could be arbitrarily misaligned.

Fixes #2506.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5693055
2012-02-23 23:01:36 -05:00
Russ Cox
9984a5bca4 cmd/cc: grow some global arrays
Avoids global array buffer overflows if they are
indexed using some of the values between NTYPE
and NALLTYPE.  It is entirely likely that not all of these
are necessary, but this is the C compiler and not worth
worrying much about.  This change takes up only a
few more bytes of memory and makes the behavior
deterministic.

Fixes #3078.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5693052
2012-02-23 22:45:55 -05:00
Russ Cox
91bdbf591f net/rpc: silence read error on closing connection
Fixes #3113.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5698056
2012-02-23 22:45:44 -05:00
Mikio Hara
705ebf1144 net: reorganize test files
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694063
2012-02-24 11:58:30 +09:00
David Symonds
5fb82d8cf6 net/http: add overlooked 418 status code, per RFC 2324.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5688067
2012-02-24 11:55:31 +11:00
Scott Lawrence
c05c3a9d11 html/template: make doctype check case-insensitive
Fixes #3094.

R=golang-dev, rsc, nigeltao
CC=golang-dev
https://golang.org/cl/5687065
2012-02-24 11:32:33 +11:00
Shenghou Ma
1bddfb5203 runtime: check for ARM syscall failures
While we are at it, also update some comments.
    Tested on Linux/ARM builder.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5696047
2012-02-23 15:43:14 -05:00
Scott Lawrence
7ae6872fc0 dist: treat CC as one unit
Fixes #3112.

R=golang-dev, 0xe2.0x9a.0x9b, ality, rsc, rsc
CC=golang-dev
https://golang.org/cl/5700044
2012-02-23 15:38:07 -05:00
Stefan Nilsson
83b5f067e8 binary: remove unnecessary dummy type.
R=rsc
CC=golang-dev
https://golang.org/cl/5698052
2012-02-23 15:29:17 -05:00
Robert Griesemer
999c77d78a godoc: don't show testdata directories
R=golang-dev, bradfitz, dsymonds, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5700043
2012-02-23 12:23:17 -08:00
Russ Cox
3a6a1f9e7e go/parser: expand test cases for bad import
R=gri
CC=golang-dev
https://golang.org/cl/5697047
2012-02-23 14:44:53 -05:00
Russ Cox
224f05ba88 runtime: darwin signal masking
Fixes #3101 (darwin).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5693044
2012-02-23 14:44:06 -05:00
Russ Cox
240b1d5b44 runtime: linux signal masking
Fixes #3101 (Linux).

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/5696043
2012-02-23 14:43:58 -05:00
Anthony Martin
436f297d1e cc: fix an out of bounds array access
Alternatively, we could expand the ewidth array
in [568]c/txt.c to have NALLTYPES elements and
give all types above NTYPE a width of -1.

I don't think it's worth it since TDOT and TOLD
are the only two type values above NTYPE that
are passed to typ:

$ /tmp/cctypes
cc/dcl.c:683: 			t->down = typ(TOLD, T);
cc/dcl.c:919: 		return typ(TDOT, T);
$

Fixes #3063.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694047
2012-02-23 14:28:16 -05:00
Robert Griesemer
28e0e18863 math: slightly more readable comments
Replaced /*-style comments with line comments;
there are two many *'s already in those lines.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5699051
2012-02-23 10:17:24 -08:00
Adam Langley
36d3707009 6a/6l: add IMUL3Q and SHLDL
Although Intel considers the three-argument form of IMUL to be a
variant of IMUL, I couldn't make 6l able to differentiate it without
huge changes, so I called it IMUL3.

R=rsc
CC=golang-dev
https://golang.org/cl/5686055
2012-02-23 10:51:04 -05:00
Robert Griesemer
3391de8df7 exp/types: fix package comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5695046
2012-02-22 23:40:28 -08:00
Robert Griesemer
cbaf7ca032 godoc: remove dead code
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5698044
2012-02-22 23:38:18 -08:00
Robert Griesemer
bcc3862565 go/parser: check import path restrictions
Replaces pending CL 5674097.
Thanks to ality@pbrane.org for spearheading
the effort.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5683077
2012-02-22 23:21:56 -08:00
Robert Griesemer
548591b77d go cmd: print more than one error when running go test
Fixes #3055.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5683079
2012-02-22 22:33:45 -08:00
Brad Fitzpatrick
a5b5964524 net/http: some more cookie tests
Including a commented-out test we might
tackle later, after seeing what browsers do.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5694045
2012-02-23 15:51:53 +11:00
Gustavo Niemeyer
6c20f5c013 encoding/xml: add example and docs for anon fields
Anonymous pointer fields is not yet supported.
The problem is documented in issue 3108.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694043
2012-02-23 01:35:50 -02:00
Mikio Hara
adbadf444d net: add a bit clarified multicast listener tests
Also adds -external flag to allow use of external networks on tests.

R=rsc
CC=golang-dev
https://golang.org/cl/5693043
2012-02-23 12:16:43 +09:00
Russ Cox
ebae73bb24 pprof: add Profile type
Makes it possible for client code to maintain its own profiles,
and also reduces the API surface by giving us a type that
models built-in profiles.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5684056
2012-02-22 21:46:12 -05:00
Russ Cox
e4b02bfdc0 runtime: goroutine profile, stack dumps
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5687076
2012-02-22 21:45:01 -05:00
Gustavo Niemeyer
133c6bf77f encoding/xml: move Unmarshal example to function
This also fixes MarshalIndent's example after the
recent formatting convention changes.

Fixes #2831.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5671062
2012-02-22 23:37:57 -02:00
Alex Brainman
fea7f07e56 time: run full TestTicker test even during short tests
R=golang-dev, r, bradfitz, r
CC=golang-dev
https://golang.org/cl/5689076
2012-02-23 12:07:59 +11:00
Russ Cox
123130f789 5a: fix same arm bug
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/5689073
2012-02-22 17:36:25 -05:00
Russ Cox
a5bc16d619 5c, 5g, 5l: fix arm bug
Using reg as the flag word was unfortunate, since the
default value is not 0 but NREG (==16), which happens
to be the bit NOPTR now.  Clear it.

If I say this will fix the build, it won't.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5690072
2012-02-22 16:29:14 -05:00
Russ Cox
37decab5a3 cmd/dist: fix install cmd/5g on non-arm system
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5689072
2012-02-22 16:29:05 -05:00
Mikio Hara
ee71afbb55 net: make raw IP tests robust
Make it rely on underlying socket's address family.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5673091
2012-02-23 06:27:05 +09:00
Mikio Hara
9765325d49 net: make parseProcNetIGMP more robust
Suggested by Paul Borman.

Fixes #2826.

R=rsc, borman
CC=golang-dev
https://golang.org/cl/5689048
2012-02-23 06:26:31 +09:00
Rob Pike
880cda557a os: make the system info a value not a pointer on unix
fix a couple of other minor related details.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5690071
2012-02-23 07:51:49 +11:00
Russ Cox
213997a730 net: delete debugging print
Fixes #3030.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5689071
2012-02-22 15:35:41 -05:00
Robert Griesemer
8b7cdb7f25 go/printer, gofmt: improved comma placement
Not a Go 1 issue, but appeared to be fairly easy to fix.

- Note that a few existing test cases look slightly worse but
  those cases were not representative for real code. All real
  code looks better now.

- Manual move of the comment in go/scanner/example_test.go
  before applying gofmt.

- gofmt -w $GOROOT/src $GOROOT/misc

Fixes #3062.

R=rsc
CC=golang-dev
https://golang.org/cl/5674093
2012-02-22 11:27:45 -08:00
Robert Griesemer
775f0058ac godoc: proper index range checking when extracting example code
Fixes #3092.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5683075
2012-02-22 11:25:21 -08:00
Gustavo Niemeyer
024df9f6c4 cgo: fix definition of opaque types
Fixes #3082.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5683074
2012-02-22 17:10:25 -02:00
Robert Griesemer
0c2f3b7ffd go/doc: move firstSentence into go/doc
- renamed firstSentence -> Synopsis
- also deal with common abbreviations

R=rsc
CC=golang-dev
https://golang.org/cl/5676088
2012-02-22 10:49:37 -08:00
Mikio Hara
215777b332 net: replace error variable name oserr with err
This CL replaces the last two in source tree.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5685080
2012-02-22 19:08:19 +09:00
Robert Griesemer
d74680ea1c godoc: fix potential index out-of-bounds error
R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5683072
2012-02-21 22:50:00 -08:00
Russ Cox
c2cd0d09c2 ld: get symbol table letters right
Have to assign them before we create the symbol table.
ARM debugging.

TBR=r
CC=golang-dev
https://golang.org/cl/5689067
2012-02-22 01:30:04 -05:00
Russ Cox
e29d3dfc49 gc: new, less strict bool rules
R=ken2
CC=golang-dev
https://golang.org/cl/5688064
2012-02-22 00:29:37 -05:00
Russ Cox
6c7daca236 gc: never crash during a debugging print
TBR=lvd
CC=golang-dev
https://golang.org/cl/5686063
2012-02-22 00:29:23 -05:00
Russ Cox
d1e1367cad cmd/go: add tool -n flag
As in gdb $(go tool -n 6g).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5689066
2012-02-22 00:06:50 -05:00
David Symonds
6d35302704 cmd/fix: remove os.Wait gofix.
The os.Wait function has been removed entirely, so there's no point in fixing code that called it.

R=r
CC=golang-dev
https://golang.org/cl/5685078
2012-02-22 15:46:31 +11:00
Devon H. O'Dell
b0891060ae runtime: fix FreeBSD signal handling around thread creation
Ignore signals while we are spawning a new thread. Previously, a
signal arriving just before runtime.minit setting up the signal
handler triggers a "double fault" in signal trampolining.
Fixes #3017.

R=rsc, mikioh.mikioh, minux.ma, adg
CC=golang-dev
https://golang.org/cl/5684060
2012-02-22 15:44:09 +11:00
Russ Cox
433e47dc03 ld: only set SNOPTRBSS during load
dodata will convert to SNOPTRDATA if appropriate.
Should fix arm build (hope springs eternal).

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5687074
2012-02-21 23:04:38 -05:00
Russ Cox
a457fa500d gc: return of ideal bool
This is a manual undo of CL 5674098.
It does not implement the even less strict spec
that we just agreed on, but it gets us back where
we were at the last weekly.

R=ken2
CC=golang-dev
https://golang.org/cl/5683069
2012-02-21 22:54:07 -05:00
Russ Cox
5bcad92f07 ld: add NOPTRBSS for large, pointer-free uninitialized data
cc: add #pragma textflag to set it
runtime: mark mheap to go into noptr-bss.
        remove special case in garbage collector

Remove the ARM from.flag field created by CL 5687044.
The DUPOK flag was already in p->reg, so keep using that.

Otherwise test/nilptr.go creates a very large binary.
Should fix the arm build.
Diagnosed by minux.ma; replacement for CL 5690044.

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/5686060
2012-02-21 22:08:42 -05:00
Robert Griesemer
7b22e46282 godoc: fix absolute->relative mapping
Fixes #3096.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5690063
2012-02-21 18:12:37 -08:00
Devon H. O'Dell
8542dc0764 runtime: use SYSCALL instead of INT 0x80 in FreeBSD's runtime.osyield on amd64
R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/5690062
2012-02-22 11:04:25 +09:00
Brad Fitzpatrick
9c8923f7dc net/http: update test to use time.Duration better
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5688063
2012-02-22 11:22:09 +11:00
Brad Fitzpatrick
31e94293fc net/textproto: accept bad MIME headers as browsers do
Accept certain non-compliant response headers
(in particular, when spaces preceed the colon).
All major browser and curl seem to support this,
and at least one webserver seems to send these.

*shrug*

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5690059
2012-02-22 11:13:59 +11:00
Robert Griesemer
5f2ecbff71 text/tabwriter: fix documentation by adding an example.
R=rsc, r
CC=golang-dev
https://golang.org/cl/5685069
2012-02-21 14:48:17 -08:00
Bobby Powers
d36426995a cmd/dist: fix pprof permissions
When installing pprof into the tools directory, it needs to
have execute permissions on unix-like systems.

Fixes issues 3077.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5675095
2012-02-21 16:49:30 -05:00
Russ Cox
2110fadd12 net/smtp: use EHLO then HELO
Before we were using "ESMTP" in the banner as a clue,
but that is not required by the RFC and breaks mailing
to smtp.yandex.ru.

Fixes #3045.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5687066
2012-02-21 16:39:02 -05:00
Russ Cox
fc7ed45b35 runtime: avoid malloc during malloc
A fault during malloc might lead to the program's
first call to findfunc, which would in turn call malloc.
Don't do that.

Fixes #1777.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5689047
2012-02-21 16:36:15 -05:00
Mike Rosset
e5013e89f1 cmd/go: pass 2, remove reference to incomplete -file flag
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5686058
2012-02-21 15:42:03 -05:00
Mike Rosset
7507f3f257 cmd/go: 'go help test' remove documentation for incomplete -file flag
R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/5673093
2012-02-21 13:23:33 -05:00
Adam Langley
3053778965 cmd/*: add -d option to bison.
Without -d, bison doesn't generate y.tab.h.

R=rsc
CC=golang-dev
https://golang.org/cl/5685065
2012-02-21 10:50:58 -05:00
Marcel van Lohuizen
ecd24f381e exp/norm: Added Iter type for iterating on segment boundaries. This type is mainly to be used
by other low-level libraries, like collate.  Extra care has been given to optimize the performance
of normalizing to NFD, as this is what will be used by the collator.  The overhead of checking
whether a string is normalized vs simply decomposing a string is neglible.  Assuming that most
strings are in the FCD form, this iterator can be used to decompose strings and normalize with
minimal overhead.

R=r
CC=golang-dev
https://golang.org/cl/5676057
2012-02-21 13:13:21 +01:00
Rémy Oudompheng
d75023e1d1 cmd/api: record return type of functions for variable typecheck.
Also cleanup the resolveName method.

Fixes failure on go/build declaration:
        var ToolDir = filepath.Join(...)

R=golang-dev, bradfitz
CC=golang-dev, remy
https://golang.org/cl/5681043
2012-02-21 07:37:25 +01:00
Rob Pike
152d806b16 net: extend the workaround to DialTCP to try to get arm building again.
Awfulness by the bucket that we hope
Fixes #3057.

R=golang-dev, mikioh.mikioh, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5687060
2012-02-21 16:48:05 +11:00
Rémy Oudompheng
f2ad374ae6 cmd/gc: don't believe that variables mentioned 256 times are unused.
Such variables would be put at 0(SP), leading to serious
corruptions at zero initialization.
Fixes #3084.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5683052
2012-02-21 16:38:01 +11:00
Rob Pike
c9bb042287 net: more selfConnect debugging: panic if ra == nil in internetSocket
TBR=dsymonds

R=dsymonds
CC=golang-dev
https://golang.org/cl/5687058
2012-02-21 15:49:08 +11:00
Rob Pike
3970d2fd58 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
2012-02-21 15:21:34 +11:00
Rob Pike
2155a0408e net: add diagnostic to try to catch selfConnect bug earlier
TBR=dsymonds

R=golang-dev
CC=golang-dev
https://golang.org/cl/5683057
2012-02-21 14:53:07 +11:00
Rob Pike
ccacab641a os: replace non-portable Waitmsg with portable ProcessState
Use methods for key questions.
Provide access to non-portable pieces through portable methods.
Windows and Plan 9 updated.

R=golang-dev, bradfitz, bradfitz, r, dsymonds, rsc, iant, iant
CC=golang-dev
https://golang.org/cl/5673077
2012-02-21 14:10:34 +11:00
Mikio Hara
22c41ff019 runtime: remove an obsolete file
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5686049
2012-02-21 12:07:38 +09:00
Brad Fitzpatrick
8729d158ca net: more docs on deadlines
Fixes #2777

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5685060
2012-02-21 11:11:18 +11:00
Brad Fitzpatrick
dc19b94b21 net/http: add optional Server.TLSConfig field
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5688047
2012-02-21 10:24:15 +11:00
Devon H. O'Dell
dff5535aaa runtime: implement runtime.osyield on FreeBSD 386, amd64
R=rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5689046
2012-02-21 07:32:20 +09:00
Mikio Hara
6e4ddc6872 net: move hosts testdata to testdata folder
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5687052
2012-02-21 07:11:44 +09:00
Russ Cox
8998835543 5g, 6g, 8g: flush modified globals aggressively
The alternative is to record enough information that the
trap handler know which registers contain cached globals
and can flush the registers back to their original locations.
That's significantly more work.

This only affects globals that have been written to.
Code that reads from a global should continue to registerize
as well as before.

Fixes #1304.

R=ken2
CC=golang-dev
https://golang.org/cl/5687046
2012-02-20 13:41:44 -05:00
Dmitriy Vyukov
b40000423b cmd/6c: add line feed after an error message
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5685051
2012-02-20 13:57:14 +04:00
Rob Pike
b5a3bd5ff6 os: drop the Wait function and the options to Process.Wait
They are portability problems and the options are almost always zero in practice anyway.

R=golang-dev, dsymonds, r, bradfitz
CC=golang-dev
https://golang.org/cl/5688046
2012-02-20 15:36:08 +11:00
Brad Fitzpatrick
943f6cc837 database/sql/driver: API cleanups
-- add driver.Value type and documentation,
   convert from interface{} to Value where
   appropriate.
-- don't say "subset" anywhere,
-- SubsetValuer -> Valuer
-- SubsetValue -> Value
-- IsParameterSubsetType -> IsValue
-- IsScanSubsetType -> IsScanValue

Fixes #2842

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5674084
2012-02-20 14:25:28 +11:00
Rob Pike
0ce6c87004 html/template: don't indirect past a Stringer
While we're here, get rid of the old names for the escaping functions.

Fixes #3073.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5685049
2012-02-20 14:23:45 +11:00
Russ Cox
a53317668a strconv: run garbage collection before counting allocations in test
My theory is that the call to f() allocates, which triggers
a garbage collection, which itself may do some allocation,
which is being counted.  Running a garbage collection
before starting the test should avoid this problem.

Fixes #2894 (I hope).

R=golang-dev, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/5685046
2012-02-19 22:13:04 -05:00
Rob Pike
9c9b96f028 go/doc: update golden file to fix build
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5683046
2012-02-20 14:06:38 +11:00
Rob Pike
d6f8c751de all: rewrite references to old tool names
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5683045
2012-02-20 13:42:37 +11:00
Fazlul Shahriar
441538eb57 os,time: fix Plan 9 build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5689043
2012-02-20 12:31:24 +11:00
Alex Brainman
7a4d7444f0 build: implement clean.bat
Fixes #2893.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5685047
2012-02-20 12:17:27 +11:00
David Symonds
bcb7a85334 html/template: minor tweak to docs to improve HTML typography.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5684046
2012-02-20 11:43:34 +11:00
Shenghou Ma
463009ff06 5a, 5c, 5g, 5l: fix build for Linux/ARM.
ARM doesn't have the concept of scale, so I renamed the field
Addr.scale to Addr.flag to better reflect its true meaning.

R=rsc
CC=golang-dev
https://golang.org/cl/5687044
2012-02-19 18:11:16 -05:00
Shenghou Ma
b17a233633 syscall: force Windows to always use US English error messages
Fixes #1834.

R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5673068
2012-02-20 09:51:25 +11:00
Russ Cox
3c831f6395 cmd/fix: add runtime renamings
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5685043
2012-02-19 16:10:45 -05:00
Russ Cox
1a0c8fe9bb cmd/cgo: bug fixes
* disallow embedding of C type (Fixes issue 2552)
* detect 0-length array (Fixes issue 2806)
* use typedefs when possible, to avoid attribute((unavailable)) (Fixes issue 2888)
* print Go types constructed from C types using original C types (Fixes issue 2612)

This fix changes _cgo_export.h to repeat the preamble from import "C".
Otherwise the fix to issue 2612 is impossible, since it cannot refer to
types that have not been defined.  If people are using //export and
putting non-header information in the preamble, they will need to
refactor their code.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5672080
2012-02-19 13:32:55 -05:00
Shenghou Ma
cf52e39ee0 6l, 8l: fix build for ELF systems
R=rsc
CC=golang-dev
https://golang.org/cl/5677095
2012-02-19 13:16:47 -05:00
Russ Cox
8a4c2b3cc4 runtime: fix another memory leak
morebuf holds a pc/sp from the last stack split or
reflect.call or panic/recover.  If the pc is a closure,
the reference will keep it from being collected.

moreargp holds a pointer to the arguments from the
last stack split or reflect.call or panic/recover.
Normally it is a stack pointer and thus not of interest,
but in the case of reflect.call it is an allocated argument
list and holds up the arguments to the call.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5674109
2012-02-19 11:05:19 -05:00
Russ Cox
4e3f8e915f gc, ld: tag data as no-pointers and allocate in separate section
The garbage collector can avoid scanning this section, with
reduces collection time as well as the number of false positives.
Helps a little bit with issue 909, but certainly does not solve it.

R=ken2
CC=golang-dev
https://golang.org/cl/5671099
2012-02-19 03:19:52 -05:00
Russ Cox
cb5e181fe7 time: switch to using (uncompressed) zoneinfo zip file
Removal of old zoneinfo files is a separate CL due to its size.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5676100
2012-02-19 03:16:20 -05:00
Russ Cox
990f9f4c00 encoding/json: disable anonymous fields
We should, after Go 1, make them work the same as
package xml, that is, make them appear in the outer
struct.  For now turn them off so that people do not
depend on the old behavior.

Fixing them is issue 3069.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656102
2012-02-19 00:27:05 -05:00
Russ Cox
89b075cc90 runtime: fix tiny memory leak
The m->cret word holds the C return value when returning
across a stack split boundary.  It was not being cleared after
use, which means that the return value (if a C function)
or else the value of AX/R0 at the time of the last stack unsplit
was being kept alive longer than necessary.  Clear it.

I think the effect here should be very small, but worth fixing
anyway.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5677092
2012-02-19 00:26:33 -05:00
Brad Fitzpatrick
efacb2a1b4 os: remove Getenverror
Fixes #3065

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5675094
2012-02-18 21:18:13 -08:00
Russ Cox
83feedf7bf gc: fix error for floating-point constant %
R=ken2
CC=golang-dev
https://golang.org/cl/5674108
2012-02-19 00:12:31 -05:00
Russ Cox
03f2289f7e runtime: API
Delete Alloc, Free, Lookup, Semacquire, Semrelease

Fixes #2955.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5675093
2012-02-19 00:11:44 -05:00
Russ Cox
126d475a43 gc: drop ideal bool
R=golang-dev, ken2
CC=golang-dev
https://golang.org/cl/5674098
2012-02-18 21:07:08 -05:00
Russ Cox
ad17a9c0a9 time: use Go distribution zoneinfo if system copy not found
Fixes #2964.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656101
2012-02-18 21:02:41 -05:00
Mikio Hara
e91bf2e9d1 net: make LocalAddr on multicast return group address
Fixes #3067.

R=golang-dev, rsc, rsc
CC=golang-dev
https://golang.org/cl/5656098
2012-02-19 10:50:03 +09:00
Russ Cox
95b0fe141c cmd/api: s/ideal-bool/bool/
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5674105
2012-02-18 20:31:19 -05:00
Russ Cox
0e70f2722b all: shorten some of the longer tests
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5675092
2012-02-18 16:24:23 -05:00
Rob Pike
68b35b0852 templates: minor edits to the documentation
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5677084
2012-02-19 07:45:12 +11:00
Brad Fitzpatrick
a5f21c95dc os: document the type of link errors
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673090
2012-02-18 04:45:43 -08:00
David Symonds
85f2d18a72 bytes: document Compare/Equal semantics for nil arguments, and add tests.
R=golang-dev, bradfitz, r, r
CC=golang-dev
https://golang.org/cl/5676090
2012-02-18 17:39:40 +11:00
Rob Pike
701fb580bd html/template: replace obsolete reference to template.Set
Fixes #3053.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5656094
2012-02-18 16:02:51 +11:00
Nigel Tao
130b29b637 image: add Decode example.
R=r, bradfitz, r, adg
CC=golang-dev
https://golang.org/cl/5675076
2012-02-18 15:09:01 +11:00
Rob Pike
420f713b7a encoding/gob: cache engine for user type, not base type
When we build the encode engine for a recursive type, we
mustn't disregard the indirections or we can try to reuse an
engine at the wrong indirection level.

Fixes #3026.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5675087
2012-02-18 14:38:37 +11:00
Rob Pike
793f6f3cc3 encoding/gob: fix mutually recursive slices of structs
Fix by setting the element type if we discover it's zero while building.
We could have fixed this better with foresight by doing the id setting in a
different sequence, but doing that now would break binary compatibility.

Fixes #2995.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5675083
2012-02-18 12:43:08 +11:00
Andrew Gerrand
3e804f98d7 pkg: a slew of examples
R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5676071
2012-02-18 11:48:33 +11:00
Robert Griesemer
3063ff5168 crypto/dsa: add missing period in package comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5673087
2012-02-17 14:48:44 -08:00
Rob Pike
7d1c5328ed math/rand: Intn etc. should panic if their argument is <= 0.
I am making a unilateral decision here. I could also settle for returning 0,
as long it's documented, but I argue that it's equivalent to an index
out of bounds.

Fixes #2892.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5676079
2012-02-18 08:53:03 +11:00
Anthony Martin
566e0fe785 os: fix existential typo
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5675081
2012-02-18 07:44:38 +11:00
Robert Griesemer
b6e2d6b778 go/doc: move Example code from go/ast to go/doc.
Fixes #3048.

R=rsc
CC=golang-dev
https://golang.org/cl/5672081
2012-02-17 12:00:12 -08:00
Russ Cox
c4c92ebeb6 cmd/gc: fix comparison of struct with _ field
Fixes #2989.

R=ken2
CC=golang-dev
https://golang.org/cl/5674091
2012-02-17 14:45:29 -05:00
Gustavo Niemeyer
ce020ffacd runtime: remove use of ?:
Fixes #3061.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5656089
2012-02-17 17:13:16 -02:00
Robert Griesemer
6cdf0a1eab godoc: don't print spurious suggestion when running "go doc foo"
Fixes #3041.

R=rsc
CC=golang-dev
https://golang.org/cl/5671087
2012-02-17 11:01:16 -08:00
Robert Griesemer
f7ce57b1c8 go/parser: example for ParseFile use
R=r
CC=golang-dev
https://golang.org/cl/5675074
2012-02-17 09:31:42 -08:00
Robert Griesemer
ac6357b44d go/scanner: replace comment with example
R=r
CC=golang-dev
https://golang.org/cl/5676074
2012-02-17 09:26:36 -08:00
Shenghou Ma
710d0540e2 cmd/dist: make dir check in defaulttarg() more robust
1, strip last path separator from $GOROOT
   The user might define GOROOT=/path/to/go/, but then the dir
   check in defaulttarg() will always complain the current dir
   is not within $GOROOT/src/.
2, resolve symlinks in the default goroot
   Or if getcwd() returns a fully-resolved path, the check in
   defaulttarg() will always fail.

R=rsc
CC=golang-dev
https://golang.org/cl/5649073
2012-02-17 11:29:34 -05:00
Evan Shaw
fc444ebac1 8a, 8l: add EMMS instruction
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5673081
2012-02-17 11:21:46 -05:00
Dmitriy Vyukov
76eb911a3c sync: say that Cond.Wait can not return spuriously
R=golang-dev, r, rsc, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/5674086
2012-02-17 13:20:11 +04:00
Dmitriy Vyukov
649f771b7b net/rpc: fix spurious panic in test
The panic happens if -benchtime flag is specified:
go test -bench=EndToEndAsyncHTTP -benchtime=120

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5677075
2012-02-17 11:42:02 +04:00
Alex Brainman
b8f465644c runtime: silence warnings
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5656084
2012-02-17 17:05:41 +11:00
Russ Cox
b27bd42a9a net/url: API
Convert cryptotype to general go1rename fix.
Add os.Exec -> syscall.Exec fix along with new
URL fixes.

Fixes #2946.

R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/5672072
2012-02-16 23:46:28 -05:00
David Symonds
d8e715cab4 net/url: spell the package name correctly.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5676076
2012-02-17 15:31:07 +11:00
Nigel Tao
a52027a491 fix: walk ast.Ellipsis values.
Fixes #2583.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5671078
2012-02-17 14:39:50 +11:00
David Symonds
3d8ebefbbe runtime: Permit default behaviour of SIGTSTP, SIGTTIN, SIGTTOU.
Fixes #3037.

R=rsc, minux.ma, r, rsc
CC=golang-dev
https://golang.org/cl/5674072
2012-02-17 14:36:40 +11:00
Rob Pike
efb28b2ac1 os: add a simple example to the package doc.
Shows error handling and slices for Read and Write.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5676075
2012-02-17 14:30:25 +11:00
Russ Cox
a4d124d75b log/syslog: disable on Windows
We want to be able to implement good Windows support
after Go 1.  Right now Windows tries to use Unix domain
sockets, and I'd rather just have it not be available.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5671076
2012-02-16 22:04:13 -05:00
Brad Fitzpatrick
008e64da39 net: package doc overview / examples
Fixes #2774

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673076
2012-02-17 13:07:06 +11:00
Mikio Hara
03d4c7c7d7 net, os, syscall: delete os.EPLAN9
Also fixes plan9 cross-build.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5675073
2012-02-17 10:59:30 +09:00
Rob Pike
a15f59ef1d debug/dwarf: address TODO in doc comment for New
Fixes #2844.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5675072
2012-02-17 12:47:56 +11:00
Rob Pike
785ee50c55 net/textproto: delete spurious quote
Sigh.

R=golang-dev, gri, nigeltao
CC=golang-dev
https://golang.org/cl/5675071
2012-02-17 11:35:38 +11:00
Rob Pike
c49edc6137 net/textproto: add Conn to doc comment
This revolutionary transfiguration undergirding the code base
Fixes #2945.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5676072
2012-02-17 10:21:12 +11:00
Rob Pike
56069f0333 os: delete os.EINVAL and so on
The set of errors forwarded by the os package varied with system and
was therefore non-portable.
Three helpers added for portable error checking: IsExist, IsNotExist, and IsPermission.
One or two more may need to come, but let's keep the set very small to discourage
thinking about errors that way.

R=mikioh.mikioh, gustavo, r, rsc
CC=golang-dev
https://golang.org/cl/5672047
2012-02-17 10:04:29 +11:00
Rob Pike
c560a0742b path/filepath: fix test on darwin
/tmp being itself a symlink causes problems for the test, so use / as the absolute path.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5675070
2012-02-17 09:56:14 +11:00
Rémy Oudompheng
1d3ca9236e cmd/gc: correctly typecheck expression lists in returns.
Invalid return statements were accidentally compiling or
triggering internal errors.
Fixes #3044.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5673074
2012-02-16 23:42:19 +01:00
Robert Griesemer
f43d2b7fa8 go/parser: imaginary constants and ! may start an expression
Complete list of tokens that can start a top-level expression.

R=rsc
CC=golang-dev
https://golang.org/cl/5671074
2012-02-16 14:13:31 -08:00
David Symonds
4b171e5040 runtime: rename Cgocalls and Goroutines to NumCgoCall and NumGoroutine, respectively.
Update some other docs too.

Update #2955.

R=rsc
CC=golang-dev
https://golang.org/cl/5676060
2012-02-17 08:49:41 +11:00
Hector Chu
7fc47928fc make.bat, run.bat: echo newlines
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5671072
2012-02-16 20:49:50 +00:00
Russ Cox
014568bee1 syscall: fix bounds check in Error
Fixes #3042.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5675067
2012-02-16 15:23:50 -05:00
Rob Pike
e574480ed1 encoding/gob: catch internal error when it happens
It was being skipped due to an oversight.
Also adjust naming parameters for map type construction - makes debugging easier.
Prelude to issue 3026.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5674071
2012-02-17 07:07:53 +11:00
Rémy Oudompheng
3e7d804749 path, path/filepath: polish documentation.
Fixes #2950.
Fixes #2951.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5672044
2012-02-16 20:05:39 +01:00
Bobby Powers
8098d711f3 cmd/go: fix 'go help <command>'
It depended on the old behavior of functions in structs.

R=golang-dev, rsc
CC=golang-dev, r
https://golang.org/cl/5656076
2012-02-16 14:05:17 -05:00
David du Colombier
11f4a6c9df os,syscall: fix plan 9 build
NewFile take uintptr
make syscall.ProcAttr.Files be []uintptr

R=rsc
CC=golang-dev
https://golang.org/cl/5656073
2012-02-16 14:04:51 -05:00
Bobby Powers
7c2bfa4f2c dist: add clang specific -Wno options
Clang 3.1 has more warnings enabled by default than GCC.
Combined with -Werror, they cause the build to fail
unnecessarily.  if the name of our compiler ends in "clang",
add the necessary extra -Wno options.  Ideally we would add
these flags unconditionally, as GCC is supposed to ignore
unknown -Wno flags, but apple's llvm-gcc doesn't.

Fixes #2878.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5673055
2012-02-16 13:31:46 -05:00
Sébastien Paolacci
5c598d3c9f runtime: release unused memory to the OS.
Periodically browse MHeap's freelists for long unused spans and release them if any.

Current hardcoded settings:
        - GC is forced if none occured over the last 2 minutes.
        - spans are handed back after 5 minutes of uselessness.

SysUnused (for Unix) is a wrapper on madvise MADV_DONTNEED on Linux and MADV_FREE on BSDs.

R=rsc, dvyukov, remyoudompheng
CC=golang-dev
https://golang.org/cl/5451057
2012-02-16 13:30:04 -05:00
Nigel Tao
85d33918a0 cmd, pkg/go/*: fix "go vet" warnings for go/ast and go/printer
struct literals.

R=gri
CC=golang-dev
https://golang.org/cl/5653073
2012-02-16 22:43:41 +11:00
Rob Pike
fa8bc8a648 os: fix build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5674070
2012-02-16 17:39:04 +11:00
Rob Pike
dfef0c2dcc html/template: clone is implemented elsewhere, so delete this implementation
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5676064
2012-02-16 17:36:06 +11:00
Rob Pike
edf1c038e3 os: remove use of _test
Part of issue 2573.

R=dsymonds, golang-dev
CC=golang-dev
https://golang.org/cl/5674064
2012-02-16 17:05:43 +11:00
Rob Pike
7e8a369426 exp/inotify: remove use of _test
Fixes #2573.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5676063
2012-02-15 21:23:58 -08:00
Rob Pike
cc34f4b565 windows: fix build
R=golang-dev
TBR=dsymonds
CC=golang-dev
https://golang.org/cl/5673064
2012-02-16 16:07:26 +11:00
David Symonds
8342793e7b net/url: Rename ParseWithReference to ParseWithFragment.
Updates #2946.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5671061
2012-02-16 15:56:03 +11:00
Rob Pike
34de45c435 exp/winfsnotify: remove reference to _test
Updates #2573.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5677063
2012-02-16 15:34:27 +11:00
David Symonds
2f8d94fe4b net/url: regularise receiver names.
Update #2946.

R=golang-dev, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/5674065
2012-02-16 15:07:54 +11:00
David Symonds
7ec5499d36 debug/gosym: more carefully build the test binary.
TBR=r
CC=golang-dev
https://golang.org/cl/5676062
2012-02-16 15:06:12 +11:00
Gustavo Niemeyer
aed20a6951 encoding/xml: add MarshalIndent and move the example
An unindented XML example is hard to follow. MarshalIndent
allows moving the example over to a test file (and fixing it).

R=golang-dev, r, gustavo, r, rsc
CC=golang-dev
https://golang.org/cl/5674050
2012-02-16 02:01:46 -02:00
David Symonds
0fc441b053 debug/gosym: dump 6a/6l output to process stdout/stderr so we can see failures.
TBR=r
CC=golang-dev
https://golang.org/cl/5671060
2012-02-16 14:54:45 +11:00
David Symonds
3430599306 debug/gosym: Remove Makefile, rewrite test using go tool.
Update #2573.

R=r
CC=golang-dev
https://golang.org/cl/5656071
2012-02-16 14:47:14 +11:00
Andrew Gerrand
8bb7f7791b sort: add interface examples
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5677060
2012-02-16 13:16:07 +11:00
Rob Pike
d3f9aa47e5 cmd/go: fix 'go help'
It depended on old behavior of functions in structs.
Solved by adding a boolean method to check .Run != nil.

R=golang-dev, adg, r, rsc
CC=golang-dev
https://golang.org/cl/5674062
2012-02-15 18:12:42 -08:00
Andrew Gerrand
e9016bb8a7 go/ast: return Examples in name order
R=bradfitz
CC=golang-dev
https://golang.org/cl/5673061
2012-02-16 13:08:35 +11:00
Andrew Gerrand
7c9662f461 godoc: show example function doc comments in UI
R=gri
CC=golang-dev
https://golang.org/cl/5677061
2012-02-16 12:43:22 +11:00
Andrew Gerrand
11e113db57 godoc: make example code more readable with new comment convention
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention

This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).

An idiomatic example looks like this:

// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
        // example body that does bar and quux

        // Output:
        // example output
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
Alex Brainman
fa0100cf26 make.bat: implement --no-clean
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5656070
2012-02-16 11:34:41 +11:00
Alex Brainman
034c72a557 build: use setlocal in run.bat
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672061
2012-02-16 10:44:55 +11:00
Alex Brainman
32cb495b18 build: keep environment variable changes local during Windows build
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5673048
2012-02-16 10:26:01 +11:00
Rémy Oudompheng
79db6ada48 cmd/gc: error on constant shift overflows.
Fixes #3019.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5674044
2012-02-16 00:19:42 +01:00
Brad Fitzpatrick
88f8af127a bufio: don't return errors from good Peeks
Fixes #3022

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5674060
2012-02-16 10:15:36 +11:00
Brad Fitzpatrick
3a317183a1 net/http: add some examples
R=golang-dev, dsymonds, adg, rogpeppe, bradfitz
CC=golang-dev
https://golang.org/cl/5673052
2012-02-16 10:15:10 +11:00
Andrew Gerrand
f3c3130685 godoc: support for package examples, display example suffixes
Fixes #2896.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5677047
2012-02-16 09:44:01 +11:00
Brad Fitzpatrick
9578839d60 net/http: fix race in sendfile test
Whoops. Consume the body of the first request
before making the subsequent /quit request.

R=golang-dev, untheoretic
CC=golang-dev
https://golang.org/cl/5674054
2012-02-16 09:27:26 +11:00
Robert Griesemer
47afa4dba5 go/printer: don't lose relevant parentheses when rewriting selector expressions
Also: Simplified handling of selector expressions. As a result, complicated
multi-line expressions containing selectors and calls/indices with arguments
broken accross lines don't get indented the same way as before, but the change
is minimal (see tests) and there's no such code in the std library. It seems
a worthwhile compromise given the much simpler code.

Applied gofmt -w $GOROOT/src $GOROOT/misc .

Fixes #1847.

R=rsc
CC=golang-dev
https://golang.org/cl/5675062
2012-02-15 12:25:37 -08:00
David du Colombier
1064f3a97b runtime: define NSIG to fix plan 9 build
R=rsc
CC=golang-dev
https://golang.org/cl/5677053
2012-02-15 14:36:20 -05:00
Shenghou Ma
53d94a7220 cmd/go: suggest 'go test -i [args to test]'
Fixes #3023.

R=rsc
CC=golang-dev
https://golang.org/cl/5674055
2012-02-15 13:26:50 -05:00
Shenghou Ma
9c1f54c9ed cmd/go: go test -i correctly handle cgo packages
Previous CL (5674043) omit the case where runtime/cgo itself is out-of-date.
Fixes #2936 (again).

R=rsc
CC=golang-dev
https://golang.org/cl/5674048
2012-02-15 13:26:22 -05:00
Russ Cox
2506fd43d4 build: add make.bash --no-clean option
Makes it possible to run

GOARCH=amd64 make.bash
GOARCH=386 make.bash --no-clean

to avoid deleting some of the work done by the first one.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5673056
2012-02-15 11:48:17 -05:00
Mikio Hara
0724e5cefe build: fix clean.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672052
2012-02-15 23:52:07 +09:00
Alex Brainman
def2022bc0 cmd/dist: use correct package target when cross-compiling
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672050
2012-02-15 09:02:45 -05:00
Shenghou Ma
6ed2b6c47d 5c, 6c, 8c, 6g, 8g: correct boundary checking
CL 5666043 fixed the same checking for 5g.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5666045
2012-02-15 08:59:03 -05:00
Albert Strasheim
571d6fc5e8 syscall: Make Pdeathsig type Signal in SysProcAttr on Linux.
R=rsc, iant, iant
CC=golang-dev
https://golang.org/cl/5656058
2012-02-14 21:31:20 -08:00
Nigel Tao
0c5239410e html/template: add Clone and AddParseTree. Make text/template's Clone
return (*Template, error), not just *Template.

Fixes #2757.

R=r
CC=golang-dev
https://golang.org/cl/5665044
2012-02-15 16:16:30 +11:00
Rob Pike
aca8071fd5 text/template: evaluate function fields
Just an oversight they didn't work and easy to address.

Fixes #3025.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5656059
2012-02-15 16:05:34 +11:00
Alex Brainman
9a44560033 time: run TestTicker for longer during short test, otherwise it fails
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671049
2012-02-15 14:56:47 +11:00
Nigel Tao
da8f037b57 fix: add fix for bufio, gzip, zlib NewWriterXxx changes.
Fixes #2979.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5664046
2012-02-15 14:41:47 +11:00
Yasuhiro Matsumoto
6fae34db94 cmd/dist: xprintf() can't output whole of 'dist env'.
R=golang-dev, mpimenov, alex.brainman
CC=golang-dev
https://golang.org/cl/5667045
2012-02-15 14:25:27 +11:00
Brad Fitzpatrick
dabf3db715 os/exec: add some examples
R=golang-dev, adg, r, bradfitz
CC=golang-dev
https://golang.org/cl/5675054
2012-02-15 14:24:24 +11:00
Lai Jiangshan
cc8e12bb52 reflect: fix panic strings
use ':' instead of ';' to keep consistency with the other panic strings

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5666048
2012-02-15 13:51:49 +11:00
Andrew Gerrand
d6a3650ad7 strings: add Bernardo O'Higgins example
R=r, bradfitz
CC=golang-dev, rogpeppe
https://golang.org/cl/5673049
2012-02-15 13:38:28 +11:00
Brad Fitzpatrick
7127b6fddc bytes,strings: make *Reader implement io.ReaderAt
R=golang-dev, adg, bradfitz, r
CC=golang-dev
https://golang.org/cl/5675053
2012-02-15 12:58:00 +11:00
Gustavo Niemeyer
8eee153bc8 runtime: fix grsec support
Changeset 36c9c7810f14 broke support for grsec-patched kernels.
Those do not give back the address requested without MAP_FIXED,
so when verifying an mmap without this flag for success, the
resulting address must not be compared against the requested
address since it may have succeeded at a different location.

R=golang-dev, rsc, gustavo, iant
CC=golang-dev
https://golang.org/cl/5650072
2012-02-14 22:09:02 -02:00
Brad Fitzpatrick
977e8d145b bytes: add Reader
copy of strings/reader{,_test}.go with
a few s/string/[]byte/

Fixes #2861

R=adg, rsc, r
CC=golang-dev
https://golang.org/cl/5666044
2012-02-15 11:06:16 +11:00
Brad Fitzpatrick
c210ddfe2c net/http: make strace test more robust
Apparently some distros don't let you ptrace attach
to your own existing processes.

Run strace on the child directly, instead, which
reportedly is more often allowed, and makes the
code simpler too.

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5675050
2012-02-15 11:05:51 +11:00
David Symonds
0ab3ea9738 build: create the correct $GOTOOLDIR.
Before this, make.bash --dist-tool would fail,
because $GOROOT/bin/tool was being mkdir'd
instead of $GOROOT/pkg/tool/linux_amd64.

R=rsc
CC=golang-dev
https://golang.org/cl/5666046
2012-02-15 09:06:24 +11:00
Robert Griesemer
3a582a768b godoc: make godoc go work
- if a package path leads to subdirectories only,
  show command instead, if any
- to force documentation for a command, use the
  cmd/ prefix, as in: godoc cmd/go
  (note that for the go command, the prefix is
  not required since there is no actual go library
  package at the moment)

Fixes #3012.

R=rsc
CC=golang-dev
https://golang.org/cl/5665049
2012-02-14 13:57:21 -08:00
David Symonds
95902d10d2 build: fix sudo.bash.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5647063
2012-02-15 08:42:16 +11:00
Russ Cox
9f333170bf cmd/go: a raft of fixes
* add -work option to save temporary files (Fixes issue 2980)
* fix go test -i to work with cgo packages (Fixes issue 2936)
* do not overwrite/remove empty directories or non-object
  files during build (Fixes issue 2829)
* remove package main vs package non-main heuristic:
  a directory must contain only one package (Fixes issue 2864)
* to make last item workable, ignore +build tags for files
  named on command line: go build x.go builds x.go even
  if it says // +build ignore.
* add // +build ignore tags to helper programs

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5674043
2012-02-14 16:39:20 -05:00
Maxim Pimenov
87a04c0bcf gc: fix comment in mkbuiltin
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5669046
2012-02-14 16:27:35 -05:00
Rémy Oudompheng
2a6e6999a4 runtime, time: accelerate tests in short mode.
before   after
go test -short time                4.144s  1.215s
go test -short runtime             1.315s  0.351s
go test -short -cpu=1,2,4 runtime  4.376s  1.266s

Partially solves issue 3015.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/5673045
2012-02-14 22:13:19 +01:00
Rémy Oudompheng
f8f0a2bc7b cgo: add support for returning errno with gccgo.
Also eliminate some warnings in builds.

R=golang-dev, fullung, iant, rsc
CC=golang-dev, remy
https://golang.org/cl/5650066
2012-02-14 20:23:45 +01:00
Anthony Martin
9f8c2c8bbf os: rename SyscallError.Errno to SyscallError.Err
This lets us get rid of the OS-dependent implementations
of SyscallError.  The name "Err" was chosen to match the
PathError type.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5651084
2012-02-14 14:22:34 -05:00
Russ Cox
33f7596f8d syscall: linux Tgkill takes a Signal too
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5649089
2012-02-14 13:07:14 -05:00
Robert Griesemer
1076d4ef73 go/doc: treat predeclared error interface like an exported type
Also added -files flag to provide regexp for test files for
selective testing.

Fixes #2956.

R=rsc
CC=golang-dev
https://golang.org/cl/5657045
2012-02-14 09:13:12 -08:00
Mikio Hara
6fbe80572e net: prefer an IPv4 listen if no address given
This CL avoids net.Listen("tcp", ":80"), http.ListenAdnServe(":80")
prefer an IPv6 listen.

R=rsc
CC=golang-dev
https://golang.org/cl/5669043
2012-02-15 01:59:18 +09:00
Shenghou Ma
60e4d5668e cmd/vet: give warning for construct 'Println(os.Stderr, ...)'
also fixes this bug in net/http/httptest.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5654083
2012-02-14 11:24:41 -05:00
Russ Cox
d599accafa time: use "2006-01-02 15:04:05.999999999 -0700 MST" as String format
This change shows all the information present
in the Time value (now including fractional seconds)
and also arranges the fields so that, within a single time zone,
string comparison and time comparison agree.

R=golang-dev, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5654078
2012-02-14 11:17:48 -05:00
Russ Cox
1707a9977f runtime: on 386, fix FP control word on all threads, not just initial thread
It is possible that Linux and Windows copy the FP control word
from the parent thread when creating a new thread.  Empirically,
Darwin does not.  Reset the FP control world in all cases.

Enable the floating-point strconv test.

Fixes #2917 (again).

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5660047
2012-02-14 01:23:15 -05:00
Andrew Gerrand
e11632ee00 go/doc, godoc: regard lone examples as "whole file" examples
Fixes #2930.

R=r, gri, rsc
CC=golang-dev
https://golang.org/cl/5657048
2012-02-14 17:19:59 +11:00
Russ Cox
1c987a321f 5g: fix memory corruption
R=ken2
CC=golang-dev
https://golang.org/cl/5666043
2012-02-14 01:13:14 -05:00
Brad Fitzpatrick
adb1a6ce3c net/http: more robust test
Fixes #3014

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5665043
2012-02-14 17:11:12 +11:00
Mikio Hara
8c4fecdcb9 net: fix windows build
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5661055
2012-02-14 14:57:57 +09:00
Mikio Hara
7959960148 syscall: regenerate z-files for openbsd
This CL provides regenerated z-files for OpenBSD 5.0 stable.
Also fixes OpenBSD build.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5656052
2012-02-14 14:44:59 +09:00
Russ Cox
5e4e3d8e44 net: avoid Shutdown during Close
Once we've evicted all the blocked I/O, the ref count
should go to zero quickly, so it should be safe to
postpone the close(2) until then.

Fixes #1898.
Fixes #2116.
Fixes #2122.

R=golang-dev, mikioh.mikioh, bradfitz, fullung, iant
CC=golang-dev
https://golang.org/cl/5649076
2012-02-14 00:40:37 -05:00
Ian Lance Taylor
b7360b9b06 net: disable multicast test on Alpha GNU/Linux
Alpha GNU/Linux does not have /proc/net/igmp[6].

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5663047
2012-02-13 21:31:21 -08:00
Russ Cox
82568c5cd5 cmd/dist: exclude cov and prof from releases
Also check for old and exp.

Fixes #2764.
Fixes #2765.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5654068
2012-02-14 00:18:30 -05:00
Daniel Krech
dcf5ca706b cmd/go: go get scheme detection
Fixes #2895.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5651055
2012-02-13 23:46:31 -05:00
Russ Cox
0603b9e446 net: disable TestDialTimeout on Windows
Filed issue 3016 to fix this, but I really want
to see a "ok" in the Windows column so we
know what is and is not working.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5658050
2012-02-13 23:30:40 -05:00
Brad Fitzpatrick
c2a1157680 net/http: re-enable test
Now with a bit more paranoia and lower number of requests
to keep it under the default OS X 256 fd limit.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5659051
2012-02-14 15:26:09 +11:00
Russ Cox
55a54691f9 runtime: use startpanic so that only one thread handles an incoming SIGQUIT
Typing ^\ delivers the SIGQUIT to all threads, it appears.

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5657044
2012-02-13 23:06:21 -05:00
Russ Cox
0995aba983 runtime/debug: fix build
TBR=r
CC=golang-dev
https://golang.org/cl/5661053
2012-02-13 23:05:19 -05:00
Brad Fitzpatrick
913abfee3b net/http: don't spin on temporary accept failure
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5658049
2012-02-14 15:04:29 +11:00
Russ Cox
11f6f7afd6 build: fix windows build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5656051
2012-02-13 22:56:42 -05:00
Rob Pike
bf2838334c testing: let runtime catch the panic.
It's not as pretty, but it deletes some irrelevant information from the
printout and avoids a dependency.
It also means the test binary will stop if a test panics. That's a feature,
not a bug.
Any output printed by the test appears before the panic traceback.

before:

--- FAIL: TestPanic (0.00 seconds)
        fmt_test.go:19: HI
        testing.go:257: runtime error: index out of range
                /Users/r/go/src/pkg/testing/testing.go:257 (0x23998)
                        _func_003: t.Logf("%s\n%s", err, debug.Stack())
                /Users/r/go/src/pkg/runtime/proc.c:1388 (0x10d2d)
                        panic: reflect·call(d->fn, d->args, d->siz);
                /Users/r/go/src/pkg/runtime/runtime.c:128 (0x119b0)
                        panicstring: runtime·panic(err);
                /Users/r/go/src/pkg/runtime/runtime.c:85 (0x11857)
                        panicindex: runtime·panicstring("index out of range");
                /Users/r/go/src/pkg/fmt/fmt_test.go:21 (0x23d72)
                        TestPanic: a[10]=1
                /Users/r/go/src/pkg/testing/testing.go:264 (0x21b75)
                        tRunner: test.F(t)
                /Users/r/go/src/pkg/runtime/proc.c:258 (0xee9e)
                        goexit: runtime·goexit(void)
FAIL

after:

--- FAIL: TestPanic (0.00 seconds)
        fmt_test.go:19: HI
panic: runtime error: index out of range [recovered]
        panic: (*testing.T) (0xec3b0,0xf8400001c0)

goroutine 2 [running]:
testing._func_003(0x21f5fa8, 0x21f5100, 0x21f5fb8, 0x21f5e88)
        /Users/r/go/src/pkg/testing/testing.go:259 +0x108
----- stack segment boundary -----
fmt_test.TestPanic(0xf8400001c0, 0x27603728)
        /Users/r/go/src/pkg/fmt/fmt_test.go:21 +0x6b
testing.tRunner(0xf8400001c0, 0x18edb8, 0x0, 0x0)
        /Users/r/go/src/pkg/testing/testing.go:264 +0x6f
created by testing.RunTests
        /Users/r/go/src/pkg/testing/testing.go:343 +0x76e

goroutine 1 [chan receive]:
testing.RunTests(0x2000, 0x18edb8, 0x2400000024, 0x100000001, 0x200000001, ...)
        /Users/r/go/src/pkg/testing/testing.go:344 +0x791
testing.Main(0x2000, 0x18edb8, 0x2400000024, 0x188a58, 0x800000008, ...)
        /Users/r/go/src/pkg/testing/testing.go:275 +0x62
main.main()
        /var/folders/++/+++Fn+++6+0++4RjPqRgNE++2Qk/-Tmp-/go-build743922747/fmt/_test/_testmain.go:129 +0x91
exit status 2

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5658048
2012-02-14 14:53:30 +11:00
Andrew Gerrand
5ab935f68a godoc: list examples in index
Fixes #2897.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5658047
2012-02-14 14:52:00 +11:00
Robert Griesemer
e3f11b3f3c go/parser: better error messages for missing commas
Fixes #3008.

R=rsc
CC=golang-dev
https://golang.org/cl/5660046
2012-02-13 19:48:27 -08:00
Russ Cox
982e6c44a0 build: set $PATH during make.bash
Should fix build breakage.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5656050
2012-02-13 22:46:50 -05:00
Russ Cox
7b848c6964 cmd/dist: cross-compiling fixes
This CL makes it possible to run make.bash with
GOOS and GOARCH set to something other than
the native host GOOS and GOARCH.

As part of the CL, the tool directory moves from bin/tool/
to pkg/tool/goos_goarch where goos and goarch are
the values for the host system (running the build), not
the target.  pkg/ is not technically appropriate, but C objects
are there now tool (pkg/obj/) so this puts all the generated
binaries in one place (rm -rf $GOROOT/pkg cleans everything).
Including goos_goarch in the name allows different systems
to share a single $GOROOT on a shared file system.

Fixes #2920.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5645093
2012-02-13 22:31:51 -05:00
Russ Cox
569ef7d49e net/http: disable buggy test
Generates an infinite stream (at least >1GB) of:

=== RUN TestTransportPersistConnLeak
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files
2012/02/13 22:20:19 http: Accept error: accept tcp 127.0.0.1:63972:
too many open files

R=bradfitz
CC=golang-dev
https://golang.org/cl/5661052
2012-02-13 22:23:04 -05:00
Alex Brainman
07a2989d17 runtime, syscall, os/signal: fix windows build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656048
2012-02-14 13:51:38 +11:00
Mikio Hara
adc1e0bcef syscall: update BSD variants to sync with new os/signal
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5661051
2012-02-14 11:20:39 +09:00
Brad Fitzpatrick
d0a7d01ff2 net/http: fix client goroutine leak with persistent connections
Thanks to Sascha Matzke & Florian Weimer for diagnosing.

R=golang-dev, adg, bradfitz, kevlar
CC=golang-dev
https://golang.org/cl/5656046
2012-02-14 12:48:56 +11:00
Brad Fitzpatrick
9df6fdcc1c mime: unexport some internal details
Fixes #2941

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5663046
2012-02-14 12:48:28 +11:00
Nigel Tao
e8d30eb404 cmd/api: fix typo.
R=gri, r
CC=golang-dev
https://golang.org/cl/5659048
2012-02-14 12:37:57 +11:00
Shenghou Ma
31ab16f98e fix build for Linux/ARM.
1, IMO, the fatal error "regfree: not a register" from 5g when
         compiling runtime/debug.go is due to gcc miscompile, it doesn't
         show up when compiled with -O0. But I still haven't thought of
         a way to fix this, should all ARM builds be built with -O0?
        2, fixed mksysnum_linux.pl, so zsysnum_linux_arm.go no longer
        needs to be hand-generated.
        3, regen all in pkg syscall for Linux/ARM on Debian 6.0
This CL is somewhat big, I'd like to split it if necessary.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5659044
2012-02-13 20:16:57 -05:00
Andrew Gerrand
04868b28ac archive/zip: hide Write method from *Writer type
This was an implementation detail that snuck into the public interface.
*Writer.Create gives you an io.Writer, the *Writer itself was never
meant to be written to.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5654076
2012-02-14 10:47:48 +11:00
Andrew Gerrand
2d53d227f6 runtime, syscall: fix freebsd-386 build
R=rsc
CC=golang-dev
https://golang.org/cl/5659045
2012-02-14 10:04:59 +11:00
Brad Fitzpatrick
b8df36182d net/http: add a Linux-only sendfile test
I remembered that sendfile support was lacking a test.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5652079
2012-02-14 09:34:52 +11:00
Andrew Gerrand
7c2607a91d runtime, syscall: fix freebsd build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5661047
2012-02-14 09:29:51 +11:00
Russ Cox
422826270d cmd/cgo: omit //line in -godefs, -cdefs output
Makes files like src/pkg/syscall/ztypes_linux_amd64.go easier to read.
(The copy that is checked in predates the //line output mode,
so this also preserves the status quo.)

R=golang-dev, iant, gri
CC=golang-dev
https://golang.org/cl/5655068
2012-02-13 16:02:13 -05:00
Russ Cox
d3f9f21fdf fix: add fix for crypto type change
Fixes #2905.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5645088
2012-02-13 16:01:34 -05:00
Russ Cox
1f2445d27b gc: delete old unsafe functions
Also update build to be able to run mkbuiltin again.
The export form has changed a little, so builtin.c has
more diffs than unsafe.go.

In CL 5650069, I just edited the documentation, a rarely
successful method of change.

R=ken2
CC=golang-dev
https://golang.org/cl/5662043
2012-02-13 15:37:35 -05:00
Robert Griesemer
0a2ffb2638 go/doc: don't lose exported consts/vars with unexported type
Fixes #2998.

R=rsc
CC=golang-dev
https://golang.org/cl/5650078
2012-02-13 12:24:02 -08:00
Rob Pike
47424d90ec text/template: drop reference to os.EPERM in the test
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5654077
2012-02-14 07:11:39 +11:00
Robert Griesemer
28ffb38f4a go/printer, gofmt: don't indent line directives
This was broken by https://golang.org/cl/5643066
which introduced lazy indentation printing.

Fixes #2990.

R=rsc
CC=golang-dev
https://golang.org/cl/5655067
2012-02-13 11:50:53 -08:00
Shenghou Ma
c11361e253 exp/norm: fix typo
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5649086
2012-02-13 11:50:06 -08:00
Shenghou Ma
9a4487458a all: update 'gotest' to 'go test'
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5645099
2012-02-13 13:58:17 -05:00
Darren Elwood
aaac05ae23 8a, 8l: add LFENCE, MFENCE, SFENCE
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5650076
2012-02-13 13:58:12 -05:00
Russ Cox
35586f718c os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only.  Also, signals
go to everyone who asks, not just one client.

This could plausibly move into package os now
that there are no magic side effects as a result
of the import.

Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)

Tested on darwin,linux 386,amd64.

Fixes #1266.

R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 13:52:37 -05:00
Adam Langley
cdd7e02583 crypto/...: more fixes for bug 2841
1) Remove the Reset() member in crypto/aes and crypto/des (and
   document the change).
2) Turn several empty error structures into vars. Any remaining error
   structures are either non-empty, or will probably become so in the
   future.
3) Implement SetWriteDeadline for TLS sockets. At the moment, the TLS
   status cannot be reused after a Write error, which is probably fine
   for most uses.
4) Make crypto/aes and crypto/des return a cipher.Block.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5625045
2012-02-13 12:38:45 -05:00
Marcel van Lohuizen
a52fb458df exp/norm: merged charinfo and decomposition tables. As a result only
one trie lookup per rune is needed. See forminfo.go for a description
of the new format.  Also included leading and trailing canonical
combining class in decomposition information.  This will often avoid
additional trie lookups.

R=r, r
CC=golang-dev
https://golang.org/cl/5616071
2012-02-13 14:54:46 +01:00
Andrew Gerrand
d84de09e1d godoc: new design
This is not the finished product,
but a good checkpoint from which to
proceed with further development.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5571061
2012-02-13 21:22:36 +11:00
Anthony Martin
dbec42104f gc, 8g, 8l: fix a handful of warnings
8g/cgen.c
        print format type mismatch

8l/asm.c
        resoff set and not used

gc/pgen.c
        misleading comparison INT > 0x80000000

gc/reflect.c
        dalgsym must be static to match forward declaration

gc/subr.c
        assumed_equal set and not used
        hashmem's second argument is not used

gc/walk.c
        duplicated (unreachable) code

R=rsc
CC=golang-dev
https://golang.org/cl/5651079
2012-02-12 23:07:31 -08:00
Ian Lance Taylor
c53b73455b sync/atomic: disable hammer pointer tests on wrong size system
hammerCompareAndSwapPointer64 was only passing on
little-endian systems.  hammerCompareAndSwapPointer32 was
writing 8 bytes to a uint32 value on the heap.

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5654065
2012-02-12 21:53:33 -08:00
Russ Cox
b440a65033 strconv: disable issue 2917 test
It did in fact break on the darwin/386 builder.
Will investigate later; reopened issue 2917.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5654070
2012-02-13 00:19:18 -05:00
Russ Cox
65ba8ee07e syscall: make linux Dup2 match other systems
You could argue for changing all the others, but
Linux is outvoted, and the only time it matters
is when newfd==-1, in which case you can call Dup.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650073
2012-02-13 00:11:36 -05:00
Russ Cox
878153682e cmd/fix: warn about exp, old, deleted packages
Fixes #2776.

There was a previous attempt at CL 5592043 but that
seems to have stalled.  This one is simpler, and more up to date
(correct handling of spdy, for example).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5645091
2012-02-12 23:55:33 -05:00
Hong Ruiqi
c58b6ad022 net/http: use mtime < t+1s to check for unmodified
The Date-Modified header truncates sub-second precision, so
use mtime < t+1s instead of mtime <= t to check for unmodified.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5655052
2012-02-12 23:45:19 -05:00
Russ Cox
8bcfad269e testing: use runtime/debug to format panics
Sorry, Mercurial failed me.

TBR=r, dsymonds
CC=golang-dev
https://golang.org/cl/5649080
2012-02-12 23:41:07 -05:00
Russ Cox
f735d2d9d3 testing: use runtime/debug to format panics
Among other things, this avoids putting a testing.go:nnn:
prefix on every line of the stack trace.

R=golang-dev, r, dsymonds, r
CC=golang-dev
https://golang.org/cl/5651081
2012-02-12 23:39:40 -05:00
Russ Cox
6a75ece01c runtime: delete Type and implementations (use reflect instead)
unsafe: delete Typeof, Reflect, Unreflect, New, NewArray

Part of issue 2955 and issue 2968.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650069
2012-02-12 23:26:20 -05:00
Russ Cox
cbe7d8db24 net: avoid TCP self-connect
Fixes #2690.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5650071
2012-02-12 23:25:55 -05:00
Russ Cox
f7a3683928 strconv: add tests for issue 2917
Cannot reproduce the failure locally,
but add explicit test in case some other
machine can.

Fixes #2917 (for now).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5651071
2012-02-12 23:24:54 -05:00
Rob Pike
daa7bd8ec6 net/http/pprof: link to blog post
Fixes #2943.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5649079
2012-02-13 15:24:06 +11:00
Russ Cox
fb2caa3244 net/http: fix http_proxy parsing
Fixes #2919.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5645089
2012-02-12 23:19:50 -05:00
Russ Cox
d318ab2264 cmd/go: respect test -timeout flag
I thought that -timeout was per-test, but it is for the
whole program execution, so cmd/go can adjust its timer
(also for whole program execution) accordingly.

Fixes #2993.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650070
2012-02-12 23:19:24 -05:00
Russ Cox
aa87d78cf6 cmd/dist: encoding/gob is no longer required for cmd/go
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5650068
2012-02-12 23:15:07 -05:00
Russ Cox
d9da346078 net/http: document use of DetectContentType
Fixes #2365.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5653070
2012-02-12 23:14:48 -05:00
Russ Cox
b5d81e5ed5 build: reject make.bash on Windows
Also, echo cmd/dist during bootstrap build
Makes that phase look like all the others.

Fixes #2908.

R=golang-dev, alex.brainman, bradfitz
CC=golang-dev
https://golang.org/cl/5655065
2012-02-12 23:14:37 -05:00
Mikio Hara
6fa2296e83 net: disable wild use of SO_REUSEPORT on BSD variants
Fixes #2830 (again).

R=rsc
CC=golang-dev
https://golang.org/cl/5651083
2012-02-13 12:45:59 +09:00
Gustavo Niemeyer
62fe6914cb os: clarify docs for link functions
R=golang-dev, bsiegert, r
CC=golang-dev
https://golang.org/cl/5643068
2012-02-13 01:21:39 -02:00
Brad Fitzpatrick
71c8b82dd1 strings: more examples
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5645092
2012-02-13 14:05:57 +11:00
Yves Junqueira
7531e8cb39 pprof: fix import path in the documentation
R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5649072
2012-02-12 12:38:51 -02:00
Mikio Hara
9387d11aa6 net: fix windows build
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5653066
2012-02-12 15:59:21 +09:00
Anthony Martin
8bd0109dd0 build: get rid of deps.bash
It doesn't work anymore and it's not used.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5652073
2012-02-11 20:02:50 -08:00
Bjorn Tipling
5b663057b7 html/template: Added more explicit wording about examples and documentation.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5654062
2012-02-12 12:18:00 +11:00
Rob Pike
d26c607fe6 unsafe: Alignof and Offsetof now use the same style
The easy part of issue 2968.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5655059
2012-02-12 09:10:47 +11:00
Russ Cox
7dd90621f8 gc: diagnose field+method of same name
Fixes #2828.

R=ken2
CC=golang-dev
https://golang.org/cl/5653065
2012-02-11 01:21:12 -05:00
Russ Cox
2aafad25b4 gc: print detail for typechecking loop error
R=ken2
CC=golang-dev
https://golang.org/cl/5654060
2012-02-11 01:04:33 -05:00
Russ Cox
2f3d695a61 gc: fix bug introduced earlier
Apparently l and $1 were the same register on Linux.
On the other systems, the compiler caught it.

R=ken2
CC=golang-dev
https://golang.org/cl/5654061
2012-02-11 01:04:24 -05:00
Russ Cox
337547d1c9 gc: make constant arith errors a little more friendly
Fixes #2804.

R=ken2
CC=golang-dev
https://golang.org/cl/5652067
2012-02-11 00:50:56 -05:00
Robert Griesemer
2233942e3c gofmt: fix error message in test
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5652066
2012-02-10 21:47:18 -08:00
Russ Cox
77aaa3555d gc: fix import of struct type in struct literal
Fixes #2716.

R=ken2
CC=golang-dev
https://golang.org/cl/5652065
2012-02-11 00:34:01 -05:00
Ian Lance Taylor
53e139c7a0 runtime: put lockorder before pollorder in Select memory block.
Otherwise lockorder may be misaligned, since lockorder is a
list of pointers and pollorder is a list of uint16.
Discovered running gccgo (which uses a modified copy of this
code) on SPARC.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5655054
2012-02-10 21:24:14 -08:00
Russ Cox
f91cc3bdbb gc: optimize interface ==, !=
If the values being compared have different concrete types,
then they're clearly unequal without needing to invoke the
actual interface compare routine.  This speeds tests for
specific values, like if err == io.EOF, by about 3x.

benchmark                  old ns/op    new ns/op    delta
BenchmarkIfaceCmp100             843          287  -65.95%
BenchmarkIfaceCmpNil100          184          182   -1.09%

Fixes #2591.

R=ken2
CC=golang-dev
https://golang.org/cl/5651073
2012-02-11 00:19:24 -05:00
Russ Cox
a7b83f2287 5g: fix out of registers bug
Same fix as 6g, tripped by the 6g test case.

R=ken2
CC=golang-dev
https://golang.org/cl/5651074
2012-02-11 00:04:37 -05:00
Mikio Hara
f842dc160b cmd/dist: clear execute bit from source file
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5651072
2012-02-11 13:23:44 +09:00
Russ Cox
896f0c61c8 gc: diagnose init loop involving func
Fixes #2295.

R=ken2
CC=golang-dev
https://golang.org/cl/5655057
2012-02-10 23:10:45 -05:00
Russ Cox
7ae1fe420e gc: eliminate duplicate ambiguous selector message
Also show actual expression in message when possible.

Fixes #2599.

R=ken2
CC=golang-dev
https://golang.org/cl/5654059
2012-02-10 22:46:56 -05:00
Russ Cox
5340510203 8g: fix opt bug
Was trying to optimize a duplicate float64 move
by registerizing an int64.

Fixes #2588.

R=ken2
CC=golang-dev
https://golang.org/cl/5645086
2012-02-10 22:32:02 -05:00
Rob Pike
b027a0f118 text/template/parse: deep Copy method for nodes
This will help html/template copy templates.

R=golang-dev, gri, nigeltao, r
CC=golang-dev
https://golang.org/cl/5653062
2012-02-11 14:21:16 +11:00
Russ Cox
ca5da31f83 6g: fix out of registers bug
Fix it twice: reuse registers more aggressively in cgen abop,
and also release R14 and R15, which are no longer m and g.

Fixes #2669.

R=ken2
CC=golang-dev
https://golang.org/cl/5655056
2012-02-10 22:19:34 -05:00
Mikio Hara
76a1cb5a00 net: fix comment, make use of listenerBacklog
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5653056
2012-02-11 11:51:12 +09:00
Mikio Hara
0e3514eaac net: enable SO_REUSEADDR, SO_REUSEPORT options on stream, multicast listeners only
This CL changes default SOL_SOCKET settings to mitigate connect
failure on OpenBSD or similar platforms which support randomized
transport protocol port number assignment.

Fixes #2830.

R=rsc, jsing
CC=golang-dev
https://golang.org/cl/5648044
2012-02-11 11:50:51 +09:00
Robert Griesemer
21a3aceb4a fix build: update image/png test
R=nigeltao
CC=golang-dev
https://golang.org/cl/5649062
2012-02-10 17:26:40 -08:00
Nigel Tao
22636be8b0 flate: delete WrongValueError type.
Fixes #2838.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5651060
2012-02-11 12:09:11 +11:00
Bjorn Tipling
0846e275a8 net/http: fix reference to URL.RawPath in docs
R=go.peter.90, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5655053
2012-02-10 22:39:57 -02:00
Gustavo Niemeyer
dbac863ed8 cmd/dist: reset version during bootstrap
Fixes #2927.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5651062
2012-02-10 22:26:36 -02:00
Nigel Tao
18f518362b compress: add comments to gzip and zlib.
Fixes #2939.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5655050
2012-02-11 09:42:07 +11:00
Luuk van Dijk
e0b2ce3401 cmd/gc: suspend safemode during typecheck of inlined bodies.
Should be obviously correct.  Includes minimal test case.
A future CL should clear up the logic around typecheckok and importpkg != nil someday.

R=rsc, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5652057
2012-02-10 22:50:55 +01:00
Brad Fitzpatrick
fbab6d8512 os,syscall: fix windows build
make syscall.ProcAttr.Files be []uintptr

all.bash passes on Linux.
things seem to compile on GOOS={darwin,windows}

R=golang-dev, mattn.jp, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5653055
2012-02-11 08:47:19 +11:00
James Whitehead
09f6a49194 exp/types: Use build.FindTree in GcImporter
Fixes #2932

R=gri
CC=golang-dev
https://golang.org/cl/5654046
2012-02-10 13:35:03 -08:00
Robert Griesemer
a0acdd210b go/printer: test that formatted code is parseable
- Added test case for issue 1542.

Fixes #1542.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5645080
2012-02-10 13:28:29 -08:00
Robert Griesemer
f8cf82f6f2 go/printer: implement SourcePos mode
If a printer is configured with the SourcePos mode
set, it will emit //-line comments as necessary to
ensure that the result - if reparsed - reflects the
original source position information.

This change required a bit of reworking of the
output section in printer.go. Specifically:

- Introduced new Config mode 'SourcePos'.

- Introduced new position 'out' which tracks the
position of the generated output if it were read
in again. If there is a discrepancy between out
and the current AST/source position, a //line
comment is emitted to correct for it.

- Lazy emission of indentation so that //line
comments can be placed correctly. As a result,
the trimmer will have to do less work.

- Merged writeItem into writeString.

- Merged writeByteN into writeByte.

- Use a []byte instead of a byte.Buffer both in the
printer and in the trimmer (eliminates dependency).

Also: introduced explicit printer.Mode type (in
sync w/ parser.Mode, scanner.Mode, etc.)

Runs all tests. Applied gofmt to src, misc w/o changes.

Fixes #1047.
Fixes #2697.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5643066
2012-02-10 13:27:32 -08:00
Nigel Tao
cc9ed447d0 compress: make flate, gzip and zlib's NewWriterXxx functions all return
(*Writer, error) if they take a compression level, and *Writer otherwise.
Rename gzip's Compressor and Decompressor to Writer and Reader, similar to
flate and zlib.

Clarify commentary when writing gzip metadata that is not representable
as Latin-1, and fix io.EOF comment bug.

Also refactor gzip_test to be more straightforward.

Fixes #2839.

R=rsc, r, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5639057
2012-02-10 18:49:19 +11:00
Russ Cox
0bc6836e81 builder: set $GOBUILDEXIT for Windows
Actually %GOBUILDEXIT% I suppose.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5651058
2012-02-10 01:27:59 -05:00
Russ Cox
ce63ec93ce regexp/syntax: delete old package comment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5651057
2012-02-10 01:11:56 -05:00
Alex Brainman
62b328ed19 all.bat: report error code back to the gobuilder
not sure that it will work, but.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5649051
2012-02-10 16:29:50 +11:00
Andrew Gerrand
08e11187e6 debug/macho: dropped monstrous URL from package comment
Relax. It's still in macho.go.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5653054
2012-02-10 16:03:24 +11:00
Rob Pike
1ceb561629 regexp/syntax: add package and Parse commentary
Fixes #2954.

R=golang-dev, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/5645077
2012-02-10 15:57:12 +11:00
Rob Pike
13443ccc2a math: fix gamma doc, link to OEIS
Fixes #2940.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5645078
2012-02-10 15:56:51 +11:00
Daniel Theophanes
ef1d2a32ea dist: prevent recusive loop on windows when fatal() is called.
Fixes #2931.

R=golang-dev, alex.brainman
CC=golang-dev, rsc
https://golang.org/cl/5651049
2012-02-09 23:10:27 -05:00
Rob Pike
9bcfc57660 reflect: documentation tweaks
Fixes #2952.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5651054
2012-02-10 15:09:09 +11:00
Brad Fitzpatrick
5d198bf866 os/exec: add Cmd.Waitmsg, fix a misleading comment
Fixes #2948

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5655048
2012-02-10 14:52:08 +11:00
Rob Pike
4c7695126d strings: delete method comments implied by interface satisfaction
Fixes #2957.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5653053
2012-02-10 14:45:11 +11:00
Rob Pike
3f1cff3951 testing/quick: documentation tweaks
Fixes #2960.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5652055
2012-02-10 14:37:50 +11:00
Rob Pike
1308f7c94f testing/iotest: adjust adverbial imprecision in package comment
Fixes #2959.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5651053
2012-02-10 14:37:20 +11:00
Rob Pike
cbd6c34131 testing/script: delete
Dead code.

Fixes #2961.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5650053
2012-02-10 14:31:08 +11:00
Rob Pike
989e611a7b unicode: various documentation tweaks
The comment on IsOneOf regarding Latin-1 was an implementation detail:
when the function is called internally, that condition is true. It used to matter,
but now the comment is a dreg. The function works fine if the character is
Latin-1, so we just delete the comment.

Fixes #2966.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5655047
2012-02-10 14:30:44 +11:00
Rob Pike
0357af80b4 template: refer HTML users to html/template
Fixes #2963.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5650051
2012-02-10 14:21:36 +11:00
Brad Fitzpatrick
4152b43457 os: delete Exec, NewFile takes uintptr, rename ShellExpand, doc fixes
Delete O_NDELAY, O_NONBLOCK, O_NOCTTY, O_ASYNC.

Clean up some docs.

Rename ShellExpand -> ExpandEnv.

Make NewFile take a uintptr; change File.Fd to return one.
(for API compatibility between Unix and Windows)

Fixes #2947

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5655045
2012-02-10 14:16:15 +11:00
Rob Pike
6c0aa2f296 unicode/utf8: document return value for decode errors
Also replace archaic definition of rune.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5654048
2012-02-10 14:12:17 +11:00
Rob Pike
1bfffb67d8 time: improve commentary about standard time and formatting/parsing
Fixes #2965.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5652054
2012-02-10 13:52:19 +11:00
Rob Pike
7ef97def80 testing: fix references to "gotest"
Fixes #2958.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5650050
2012-02-10 13:49:50 +11:00
Alex Brainman
9a469e6ab5 make.bat: remove double quotes
Fixes #2974.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5653052
2012-02-10 11:48:22 +11:00
Brad Fitzpatrick
7750fc894a os: remove Time; callers should use time.Time.
Part of issue 2947

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5651051
2012-02-10 11:44:51 +11:00
Brad Fitzpatrick
0a398c4057 net/http/fcgi: don't mention threads in docs
Fixes #2942

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5650049
2012-02-10 10:29:57 +11:00
Robert Griesemer
88a9e76e28 text/scanner: update comments
Fixes #2962.

R=rsc
CC=golang-dev
https://golang.org/cl/5652048
2012-02-09 15:26:08 -08:00
Brad Fitzpatrick
9cd4a0467a regexp: name result parameters referenced from docs
Fixes #2953

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5653051
2012-02-10 10:22:01 +11:00
Brad Fitzpatrick
6bdd791dec database/sql: remove Into from ScannerInto/ScanInto
Also fix a doc error.

Fixes #2843

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5653050
2012-02-10 10:20:49 +11:00
Rob Pike
44fa114dc6 container/heap: add example
godoc doesn't have the fu to present the example well, but this gives
us an example of an example to develop example fu.

Fixes #2840.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5645063
2012-02-10 10:07:55 +11:00
Brad Fitzpatrick
c15a42ed76 cmd/api: follow constant references
For gccgo. Also removes bunch of special cases.

Fixes #2906

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/5644050
2012-02-10 10:05:26 +11:00
Brad Fitzpatrick
4539d1f307 net/http: add ServeContent
Fixes #2039

R=r, rsc, n13m3y3r, r, rogpeppe
CC=golang-dev
https://golang.org/cl/5643067
2012-02-10 10:02:06 +11:00
Rob Pike
59dc21584a encoding/binary: another attempt to describe the type of Read and Write's data
R=golang-dev, rsc, gri, r
CC=golang-dev
https://golang.org/cl/5641062
2012-02-10 09:55:48 +11:00
Gustavo Niemeyer
54f1e1b163 cmd/dist: fix GOROOT_FINAL
R=rsc, gustavo
CC=golang-dev
https://golang.org/cl/5642045
2012-02-09 20:47:12 -02:00
Rob Pike
eb02b9cf9c encoding/hex: vet the test prints
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5642075
2012-02-10 09:44:56 +11:00
Alex Brainman
309863aec4 compress/gzip: remove dead code
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5645074
2012-02-10 09:33:51 +11:00
Andrew Balholm
aca4a6c933 database/sql: support ErrSkip in Tx.Exec
If the database driver supports the Execer interface but returns
ErrSkip, calling Exec on a transaction was returning the error instead
of using the slow path.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5654044
2012-02-10 09:19:22 +11:00
Alex Brainman
eaf640dbc4 cmd/dist: do not use HEAP_GENERATE_EXCEPTIONS flag
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5650048
2012-02-10 09:14:00 +11:00
Brad Fitzpatrick
00651a2e63 database/sql: rename ErrTransactionFinished to ErrTxDone
Part of issue 2843

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5646063
2012-02-10 09:12:32 +11:00
Shenghou Ma
bb40196ebf runtime: Linux/ARM: exit early on OABI systems, and give an error message
Fixes #2533.

R=rsc
CC=golang-dev
https://golang.org/cl/5654045
2012-02-09 16:18:21 -05:00
Brad Fitzpatrick
396170da9b strings: add Seek method to Reader
strings.Reader is already stateful and read-only.

This permits a *Reader with http.ServeContent.

R=golang-dev, r, rsc, rsc
CC=golang-dev
https://golang.org/cl/5639068
2012-02-09 17:28:41 +11:00
Rob Pike
be0f6febad os: talk about errors and PathError in the package documentation
Fixes #2383.

R=golang-dev, bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5641061
2012-02-09 16:55:36 +11:00
Russ Cox
1253c75cf5 runtime: fix compiler warnings
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5642068
2012-02-09 16:48:52 +11:00
Brad Fitzpatrick
ce57ba9fee net/http/httptest: add a test
Less ironic. Don't you think?

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5643069
2012-02-09 16:45:24 +11:00
Russ Cox
5c52404aca gc: implicit type bug fix in export data
TBR=lvd
CC=golang-dev
https://golang.org/cl/5644064
2012-02-09 00:26:08 -05:00
Brad Fitzpatrick
29df93735c database/sql: more tests
Higher level tests for the pointer parameters
and scanning, complementing the existing ones
included in the previous CL.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5646050
2012-02-09 15:01:29 +11:00
Rob Pike
1c1ecd7473 log/syslog: fix documentation for NewLogger
Fixes #2798.

R=golang-dev, bradfitz, r, rsc, rsc
CC=golang-dev
https://golang.org/cl/5642071
2012-02-09 14:40:56 +11:00
Rob Pike
c0e74b63cf fmt: scan FALSE correctly
Fixes bug 2922.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642072
2012-02-09 14:12:55 +11:00
Rob Pike
00d0f8e320 cmd/go: rearrange help for 'go test'
Put the 'go test' flags into 'go help test', so 'go help testflags'
is about the flags for the compiled test binary.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5641060
2012-02-09 14:12:18 +11:00
Brad Fitzpatrick
3484d5462d net/http: remove an errant space
Made the godoc overview section oddly indented
compared to the other code blocks.

R=golang-dev, mikioh.mikioh, dsymonds, r
CC=golang-dev
https://golang.org/cl/5645060
2012-02-09 14:10:36 +11:00
Gary Burd
e7bd71c83a go/doc: Handle recursive embedded types.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5645053
2012-02-08 16:54:48 -08:00
Rob Pike
025c9a946d encoding/binary: slices are allowed; say so
Fixes #2629.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642069
2012-02-09 11:42:10 +11:00
Rob Pike
8c4a2ca83b encoding/binary: add Size, to replace the functionality of the old TotalSize
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5644063
2012-02-09 11:26:03 +11:00
Mikio Hara
d082e5976e text/template/parse: fix comment
R=r, rsc
CC=golang-dev
https://golang.org/cl/5644055
2012-02-09 07:47:48 +09:00
Shenghou Ma
073aeff785 runtime: fix "SysReserve returned unaligned address" bug on 32-bit systems
R=rsc
CC=golang-dev
https://golang.org/cl/5642064
2012-02-09 09:25:10 +11:00
Rob Pike
c59dc485cd bytes.Buffer: return error in WriteTo if buffer is not drained
R=rsc
CC=golang-dev
https://golang.org/cl/5642065
2012-02-09 08:58:40 +11:00
Rob Pike
3fce00d99e log/syslog: return length of data provided by the user, not length of header
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5644059
2012-02-09 08:36:13 +11:00
Shenghou Ma
119917375b cmd/dist: redure max background tasks nr. when building on ARM
R=rsc
CC=golang-dev
https://golang.org/cl/5642063
2012-02-08 16:26:00 -05:00
Russ Cox
56ade2d8d5 cmd/go: let go tool invocation use stdin
Fixes #2921.

R=golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5647057
2012-02-08 16:14:24 -05:00
Russ Cox
596840a905 cmd/dist: make 'make' quieter for developers
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5646055
2012-02-08 15:26:47 -05:00
Robert Griesemer
d08dd8bec1 go/scanner: clean up error interface
Issue 2856 asks for a rename of a few methods to a
more idiomatic Go style. This is a very early API
that evolved organically throughout the years.
Together with the fact that ErrorVectors were embedded
in other data structures (e.g. Parser), just renaming
methods (e.g. GetError -> Error) would lead to undesired
behavior (e.g., Parser would act like an Error). Instead,
cleaned up API a bit more:

- removed ErrorVector in favor of ErrorList (already
present)
- simplified Scanner.Init by making the error handler a
function instead of requiring an ErrorHandler implementation
- adjusted helper functions accordingly
- updated Go 1 doc

Fixes #2856.

R=rsc
CC=golang-dev
https://golang.org/cl/5624047
2012-02-08 11:41:32 -08:00
Paul Borman
d37a8b73c5 runtime: drop to 32 bit malloc if 64 bit will not work
On 64 bit UML it is not possible to reserve memory at 0xF8<<32.
Detect when linux cannot use these high virtual memory addresses
and drop back to the 32 bit memory allocator.

R=rsc, cw
CC=golang-dev
https://golang.org/cl/5634050
2012-02-08 14:39:16 -05:00
Shenghou Ma
1127b22976 cmd/dist: pass correct -DGOARCH_$GOARCH flag to gcc.
R=rsc
CC=golang-dev
https://golang.org/cl/5643061
2012-02-08 14:36:38 -05:00
Russ Cox
d0dc68901a net/http: panic on duplicate registrations
Otherwise, the registration semantics are
init-order-dependent, which I was trying very hard
to avoid in the API.  This may break broken programs.

Fixes #2900.

R=golang-dev, r, bradfitz, dsymonds, balasanjay, kevlar
CC=golang-dev
https://golang.org/cl/5644051
2012-02-08 13:50:00 -05:00
Russ Cox
49110eaa22 encoding/json: document buffering
Fixes #1955.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5643058
2012-02-08 13:48:03 -05:00
Robert Griesemer
467f8751f9 gofmt: replace defunct test.sh with a go test
R=r, rsc
CC=golang-dev
https://golang.org/cl/5639053
2012-02-08 08:47:02 -08:00
Dmitriy Vyukov
bd37349485 cmd/dist: fix copying of cmd/prof
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5642059
2012-02-08 20:15:17 +04:00
Russ Cox
136f12f51f cmd/dist: pass -m32 or -m64 to link too, not just compile
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5646053
2012-02-08 11:12:14 -05:00
Russ Cox
5b93fc9da6 runtime, pprof: add profiling of thread creation
Same idea as heap profile: how did each thread get created?
Low memory (256 bytes per OS thread), high reward for
programs that suddenly have many threads running.

Fixes #1477.

R=golang-dev, r, dvyukov
CC=golang-dev
https://golang.org/cl/5639059
2012-02-08 10:33:54 -05:00
Jamie Gennis
fff732ea2c 6g,8g: make constant propagation inlining-friendly.
This changes makes constant propagation compare 'from' values using node
pointers rather than symbol names when checking to see whether a set
operation is redundant. When a function is inlined multiple times in a
calling function its arguments will share symbol names even though the values
are different. Prior to this fix the bug409 test would hit a case with 6g
where an LEAQ instruction was incorrectly eliminated from the second inlined
function call. 8g appears to have had the same bug, but the test did not fail
there.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5646044
2012-02-08 10:25:13 -05:00
Russ Cox
5957f914e2 regexp: fix typo
Fixes #2918.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5639062
2012-02-08 08:59:59 -05:00
Andrew Pritchard
cc39bb9068 database/sql: treat pointers as nullable types like encoding/json
- convert from nil pointers to the nil interface{}
- dereference non-nil pointers
- convert from nil interface{}s to nil pointers
- allocate pointers for non-nil interface{}s
- tests for all of the above

R=golang-dev, bradfitz, rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5630052
2012-02-08 17:14:15 +11:00
Brad Fitzpatrick
878608bd29 cmd/go: connect os.Stdin for go run
Fixes #2875

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5641052
2012-02-08 16:30:28 +11:00
Russ Cox
3f6a517db6 cmd/dist: respect $CC, as quietgcc.bash used to
R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5641051
2012-02-08 00:22:38 -05:00
Russ Cox
7201ba2171 regexp: allow substitutions in Replace, ReplaceString
Add Expand, ExpandString for access to the substitution functionality.

Fixes #2736.

R=r, bradfitz, r, rogpeppe, n13m3y3r
CC=golang-dev
https://golang.org/cl/5638046
2012-02-07 23:46:47 -05:00
Russ Cox
1d8250c8b0 time: clean up MarshalJSON, add RFC3339 method
encoding/xml: handle time.Time as recognized type

The long term plan is to define an interface that time.Time
can implement and that encoding/xml can call, but we are
not going to try to define that interface before Go 1.
Instead, special-case time.Time in package xml, because
it is such a fundamental type, as a stop-gap.
The eventual methods will behave this way.

Fixes #2793.

R=golang-dev, r, r, n13m3y3r
CC=golang-dev
https://golang.org/cl/5634051
2012-02-07 23:37:25 -05:00
Russ Cox
3ee208533e strconv: handle very large inputs
Fixes #2642.

R=remyoudompheng, r, r
CC=golang-dev
https://golang.org/cl/5639052
2012-02-07 23:37:15 -05:00
Russ Cox
00134fe8ef fmt: diagnose invalid verb applied to pointer
Fixes #2851.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5644048
2012-02-07 23:37:05 -05:00
Rob Pike
0bd53d2ce0 runtime/cgo: silence warning on windows
It appears to want a * on an indirect function call (assembly language)

TBR=rsc

R=golang-dev
CC=golang-dev
https://golang.org/cl/5643054
2012-02-08 15:26:36 +11:00
Rob Pike
9af4b01654 5l: attempt to fix arm build
TBR=rsc

R=golang-dev
CC=golang-dev
https://golang.org/cl/5647049
2012-02-08 15:12:56 +11:00
Gustavo Niemeyer
0a7ad329e1 encoding/xml: add support for the omitempty flag
This also changes the behavior of attribute marshalling so
that strings and byte slices are marshalled even if empty.
The omitempty flag may be used to obtain the previous behavior.

Fixes #2899.

R=rsc
CC=golang-dev
https://golang.org/cl/5645050
2012-02-08 01:57:44 -02:00
Andrew Gerrand
0a6e2461e3 archive/zip: tweak API and docs.
Fixes #2835.

R=golang-dev, n13m3y3r, r, bradfitz
CC=golang-dev
https://golang.org/cl/5645051
2012-02-08 14:34:40 +11:00
Rob Pike
90d43ad720 encoding/csv: document ReadAll behavior at EOF
Fixes #2847.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5641050
2012-02-08 14:24:04 +11:00