]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agonet/http: Serve creates service goroutines, not service threads
Matthew Dempsky [Wed, 16 Jan 2013 22:05:41 +0000 (14:05 -0800)]
net/http: Serve creates service goroutines, not service threads

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

12 years agonet/http: fix racy test
Brad Fitzpatrick [Tue, 15 Jan 2013 17:13:05 +0000 (09:13 -0800)]
net/http: fix racy test

We need to wait for the handler to actually finish running,
not almost be done running.

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

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

12 years agodoc: fix various fragment links
Andrew Gerrand [Tue, 15 Jan 2013 08:25:16 +0000 (19:25 +1100)]
doc: fix various fragment links

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

12 years agonet: simplify ListenMulticastUDP
Mikio Hara [Mon, 14 Jan 2013 23:53:12 +0000 (08:53 +0900)]
net: simplify ListenMulticastUDP

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

12 years agosyscall: simplify socket control messages
Mikio Hara [Mon, 14 Jan 2013 23:52:22 +0000 (08:52 +0900)]
syscall: simplify socket control messages

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

12 years agogo/types: set type of lhs ident in type switch guards
Robert Griesemer [Mon, 14 Jan 2013 23:25:42 +0000 (15:25 -0800)]
go/types: set type of lhs ident in type switch guards

(bug fix)

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

12 years agogo/types: various minor fixes
Robert Griesemer [Mon, 14 Jan 2013 23:19:32 +0000 (15:19 -0800)]
go/types: various minor fixes

- always set the Pkg field in QualifiedIdents
- call Context.Ident for all identifiers in the AST that denote
  a types.Object (bug fix)
- added test that Context.Ident is called for all such identifiers

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

12 years agotime: fix race
Brad Fitzpatrick [Mon, 14 Jan 2013 22:09:42 +0000 (14:09 -0800)]
time: fix race

Fixes #4622

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

12 years agogo/types: mark completely imported packages as such
Robert Griesemer [Mon, 14 Jan 2013 19:01:27 +0000 (11:01 -0800)]
go/types: mark completely imported packages as such

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

12 years agogo/types: callback for *ast.Ident -> Object mapping
Robert Griesemer [Mon, 14 Jan 2013 17:43:27 +0000 (09:43 -0800)]
go/types: callback for *ast.Ident -> Object mapping

Also re-enabled resolver test.

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

12 years agohtml/template: Clarifying references to "text/template" in the documentation.
Francesc Campoy [Mon, 14 Jan 2013 12:11:22 +0000 (12:11 +0000)]
html/template: Clarifying references to "text/template" in the documentation.

Fixes #4634.

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

12 years agosyscall: simplify netlink sockets
Mikio Hara [Mon, 14 Jan 2013 10:29:03 +0000 (19:29 +0900)]
syscall: simplify netlink sockets

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

12 years agoencoding/json: fix panics on type mismatches.
Rémy Oudompheng [Mon, 14 Jan 2013 07:44:16 +0000 (08:44 +0100)]
encoding/json: fix panics on type mismatches.

Fixes #4222.
Fixes #4628.

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

12 years agoencoding/gob: fix broken test (fix build)
Alex Brainman [Mon, 14 Jan 2013 06:03:19 +0000 (17:03 +1100)]
encoding/gob: fix broken test (fix build)

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

12 years agoencoding/gob: handle encoding of different indirects of GobEncoder
Kyle Lemons [Mon, 14 Jan 2013 05:07:11 +0000 (16:07 +1100)]
encoding/gob: handle encoding of different indirects of GobEncoder

Fixes #4647.

R=r, golang-dev
CC=golang-dev
https://golang.org/cl/7085051

12 years agomisc/dashboard/codereview: add campoy to list of gophers
Andrew Gerrand [Sun, 13 Jan 2013 22:54:56 +0000 (09:54 +1100)]
misc/dashboard/codereview: add campoy to list of gophers

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

12 years agocmd/godoc: support m=text parameter for text files
Andrew Gerrand [Sun, 13 Jan 2013 22:35:04 +0000 (09:35 +1100)]
cmd/godoc: support m=text parameter for text files

It's possible to view the package docs in plain text, eg:
        http://golang.org/pkg/time/?m=text
and this CL introduces the ability to do the same for files:
        http://golang.org/src/pkg/time/time.go?m=text

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

12 years agogo/types: Moving from *ast.Objects to types.Objects (step 2).
Robert Griesemer [Sun, 13 Jan 2013 18:33:08 +0000 (10:33 -0800)]
go/types: Moving from *ast.Objects to types.Objects (step 2).

Completely removed *ast.Objects from being exposed by the
types API. *ast.Objects are still required internally for
resolution, but now the door is open for an internal-only
rewrite of identifier resolution entirely at type-check
time. Once that is done, ASTs can be type-checked whether
they have been created via the go/parser or otherwise,
and type-checking does not require *ast.Object or scope
invariants to be maintained externally.

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

12 years agocmd/5l: fix invalid executable header on Plan 9
Anthony Martin [Sat, 12 Jan 2013 11:13:55 +0000 (03:13 -0800)]
cmd/5l: fix invalid executable header on Plan 9

R=minux.ma, lucio.dere
CC=golang-dev
https://golang.org/cl/7094048

12 years agocmd/5c: fix handling of side effects when assigning a struct literal.
Rémy Oudompheng [Sat, 12 Jan 2013 08:16:50 +0000 (09:16 +0100)]
cmd/5c: fix handling of side effects when assigning a struct literal.

Also undo revision a5b96b602690 used to workaround the bug.

Fixes #4643.

R=rsc, golang-dev, dave, minux.ma, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/7090043

12 years agotest: limit runoutput tests on arm platforms
Dave Cheney [Sat, 12 Jan 2013 06:52:52 +0000 (17:52 +1100)]
test: limit runoutput tests on arm platforms

runoutput styles tests generally consume a lot of memory. On arm platforms rotate?.go consume around 200mb each to compile, and as tests are sorted alphabetically, they all tend to run at once.

This change limits the number of runoutput jobs to 2 on arm platforms.

R=minux.ma, remyoudompheng, bradfitz, lucio.dere
CC=golang-dev
https://golang.org/cl/7099047

12 years agobuild: add missing function declarations for Plan 9
Lucio De Re [Sat, 12 Jan 2013 00:58:46 +0000 (16:58 -0800)]
build: add missing function declarations for Plan 9

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

12 years ago testing: document whitespace trimming of example expected/actual output.
Caleb Spare [Sat, 12 Jan 2013 00:18:15 +0000 (11:18 +1100)]
  testing: document whitespace trimming of example expected/actual output.

Fixes #4642.

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

12 years agotext/template: Document that range can be used on chan types.
Kamil Kisiel [Sat, 12 Jan 2013 00:06:13 +0000 (11:06 +1100)]
text/template: Document that range can be used on chan types.

Fixes #4640.

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

12 years agotesting: in example, empty output not distinguished from missing output
Ryan Slade [Sat, 12 Jan 2013 00:05:53 +0000 (11:05 +1100)]
testing: in example, empty output not distinguished from missing output

Fixes #4485.

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

12 years agonet/http/cgi: fix test case sensitivity on Windows
Brad Fitzpatrick [Fri, 11 Jan 2013 23:11:08 +0000 (15:11 -0800)]
net/http/cgi: fix test case sensitivity on Windows

Fixes #4645

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

12 years agogo/types: export QualifiedName.IsSame and NamedType.AstObj
Robert Griesemer [Fri, 11 Jan 2013 22:55:49 +0000 (14:55 -0800)]
go/types: export QualifiedName.IsSame and NamedType.AstObj

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

12 years agodatabase/sql: document args, add a couple examples
Brad Fitzpatrick [Fri, 11 Jan 2013 22:46:49 +0000 (14:46 -0800)]
database/sql: document args, add a couple examples

Fixes #3460

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

12 years agogo/types: Moving from *ast.Objects to types.Objects (step 1).
Robert Griesemer [Fri, 11 Jan 2013 21:53:38 +0000 (13:53 -0800)]
go/types: Moving from *ast.Objects to types.Objects (step 1).

The existing type checker was relying on augmenting ast.Object
fields (empty interfaces) for its purposes. While this worked
for some time now, it has become increasingly brittle. Also,
the need for package information for Fields and Methods would
have required a new field in each ast.Object. Rather than making
them bigger and the code even more subtle, in this CL we are moving
away from ast.Objects.

The types packge now defines its own objects for different
language entities (Const, Var, TypeName, Func), and they
implement the types.Object interface. Imported packages
create a Package object which holds the exported entities
in a types.Scope of types.Objects.

For type-checking, the current package is still using ast.Objects
to make this transition manageable. In a next step, the type-
checker will also use types.Objects instead, which opens the door
door to resolving ASTs entirely by the type checker. As a result,
the AST and type checker become less entangled, and ASTs can be
manipulated "by hand" or programmatically w/o having to worry
about scope and object invariants that are very hard to maintain.

(As a consequence, a future parser can do less work, and a
future AST will not need to define objects and scopes anymore.
Also, object resolution which is now split across the parser,
the ast, (ast.NewPackage), and even the type checker (for composite
literal keys) can be done in a single place which will be simpler
and more efficient.)

Change details:
- Check now takes a []*ast.File instead of a map[string]*ast.File.
It's easier to handle (I deleted code at all use sites) and does
not suffer from undefined order (which is a pain for testing).
- ast.Object.Data is now a *types.Package rather then an *ast.Scope
if the object is a package (obj.Kind == ast.Pkg). Eventually this
will go away altogether.
- Instead of an ast.Importer, Check now uses a types.Importer
(which returns a *types.Package).
- types.NamedType has two object fields (Obj Object and obj *ast.Object);
eventually there will be only Obj. The *ast.Object is needed during
this transition since a NamedType may refer to either an imported
(using types.Object) or locally defined (using *ast.Object) type.
- ast.NewPackage is not used anymore - there's a local copy for
package-level resolution of imports.
- struct fields now take the package origin into account.
- The GcImporter is now returning a *types.Package. It cannot be
used with ast.NewPackage anymore. If that functionality is still
used, a copy of the old GcImporter should be made locally (note
that GcImporter was part of exp/types and it's API was not frozen).
- dot-imports are not handled for the time being (this will come back).

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

12 years agotest: add rotate.go and fixedbugs/bug313
Rémy Oudompheng [Fri, 11 Jan 2013 21:42:55 +0000 (22:42 +0100)]
test: add rotate.go and fixedbugs/bug313

Update #4139.

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

12 years agodatabase/sql: check NumInput on Stmt.Exec
Gwenael Treguier [Fri, 11 Jan 2013 21:28:33 +0000 (13:28 -0800)]
database/sql: check NumInput on Stmt.Exec

Fixes #3678.

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

12 years agotest: adapt old-style tests to new flag parsing.
Rémy Oudompheng [Fri, 11 Jan 2013 21:05:46 +0000 (22:05 +0100)]
test: adapt old-style tests to new flag parsing.

The -I. syntax now needs a space to be recognized in the
compiler.

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

12 years agotest: make rundir match compiledir/errorcheckdir.
Rémy Oudompheng [Fri, 11 Jan 2013 21:00:48 +0000 (22:00 +0100)]
test: make rundir match compiledir/errorcheckdir.

This allows test/dwarf to be supported by run.go.

Update #4139.

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

12 years agonet/http: buffer before chunking
Brad Fitzpatrick [Fri, 11 Jan 2013 18:03:43 +0000 (10:03 -0800)]
net/http: buffer before chunking

This introduces a buffer between writing from a handler and
writing chunks.  Further, it delays writing the header until
the first full chunk is ready.  In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.

Fixes #2357

R=golang-dev, dave, minux.ma, rsc, adg, balasanjay
CC=golang-dev
https://golang.org/cl/6964043

12 years agoos: use syscall.Pipe2 on Linux
Georg Reinke [Fri, 11 Jan 2013 16:30:25 +0000 (08:30 -0800)]
os: use syscall.Pipe2 on Linux

Update #2656

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

12 years agocmd/6g, cmd/8g: Allow optimization of return registers.
Daniel Morsing [Fri, 11 Jan 2013 14:44:42 +0000 (15:44 +0100)]
cmd/6g, cmd/8g: Allow optimization of return registers.

The peephole optimizer would keep hands off AX and X0 during returns, even though go doesn't return through registers.

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

12 years agobytes: fix UnreadByte failure after ReadBytes
Stéphane Travostino [Fri, 11 Jan 2013 06:02:21 +0000 (17:02 +1100)]
bytes: fix UnreadByte failure after ReadBytes

Fixes #4583.

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

12 years agocmd/gc, cmd/ld: update doc.go for -race
Shenghou Ma [Fri, 11 Jan 2013 04:35:58 +0000 (12:35 +0800)]
cmd/gc, cmd/ld: update doc.go for -race

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

12 years agocmd/5g: allow optimization of return registers.
Shenghou Ma [Fri, 11 Jan 2013 04:29:14 +0000 (12:29 +0800)]
cmd/5g: allow optimization of return registers.
Modeled after CL 7030046 by daniel.morsing.

example program:
func f(x int) int { x -= 10; return x }

5g -S difference:
 --- prog list "f" ---
 0011 (x.go:7) TEXT    add+0(SB),$0-8
 0012 (x.go:7) MOVW    x+0(FP),R0
-0013 (x.go:7) SUB     $10,R0,R2
-0014 (x.go:7) MOVW    R2,R0
-0015 (x.go:7) MOVW    R2,.noname+4(FP)
-0016 (x.go:7) RET     ,
+0013 (x.go:7) SUB     $10,R0
+0014 (x.go:7) MOVW    R0,.noname+4(FP)
+0015 (x.go:7) RET     ,

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

12 years agocmd/5l: support -Z (zero stack frame at function entry)
Shenghou Ma [Fri, 11 Jan 2013 04:24:28 +0000 (12:24 +0800)]
cmd/5l: support -Z (zero stack frame at function entry)
also added appropriate docs to cmd/ld/doc.go
(largely copied from Russ's CL 6938073).

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

12 years agoencoding/json: improve performance of Unmarshal on primitive types
Rick Arnold [Fri, 11 Jan 2013 01:58:45 +0000 (17:58 -0800)]
encoding/json: improve performance of Unmarshal on primitive types

Skip most of the scanning and parsing logic for simple (non-object/array) JSON values.

benchmark                   old ns/op    new ns/op    delta
BenchmarkUnmarshalInt             948          436  -54.01%
BenchmarkUnmarshalUint            930          427  -54.09%
BenchmarkUnmarshalString         1407          715  -49.18%
BenchmarkUnmarshalFloat          1114          536  -51.89%
BenchmarkUnmarshalBool            759          266  -64.95%
BenchmarkUnmarshalStruct         8165         8181   +0.20%

No significant effects on the go1 benchmarks:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9647362752   9596196417   -0.53%
BenchmarkFannkuch11      5623613048   5518694872   -1.87%
BenchmarkGobDecode         32944041     33165434   +0.67%
BenchmarkGobEncode         21237482     21080554   -0.74%
BenchmarkGzip             750955920    749861980   -0.15%
BenchmarkGunzip           197369742    197886192   +0.26%
BenchmarkJSONEncode        79274091     78891137   -0.48%
BenchmarkJSONDecode       180257802    175280358   -2.76%
BenchmarkMandelbrot200      7396666      7388266   -0.11%
BenchmarkParse             11446460     11386550   -0.52%
BenchmarkRevcomp         1605152523   1599512029   -0.35%
BenchmarkTemplate         204538247    207765574   +1.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            23.30        23.14    0.99x
BenchmarkGobEncode            36.14        36.41    1.01x
BenchmarkGzip                 25.84        25.88    1.00x
BenchmarkGunzip               98.32        98.06    1.00x
BenchmarkJSONEncode           24.48        24.60    1.00x
BenchmarkJSONDecode           10.76        11.07    1.03x
BenchmarkParse                 5.06         5.09    1.01x
BenchmarkRevcomp             158.34       158.90    1.00x
BenchmarkTemplate              9.49         9.34    0.98x

Fixes #3949.

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

12 years agonet: use windows ConnectEx to dial (when possible)
Alex Brainman [Fri, 11 Jan 2013 01:42:09 +0000 (12:42 +1100)]
net: use windows ConnectEx to dial (when possible)

Update #2631.
Update #3097.

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

12 years agosyscall: implement Pipe2 on Linux and use it in ForkExec
Georg Reinke [Fri, 11 Jan 2013 01:04:55 +0000 (17:04 -0800)]
syscall: implement Pipe2 on Linux and use it in ForkExec

Fixes #2656.

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

12 years agoruntime: work around 5c bug in GC code.
Rémy Oudompheng [Thu, 10 Jan 2013 23:59:44 +0000 (00:59 +0100)]
runtime: work around 5c bug in GC code.

5c miscompiles *p++ = struct_literal.

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

12 years agoruntime: interpret type information during garbage collection
Jan Ziak [Thu, 10 Jan 2013 20:45:46 +0000 (15:45 -0500)]
runtime: interpret type information during garbage collection

R=rsc, dvyukov, remyoudompheng, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6945069

12 years agoA+C: Georg Reinke (individual CLA)
Ian Lance Taylor [Thu, 10 Jan 2013 19:37:52 +0000 (11:37 -0800)]
A+C: Georg Reinke (individual CLA)

Generated by addca.

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

12 years agoruntime: faster segmented stacks
Dmitriy Vyukov [Thu, 10 Jan 2013 07:36:40 +0000 (11:36 +0400)]
runtime: faster segmented stacks
benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          548  -17.59%
BenchmarkStackGrowth-2               333          274  -17.72%
BenchmarkStackGrowth-4               224          168  -25.00%
BenchmarkStackGrowth-8               124           91  -26.21%
BenchmarkStackGrowth-16               82           70  -14.55%
BenchmarkStackGrowth-32               73           59  -19.49%

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

12 years agoruntime: less aggressive per-thread stack segment caching
Dmitriy Vyukov [Thu, 10 Jan 2013 05:57:06 +0000 (09:57 +0400)]
runtime: less aggressive per-thread stack segment caching
Introduce global stack segment cache and limit per-thread cache size.
This greatly reduces StackSys memory on workloads that create lots of threads.

benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          656   -1.35%
BenchmarkStackGrowth-2               333          328   -1.50%
BenchmarkStackGrowth-4               224          172  -23.21%
BenchmarkStackGrowth-8               124           91  -26.13%
BenchmarkStackGrowth-16               82           47  -41.94%
BenchmarkStackGrowth-32               73           40  -44.79%

BenchmarkStackGrowthDeep           97231        94391   -2.92%
BenchmarkStackGrowthDeep-2         47230        58562  +23.99%
BenchmarkStackGrowthDeep-4         24993        49356  +97.48%
BenchmarkStackGrowthDeep-8         15105        30072  +99.09%
BenchmarkStackGrowthDeep-16        10005        15623  +56.15%
BenchmarkStackGrowthDeep-32        12517        13069   +4.41%

TestStackMem#1,MB                  310          12       -96.13%
TestStackMem#2,MB                  296          14       -95.27%
TestStackMem#3,MB                  479          14       -97.08%

TestStackMem#1,sec                 3.22         2.26     -29.81%
TestStackMem#2,sec                 2.43         2.15     -11.52%
TestStackMem#3,sec                 2.50         2.38      -4.80%

R=sougou, no.smile.face, rsc
CC=golang-dev, msolomon
https://golang.org/cl/7029044

12 years agodoc/contribute: Link to IssueTracker docs for more "special sentences"
Matthew Dempsky [Thu, 10 Jan 2013 03:17:20 +0000 (14:17 +1100)]
doc/contribute: Link to IssueTracker docs for more "special sentences"

Update #4582.

R=nigeltao, dave, adg
CC=golang-dev
https://golang.org/cl/7070065

12 years agocmd/cgo: for gccgo: use intgo, don't use slice as void return type
Ian Lance Taylor [Wed, 9 Jan 2013 23:25:46 +0000 (15:25 -0800)]
cmd/cgo: for gccgo: use intgo, don't use slice as void return type

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

12 years agocontainer/list: avoid memory leaks
Robert Griesemer [Wed, 9 Jan 2013 23:22:48 +0000 (15:22 -0800)]
container/list: avoid memory leaks

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

12 years agocmd/ld: fix incompatible type signatures on Plan 9
Anthony Martin [Wed, 9 Jan 2013 23:05:22 +0000 (15:05 -0800)]
cmd/ld: fix incompatible type signatures on Plan 9

Changeset f483bfe81114 moved ELF generation to the architecture
independent code and in doing so added a Section* to the Sym
type and an Elf64_Shdr* to the Section type.

This caused the Plan 9 compilers to complain about incompatible
type signatures in the many files that reference the Sym type.

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

12 years agocmd/go: remove $GOROOT as a go get target
Dave Cheney [Wed, 9 Jan 2013 22:57:01 +0000 (09:57 +1100)]
cmd/go: remove $GOROOT as a go get target

Fixes #4186.

Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.

For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.

Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.

llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""

This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.

This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.

Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion

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

12 years agocmd/go: get -m options from GOARCH when using gccgo
Ian Lance Taylor [Wed, 9 Jan 2013 22:45:03 +0000 (14:45 -0800)]
cmd/go: get -m options from GOARCH when using gccgo

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

12 years agogo/types: don't parse imported packages multiple times.
Rémy Oudompheng [Wed, 9 Jan 2013 21:03:41 +0000 (22:03 +0100)]
go/types: don't parse imported packages multiple times.

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

12 years agocmd/gc: add space to export data to match linker expectations
Rémy Oudompheng [Wed, 9 Jan 2013 21:02:53 +0000 (22:02 +0100)]
cmd/gc: add space to export data to match linker expectations

The linker split PKGDEF into (prefix, name, def) pairs,
and defines def to begin after a space following the identifier.
This is totally wrong for the following export data:

        func "".FunctionName()
        var SomethingCompletelyUnrelated int

The linker would parse
    name=`"".FunctionName()\n\tvar`
    def=`SomethingCompletelyUnrelated int`
since there is no space after FunctionName.

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

12 years agocmd/dist: drop unneeded clang flags
Dave Cheney [Wed, 9 Jan 2013 21:00:03 +0000 (08:00 +1100)]
cmd/dist: drop unneeded clang flags

Our source no longer needs these flags set to build cleanly using clang.

Tested with

* Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) on i386
* clang version 3.2 (tags/RELEASE_32/final) on amd64 cross compiling all platforms

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

12 years agogo/printer, gofmt: don't print unneeded parentheses around parameter types
Robert Griesemer [Wed, 9 Jan 2013 19:32:16 +0000 (11:32 -0800)]
go/printer, gofmt: don't print unneeded parentheses around parameter types

Fixes #4624.

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

12 years agogo/parser: better error message for declaration error
Robert Griesemer [Wed, 9 Jan 2013 19:31:57 +0000 (11:31 -0800)]
go/parser: better error message for declaration error

Fixes #4616.

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

12 years agospec: clarify short variable declaration corner cases
Robert Griesemer [Wed, 9 Jan 2013 19:31:32 +0000 (11:31 -0800)]
spec: clarify short variable declaration corner cases

Fixes #4612.

R=rsc, iant, ken, r
CC=golang-dev
https://golang.org/cl/7076043

12 years agoutf8: fix typo.
Andrey Mirtchovski [Wed, 9 Jan 2013 19:07:13 +0000 (11:07 -0800)]
utf8: fix typo.

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

12 years agonet/http: don't buffer request writing if dest is already buffered
Brad Fitzpatrick [Wed, 9 Jan 2013 18:33:46 +0000 (10:33 -0800)]
net/http: don't buffer request writing if dest is already buffered

The old code made it impossible to implement a reverse proxy
with anything less than 4k write granularity to the backends.

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

12 years agodoc: Mention godoc's handling of example functions.
Matthew Dempsky [Wed, 9 Jan 2013 15:31:25 +0000 (07:31 -0800)]
doc: Mention godoc's handling of example functions.

Fixes #4625.

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

12 years agomisc/emacs: update go-mode syntax table and comment handling as
Sameer Ajmani [Wed, 9 Jan 2013 15:26:34 +0000 (10:26 -0500)]
misc/emacs: update go-mode syntax table and comment handling as
suggested by pkleiweg.

Fixes #3471.

R=adonovan, pkleiweg, rsc
CC=golang-dev
https://golang.org/cl/7060056

12 years agogo/types: "inherit" type in constant declarations w/o initialization expressions...
Robert Griesemer [Tue, 8 Jan 2013 23:03:30 +0000 (15:03 -0800)]
go/types: "inherit" type in constant declarations w/o initialization expressions (bug fix)

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

12 years agoall: use io.ByteWriter now that it exists
Brad Fitzpatrick [Tue, 8 Jan 2013 20:15:19 +0000 (12:15 -0800)]
all: use io.ByteWriter now that it exists

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

12 years agodoc/articles/go_command: remove an extra word.
Oling Cat [Tue, 8 Jan 2013 17:49:38 +0000 (09:49 -0800)]
doc/articles/go_command: remove an extra word.

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

12 years agonet/http/cgi: make it work without REQUEST_URI environment variable
Alex Brainman [Tue, 8 Jan 2013 06:23:46 +0000 (17:23 +1100)]
net/http/cgi: make it work without REQUEST_URI environment variable

Fixes #4367.

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

12 years agocmd/vet: fix doc typo.
Jason Travis [Tue, 8 Jan 2013 04:22:18 +0000 (15:22 +1100)]
cmd/vet: fix doc typo.

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

12 years agoA+C: Jason Travis (individual CLA)
David Symonds [Tue, 8 Jan 2013 04:21:09 +0000 (15:21 +1100)]
A+C: Jason Travis (individual CLA)

Generated by addca.

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

12 years agospec: s/char_lit/rune_lit/
Robert Griesemer [Tue, 8 Jan 2013 02:02:58 +0000 (18:02 -0800)]
spec: s/char_lit/rune_lit/

The spec talks explicitly about rune literals but the
respective production is still called char_lit for
historic reasons. Updated the two occurences.

Fixes #4602.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/7070048

12 years agocmd/gc: fix uintptr(nil) issues.
Rémy Oudompheng [Mon, 7 Jan 2013 23:23:02 +0000 (00:23 +0100)]
cmd/gc: fix uintptr(nil) issues.

A constant node of type uintptr with a nil literal could
happen in two cases: []int(nil)[1:] and
uintptr(unsafe.Pointer(nil)).

Fixes #4614.

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

12 years agocmd/go: use filepath.SplitList when inspecting GOPATH
Dave Cheney [Mon, 7 Jan 2013 23:00:21 +0000 (10:00 +1100)]
cmd/go: use filepath.SplitList when inspecting GOPATH

There exists a test case for this condition, but it only runs on unix systems, which neatly dovetails into the code always using ':' as the list separator.

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

12 years agogo/doc: recursively inspect selector expressions
Andrew Gerrand [Mon, 7 Jan 2013 08:36:38 +0000 (19:36 +1100)]
go/doc: recursively inspect selector expressions

Also adds a couple of simple tests for doc.Examples.

Fixes #4561.

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

12 years agoimage/jpeg: handle those (unusual) grayscale images whose sampling
Nigel Tao [Mon, 7 Jan 2013 05:16:11 +0000 (16:16 +1100)]
image/jpeg: handle those (unusual) grayscale images whose sampling
ratio isn't 1x1.

Fixes #4259.

The test data was generated by
cjpeg -quality 50 -sample 2x2 video-005.gray.pgm > video-005.gray.q50.2x2.jpeg
cjpeg -quality 50 -sample 2x2 -progressive video-005.gray.pgm > video-005.gray.q50.2x2.progressive.jpeg

similarly to video-005.gray.q50.* from
http://code.google.com/p/go/source/detail?r=51f26e36ba98
the key difference being the "-sample 2x2".

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

12 years agocmd/vet: %#q is a valid format (uses raw quotes).
David Symonds [Mon, 7 Jan 2013 04:31:51 +0000 (15:31 +1100)]
cmd/vet: %#q is a valid format (uses raw quotes).

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

12 years agocmd/gc, cmd/ld: rename -b to -race
Russ Cox [Mon, 7 Jan 2013 03:47:39 +0000 (22:47 -0500)]
cmd/gc, cmd/ld: rename -b to -race

There's no b in race detector.
The new flag matches the one in the go command
(go test -race math).

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

12 years agoos: document that Exit does not run deferred calls
Andrew Gerrand [Mon, 7 Jan 2013 03:46:41 +0000 (14:46 +1100)]
os: document that Exit does not run deferred calls

Fixes #4101.

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

12 years ago doc: two minor edits to contribute.html
Caleb Spare [Mon, 7 Jan 2013 03:44:16 +0000 (22:44 -0500)]
  doc: two minor edits to contribute.html

- Missing parenthesis
- Fix bad phrasing

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

12 years agobytes: Fix missing godoc punctuation.
Matthew Dempsky [Mon, 7 Jan 2013 03:44:04 +0000 (22:44 -0500)]
bytes: Fix missing godoc punctuation.

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

12 years agobytes: Change Compare example to be consistent with sort.Search's.
Matthew Dempsky [Mon, 7 Jan 2013 03:43:32 +0000 (22:43 -0500)]
bytes: Change Compare example to be consistent with sort.Search's.

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

12 years agogo/doc: trim only first space or newline from example output comment
Andrew Gerrand [Mon, 7 Jan 2013 02:42:25 +0000 (13:42 +1100)]
go/doc: trim only first space or newline from example output comment

Fixes #4487.

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

12 years agogo/types: Set Signature.Recv for imported types
Andrew Wilkins [Mon, 7 Jan 2013 02:08:58 +0000 (18:08 -0800)]
go/types: Set Signature.Recv for imported types

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

12 years agoos: fix Open for empty root directories on windows
Alex Brainman [Mon, 7 Jan 2013 01:48:32 +0000 (12:48 +1100)]
os: fix Open for empty root directories on windows

Fixes #4601.

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

12 years agospec: Use "non-negative" instead of "positive"
Matthew Dempsky [Mon, 7 Jan 2013 00:56:06 +0000 (16:56 -0800)]
spec: Use "non-negative" instead of "positive"

Replacing division-by-power-of-2 with right-shift is valid for
zero too.

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

12 years agomisc/dashboard/builder: set GOPATH before building subrepos
Dave Cheney [Mon, 7 Jan 2013 00:24:01 +0000 (11:24 +1100)]
misc/dashboard/builder: set GOPATH before building subrepos

This proposal updates the dashboard builder to avoid relying on the (soon to be removed) support for using go get to download to $GOROOT. The result is

WORKSPACE=$(the value of the -buildRoot flag / $BUILDER_NAME + hg revision)
GOROOT=$WORKSPACE/go
GOPATH=$WORKSPACE

Required for CL 6941058.

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

12 years agocmd/gofmt, bufio, image: Consistency and error handling.
Robin Eklind [Mon, 7 Jan 2013 00:15:53 +0000 (11:15 +1100)]
cmd/gofmt, bufio, image: Consistency and error handling.

cmd/gofmt: Add error handling for ioutil.WriteFile.
bufio: Consistency, rename e to err.
image: Consistency, fix comment for asReader.

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

12 years agobytes: fix docs: s/array/slice/.
Nigel Tao [Sun, 6 Jan 2013 23:48:06 +0000 (10:48 +1100)]
bytes: fix docs: s/array/slice/.

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

12 years agosrc: Use bytes.Equal instead of bytes.Compare where possible.
Matthew Dempsky [Sun, 6 Jan 2013 23:03:49 +0000 (10:03 +1100)]
src: Use bytes.Equal instead of bytes.Compare where possible.

bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.

Change generated automatically using:
  gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
  gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

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

12 years agobytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.
Matthew Dempsky [Sun, 6 Jan 2013 22:59:37 +0000 (09:59 +1100)]
bytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.

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

12 years agoencoding/json: documented that ,string applies only to string and numeric fields.
Caleb Spare [Sun, 6 Jan 2013 22:44:35 +0000 (09:44 +1100)]
encoding/json: documented that ,string applies only to string and numeric fields.

Fixes #4437.

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

12 years agoA+C: Caleb Spare (individual CLA)
Andrew Gerrand [Sun, 6 Jan 2013 22:43:53 +0000 (09:43 +1100)]
A+C: Caleb Spare (individual CLA)

Generated by addca.

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

12 years agogo/types: less closure creations in gcimporter.
Rémy Oudompheng [Sun, 6 Jan 2013 22:38:38 +0000 (23:38 +0100)]
go/types: less closure creations in gcimporter.

Closures are incredibly expensive on linux/arm due to
repetitive flush of instruction cache.

go test -short on ODROID-X:

Before:
ok      exp/gotype      17.091s
ok      go/types        2.225s

After:
ok      exp/gotype      7.193s
ok      go/types        1.143s

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

12 years agodoc: Updated links for sub-repository documentation.
Robin Eklind [Sun, 6 Jan 2013 22:10:09 +0000 (09:10 +1100)]
doc: Updated links for sub-repository documentation.

Use godoc.org instead of gopkgdoc.appspot.com.

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

12 years agocmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing
Russ Cox [Sun, 6 Jan 2013 20:24:47 +0000 (15:24 -0500)]
cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing

This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043

12 years agocmd/ld: move symtab, ELF generation to portable code
Russ Cox [Sun, 6 Jan 2013 19:32:45 +0000 (14:32 -0500)]
cmd/ld: move symtab, ELF generation to portable code

More cleanup in preparation for fixing issue 4069.

This CL replaces the three nearly identical copies of the
asmb ELF code with a single asmbelf function in elf.c.

In addition to the ELF code movement, remove the elfstr
array in favor of a simpler lookup, and identify sections by
name throughout instead of computing fragile indices.

The CL also replaces the three nearly identical copies of the
genasmsym code with a single genasmsym function in lib.c.

The ARM linker still compiles and generates binaries,
but I haven't tested the binaries. They may not work.

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

12 years agocmd/go: avoid leaking timer if test process failed to start
Dave Cheney [Sat, 5 Jan 2013 10:15:51 +0000 (21:15 +1100)]
cmd/go: avoid leaking timer if test process failed to start

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

12 years agocmd/ld: use native-endian symbol values in symbol table
Russ Cox [Fri, 4 Jan 2013 22:03:57 +0000 (17:03 -0500)]
cmd/ld: use native-endian symbol values in symbol table

The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.

To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
        fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.

All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.

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

12 years agocmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.
Daniel Morsing [Fri, 4 Jan 2013 16:07:21 +0000 (17:07 +0100)]
cmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.

Fixes #4066.

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

12 years agocmd/5g, cmd/5l, cmd/ld: Small adjustments for the Plan 9 native tools
Lucio De Re [Fri, 4 Jan 2013 16:02:49 +0000 (11:02 -0500)]
cmd/5g, cmd/5l, cmd/ld: Small adjustments for the Plan 9 native tools

A few USED(xxx) additions and a couple of deletions of variable
initialisations that go unused.  One questionable correction,
mirrored in 8l/asm.c, where the result of invocation of a function
shouldn't be used.

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