]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoruntime: inline several float64 routines to speed up complex128 division
Shenghou Ma [Tue, 7 Aug 2012 15:45:50 +0000 (23:45 +0800)]
runtime: inline several float64 routines to speed up complex128 division
Depends on CL 6197045.

Result obtained on Core i7 620M, Darwin/amd64:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           57           28  -50.78%
BenchmarkComplex128DivNisNaN           49           15  -68.90%
BenchmarkComplex128DivDisNaN           49           15  -67.88%
BenchmarkComplex128DivNisInf           40           12  -68.50%
BenchmarkComplex128DivDisInf           33           13  -61.06%

Result obtained on Core i7 620M, Darwin/386:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal           89           50  -44.05%
BenchmarkComplex128DivNisNaN          307          802  +161.24%
BenchmarkComplex128DivDisNaN          309          788  +155.02%
BenchmarkComplex128DivNisInf          278          237  -14.75%
BenchmarkComplex128DivDisInf           46           22  -52.46%

Result obtained on 700MHz OMAP4460, Linux/ARM:
benchmark                       old ns/op    new ns/op    delta
BenchmarkComplex128DivNormal         1557          465  -70.13%
BenchmarkComplex128DivNisNaN         1443          220  -84.75%
BenchmarkComplex128DivDisNaN         1481          218  -85.28%
BenchmarkComplex128DivNisInf          952          216  -77.31%
BenchmarkComplex128DivDisInf          861          231  -73.17%

The 386 version has a performance regression, but as we have
decided to use SSE2 instead of x87 FPU for 386 too (issue 3912),
I won't address this issue.

R=dsymonds, mchaten, iant, dave, mtj, rsc, r
CC=golang-dev
https://golang.org/cl/6024045

12 years agoio: document ReaderFrom and WriterTo
Brad Fitzpatrick [Tue, 7 Aug 2012 06:10:10 +0000 (16:10 +1000)]
io: document ReaderFrom and WriterTo

Fixes #3711

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

12 years agotext/template: fix range example.
Yves Junqueira [Tue, 7 Aug 2012 03:40:43 +0000 (20:40 -0700)]
text/template: fix range example.

R=r
CC=adg, gobot, golang-dev
https://golang.org/cl/6449096

12 years agoexp/html: correctly handle <title> after </head>
Andrew Balholm [Tue, 7 Aug 2012 03:36:08 +0000 (13:36 +1000)]
exp/html: correctly handle <title> after </head>

The <title> element was getting removed from the stack of open elements,
when its parent, the <head> element should have been removed instead.

Pass 2 additional tests.

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

12 years agonet/http: disable TestServeFileFromCWD test on windows
Alex Brainman [Tue, 7 Aug 2012 03:19:49 +0000 (13:19 +1000)]
net/http: disable TestServeFileFromCWD test on windows

This is an attempt to fix windows build. Will restore
once we know what the problem is.

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

12 years agodoc: fix some HTML syntax errors
Shenghou Ma [Tue, 7 Aug 2012 03:12:54 +0000 (11:12 +0800)]
doc: fix some HTML syntax errors

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

12 years agocmd/5l: dwarf line number support for Linux/ARM
Shenghou Ma [Tue, 7 Aug 2012 02:09:24 +0000 (10:09 +0800)]
cmd/5l: dwarf line number support for Linux/ARM
   Part of issue 3747.

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

12 years agocmd/go: remove $WORK paths in generated binaries
Shenghou Ma [Tue, 7 Aug 2012 02:00:58 +0000 (10:00 +0800)]
cmd/go: remove $WORK paths in generated binaries
        Fixes #3748.

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

12 years agomath, runtime: use a NaN that matches gcc's
Shenghou Ma [Tue, 7 Aug 2012 01:57:14 +0000 (09:57 +0800)]
math, runtime: use a NaN that matches gcc's
        our old choice is not working properly at least on VFPv2 in
ARM1136JF-S (it's not preserved across float64->float32 conversions).

        Fixes #3745.

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

12 years agoruntime: remove unnecessary ROUND in alg.c
Shenghou Ma [Tue, 7 Aug 2012 01:49:56 +0000 (09:49 +0800)]
runtime: remove unnecessary ROUND in alg.c
        Introduced in CL 6452046.

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

12 years agomisc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo tests
Shenghou Ma [Tue, 7 Aug 2012 01:38:35 +0000 (09:38 +0800)]
misc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo tests
   Enhances test/run.go to support testing other directories
   Will enable stdio tests on Windows in a follow-up CL.

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

12 years agoexp/html: fix foster-parenting when elements are implicitly closed
Andrew Balholm [Mon, 6 Aug 2012 23:35:09 +0000 (09:35 +1000)]
exp/html: fix foster-parenting when elements are implicitly closed

When an element (like <nobr> or <p>) was implicitly closed by another
start tag, it would keep foster parenting from working because
the check for what was on top of the stack of open elements was
in the wrong place.

Move the check to addChild.

Pass 2 additional tests.

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

12 years agonet: fix spurious EADDRNOTAVAIL errors
Russ Cox [Mon, 6 Aug 2012 20:32:00 +0000 (16:32 -0400)]
net: fix spurious EADDRNOTAVAIL errors

R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/6443085

12 years agosyscall: fix plan9 build broken by CL 6458050
Alexey Borzenkov [Mon, 6 Aug 2012 20:24:08 +0000 (16:24 -0400)]
syscall: fix plan9 build broken by CL 6458050

R=golang-dev, rsc
CC=golang-dev, r, yarikos
https://golang.org/cl/6454104

12 years agotest/run: ignore all but .go file during compiledir action
Alex Brainman [Mon, 6 Aug 2012 04:56:39 +0000 (14:56 +1000)]
test/run: ignore all but .go file during compiledir action

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

12 years agonet: fix TCPListener file leak to child processes
Brad Fitzpatrick [Mon, 6 Aug 2012 04:12:23 +0000 (14:12 +1000)]
net: fix TCPListener file leak to child processes

Hold ForkLock during dup of fd + cloexec in the net pkg,
per the locking policy documented in syscall/exec_unix.go.

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

12 years agosyscall: return EINVAL when string arguments have NUL characters
Alexey Borzenkov [Sun, 5 Aug 2012 21:24:32 +0000 (17:24 -0400)]
syscall: return EINVAL when string arguments have NUL characters

Since NUL usually terminates strings in underlying syscalls, allowing
it when converting string arguments is a security risk, especially
when dealing with filenames. For example, a program might reason that
filename like "/root/..\x00/" is a subdirectory or "/root/" and allow
access to it, while underlying syscall will treat "\x00" as an end of
that string and the actual filename will be "/root/..", which might
be unexpected. Returning EINVAL when string arguments have NUL in
them makes sure this attack vector is unusable.

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

12 years agosyscall: add some new syscall numbers from NetBSD-current
Benny Siegert [Sun, 5 Aug 2012 21:02:41 +0000 (17:02 -0400)]
syscall: add some new syscall numbers from NetBSD-current

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

12 years agoruntime: faster string equality.
Rémy Oudompheng [Sun, 5 Aug 2012 19:35:41 +0000 (21:35 +0200)]
runtime: faster string equality.

benchmark                                old ns/op    new ns/op    delta
BenchmarkCompareStringEqual                     51           35  -30.20%
BenchmarkCompareStringIdentical                 51            7  -85.71%
BenchmarkCompareStringSameLength                25           18  -28.29%
BenchmarkCompareStringDifferentLength            2            2   +1.46%

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

12 years agomisc/dashboard/codereview: show first line of last message in thread
Russ Cox [Sun, 5 Aug 2012 18:35:35 +0000 (14:35 -0400)]
misc/dashboard/codereview: show first line of last message in thread

This line helps me to tell whether the CL is waiting for me or I'm waiting for the author.

Also:
 - vertical-align table cells so buttons are always aligned with CL headers.
 - add email= to show front page for someone else.

 Demo at http://rsc.gocodereview.appspot.com/.
 Until this is deployed for real, some recently changed CLs may be
 missing the 'first line of last message' part.

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

12 years agobufio: discourage use of ReadLine
Russ Cox [Sun, 5 Aug 2012 18:32:09 +0000 (14:32 -0400)]
bufio: discourage use of ReadLine

Too many people use it without reading what it does.
Those people want ReadBytes or ReadString.

Fixes #3906.

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

12 years agostrconv: speedup AppendFloat/FormatFloat.
Rémy Oudompheng [Sun, 5 Aug 2012 18:30:13 +0000 (20:30 +0200)]
strconv: speedup AppendFloat/FormatFloat.

The improvement is obtained by eliminating the zero
initialization of a large structure that is only
needed when the fast path fails.

Also add a missing roundtrip test for float32s.

benchmark                              old ns/op    new ns/op    delta
BenchmarkAppendFloatDecimal                  301          180  -40.20%
BenchmarkAppendFloat                         486          388  -20.16%
BenchmarkAppendFloatExp                      492          383  -22.15%
BenchmarkAppendFloatNegExp                   478          370  -22.59%
BenchmarkAppendFloatBig                      650          541  -16.77%
BenchmarkAppendFloat32Integer                308          180  -41.56%
BenchmarkAppendFloat32ExactFraction          449          333  -25.84%
BenchmarkAppendFloat32Point                  494          390  -21.05%
BenchmarkAppendFloat32Exp                    488          387  -20.70%
BenchmarkAppendFloat32NegExp                 488          378  -22.54%

R=r, rsc
CC=golang-dev, remy
https://golang.org/cl/6346081

12 years agoexp/html: don't treat SVG <title> like HTML <title>
Andrew Balholm [Sun, 5 Aug 2012 12:32:35 +0000 (22:32 +1000)]
exp/html: don't treat SVG <title> like HTML <title>

The content of an HTML <title> element is RCDATA, but the content of an SVG
<title> element is parsed as tags. Now the parser doesn't go into RCDATA
mode in foreign content.

Pass 4 additional tests.

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

12 years agocmd/go: allow to use syso files with cgo
Dmitriy Vyukov [Sat, 4 Aug 2012 15:02:12 +0000 (18:02 +0300)]
cmd/go: allow to use syso files with cgo
I have C functions implemented in .syso file (rather than .so or inlined in .go file).
W/o this change the gcc invocation fails with undefined symbols.

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

12 years agocmd/cc: allow to call nested packages from within C code
Dmitriy Vyukov [Sat, 4 Aug 2012 12:11:53 +0000 (16:11 +0400)]
cmd/cc: allow to call nested packages from within C code
E.g. sync/atomic.LoadInt32() can be called as sync»atomic·LoadInt32()

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

12 years agocmd/go, go/build, misc/swig: add SWIG support to Go tool
Ian Lance Taylor [Sat, 4 Aug 2012 01:08:43 +0000 (18:08 -0700)]
cmd/go, go/build, misc/swig: add SWIG support to Go tool

R=adg, rsc, franciscossouza, seb.binet, gen.battle
CC=golang-dev
https://golang.org/cl/5845071

12 years ago5a, 5l, math: Add support for ABSD, ABSF floating point instructions.
Michał Derkacz [Fri, 3 Aug 2012 20:15:11 +0000 (16:15 -0400)]
5a, 5l, math: Add support for ABSD, ABSF floating point instructions.

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

12 years agocmd/8g: fix miscompilation due to BADWIDTH.
Rémy Oudompheng [Fri, 3 Aug 2012 20:05:51 +0000 (22:05 +0200)]
cmd/8g: fix miscompilation due to BADWIDTH.

Fixes #3899.

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

12 years agocmd/gc: accept switches on comparable arrays.
Rémy Oudompheng [Fri, 3 Aug 2012 19:47:26 +0000 (21:47 +0200)]
cmd/gc: accept switches on comparable arrays.

The compiler is incorrectly rejecting switches on arrays of
comparable types. It also doesn't catch incomparable structs
when typechecking the switch, leading to unreadable errors
during typechecking of the generated code.

Fixes #3894.

R=rsc
CC=gobot, golang-dev, r, remy
https://golang.org/cl/6442074

12 years agocrypto/elliptic: explicitly handle P+P, ∞+P and P+∞
Adam Langley [Fri, 3 Aug 2012 19:42:14 +0000 (15:42 -0400)]
crypto/elliptic: explicitly handle P+P, ∞+P and P+∞

These aren't needed for scalar multiplication, but since we export a
generic Add function we should handle it.

This change also corrects two bugs in p224Contract that it turned up.

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

12 years agocmd/ld: add PT_PAX_FLAGS ELF header
Russ Cox [Fri, 3 Aug 2012 19:27:35 +0000 (15:27 -0400)]
cmd/ld: add PT_PAX_FLAGS ELF header

PAX systems are Linux systems that are more paranoid about memory permissions.
These flags tell them to relax when running Go binaries.

Fixes #47.

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

12 years agodebug/elf: Add support for getting DynTag string table values.
Mike Rosset [Fri, 3 Aug 2012 18:46:20 +0000 (14:46 -0400)]
debug/elf: Add support for getting DynTag string table values.

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

12 years agogo/build: tiny cleanup
Robert Griesemer [Fri, 3 Aug 2012 17:45:02 +0000 (10:45 -0700)]
go/build: tiny cleanup

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

12 years agocrypto/tls: remove flakey tests
Adam Langley [Fri, 3 Aug 2012 17:28:05 +0000 (13:28 -0400)]
crypto/tls: remove flakey tests

This removes some (non-short only) tests that involved connections to
the outside world and thus were flakey. This does remove some test
coverage of the root fetchers on non-Windows platforms, but the right
place for that is crypto/x509.

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

12 years agocrypto/x509: support ECDSA keys when generating certificates.
Adam Langley [Fri, 3 Aug 2012 14:37:30 +0000 (10:37 -0400)]
crypto/x509: support ECDSA keys when generating certificates.

We already support reading ECDSA certificates and this change adds
write support.

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

12 years agoexp/locale/collate: changed API of Builder to be more convenient
Marcel van Lohuizen [Fri, 3 Aug 2012 07:01:21 +0000 (09:01 +0200)]
exp/locale/collate: changed API of Builder to be more convenient
for dealing with CLDR files:
- Add now taxes a list of indexes of colelems that are variables. Checking and
  handling is now done by the Builder.  VariableTop is now also properly generated
  using the Build method.
- Introduced separate Builder, called Tailoring, for creating tailorings of root
  table.  This clearly separates the functionality for building a table based on
  weights (the allkeys* files) versus tables based on LDML XML files.
- Tailorings are now added by two calls instead of one: SetAnchor and Insert.
  This more closely reflects the structure of LDML side and simplifies the
  implementation of both the client and library side.  It also preserves
  some information that is otherwise hard to recover for the Builder.
- Allow the LDML XML element extend to be passed to Insert.  This simplifies
  both client and library implementation.

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

12 years agoos: test that IsExist and IsNotExist handle PathError and LinkError
Alex Brainman [Fri, 3 Aug 2012 04:25:35 +0000 (14:25 +1000)]
os: test that IsExist and IsNotExist handle PathError and LinkError

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

12 years agogo/scanner: fix minor typo
Robert Griesemer [Fri, 3 Aug 2012 00:10:41 +0000 (17:10 -0700)]
go/scanner: fix minor typo

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

12 years agogo/ast: ast.Print must not crash with unexported fields
Robert Griesemer [Fri, 3 Aug 2012 00:05:51 +0000 (17:05 -0700)]
go/ast: ast.Print must not crash with unexported fields

Don't print unexported struct fields; their values are
not accessible via reflection.

Fixes #3898.

Also:
- added support for arrays
- print empty maps, arrays, slices, structs on one line
  for a denser output
- added respective test cases

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

12 years agoexp/html: in parse tests, discard only one trailing newline
Andrew Balholm [Thu, 2 Aug 2012 23:31:45 +0000 (09:31 +1000)]
exp/html: in parse tests, discard only one trailing newline

Pass 2 additional tests.

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

12 years agohtml: make the low-level tokenizer also skip end-tag attributes.
Nigel Tao [Thu, 2 Aug 2012 23:29:16 +0000 (09:29 +1000)]
html: make the low-level tokenizer also skip end-tag attributes.

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

12 years agoexp/types: set non-embedded method type during GcImport.
Rémy Oudompheng [Thu, 2 Aug 2012 23:24:09 +0000 (16:24 -0700)]
exp/types: set non-embedded method type during GcImport.

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

12 years agoexp/types: enable cycle checks again
Robert Griesemer [Wed, 1 Aug 2012 23:37:06 +0000 (16:37 -0700)]
exp/types: enable cycle checks again

Process a package's object in a reproducible
order (rather then in map order) so that we
get error messages in reproducible order.

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

12 years agoexp/html: implement escaping and double-escaping in scripts
Andrew Balholm [Wed, 1 Aug 2012 04:45:35 +0000 (14:45 +1000)]
exp/html: implement escaping and double-escaping in scripts

The text inside <script> tags is not ordinary raw text; there are all sorts
of other complications. This CL implements those complications.

Pass 76 additional tests.

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

12 years agotest/run.go: fix compiledir test on windows
Shenghou Ma [Wed, 1 Aug 2012 03:26:33 +0000 (23:26 -0400)]
test/run.go: fix compiledir test on windows
    we can't import "./bug0" on windows, as it will trigger
"import path contains invalid character ':'" error.
    instead, we pass "-D." and "-I." to gc to override this
behavior. this idea is due to remyoudompheng.

R=golang-dev, r, alex.brainman, remyoudompheng
CC=golang-dev
https://golang.org/cl/6441074

12 years agoruntime: round return value address in runtime.equal
Shenghou Ma [Wed, 1 Aug 2012 03:02:46 +0000 (23:02 -0400)]
runtime: round return value address in runtime.equal
     Fixes #3866.

R=rsc, r, nigeltao
CC=golang-dev
https://golang.org/cl/6452046

12 years agoos: Rename error to fit IsExist
Alex Brainman [Wed, 1 Aug 2012 02:55:04 +0000 (12:55 +1000)]
os: Rename error to fit IsExist

Fixes #3828.

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

12 years agoexp/types: Replace String method with TypeString function
Robert Griesemer [Wed, 1 Aug 2012 02:30:18 +0000 (19:30 -0700)]
exp/types: Replace String method with TypeString function

This is more in sync with the rest of the package;
for instance, we have functions (not methods) to
deref or find the underlying type of a Type.

In the process use a single bytes.Buffer to create
the string representation for a type rather than
the (occasional) string concatenation.

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

12 years agoexp/types: implement Type.String methods for testing/debugging
Robert Griesemer [Wed, 1 Aug 2012 00:09:12 +0000 (17:09 -0700)]
exp/types: implement Type.String methods for testing/debugging

Also:
- replaced existing test with a more comprehensive test
- fixed bug in map type creation

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

12 years agoexp/html: tokenize attributes of end tags
Andrew Balholm [Tue, 31 Jul 2012 23:35:02 +0000 (09:35 +1000)]
exp/html: tokenize attributes of end tags

If an end tag has an attribute that is a quoted string containing '>',
the tokenizer would end the tag prematurely. Now it reads the attributes
on end tags just as it does on start tags, but the high-level interface
still doesn't return them, because their presence is a parse error.

Pass 1 additional test.

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

12 years agoimage/png: tRNS chunk is *non*-alpha-premultiplied.
Nigel Tao [Tue, 31 Jul 2012 23:20:44 +0000 (09:20 +1000)]
image/png: tRNS chunk is *non*-alpha-premultiplied.

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

12 years agocmd/gc: fix inlining bug with receive operator.
Rémy Oudompheng [Tue, 31 Jul 2012 22:45:26 +0000 (00:45 +0200)]
cmd/gc: fix inlining bug with receive operator.

The receive operator was given incorrect precedence
resulting in incorrect deletion of parentheses.

Fixes #3843.

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

12 years agomisc/cgo/test: fix darwin build
Mikio Hara [Tue, 31 Jul 2012 11:59:06 +0000 (20:59 +0900)]
misc/cgo/test: fix darwin build

uuid_t is defined in unistd.h on OS X, unfortunately.

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

12 years agonet: disable IPv6 multicast tests unless external IPv6 connection is present
Mikio Hara [Tue, 31 Jul 2012 11:58:35 +0000 (20:58 +0900)]
net: disable IPv6 multicast tests unless external IPv6 connection is present

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

12 years agocmd/5l, cmd/ld: add support for R_ARM_GOT_PREL
Shenghou Ma [Mon, 30 Jul 2012 22:48:00 +0000 (18:48 -0400)]
cmd/5l, cmd/ld: add support for R_ARM_GOT_PREL
Android NDK's gcc 4.6 generates this relocation for runtime/cgo.

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

12 years agocmd/cgo: use 1 as last entry for __cgodebug_data
Shenghou Ma [Mon, 30 Jul 2012 22:44:48 +0000 (18:44 -0400)]
cmd/cgo: use 1 as last entry for __cgodebug_data
        LLVM-based gcc will place all-zero data in a zero-filled
        section, but our debug/macho can't handle that.
        Fixes #3821.

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

12 years agohttputil: accumulate X-Forwarded-For header info
Bobby Powers [Mon, 30 Jul 2012 22:38:49 +0000 (08:38 +1000)]
httputil: accumulate X-Forwarded-For header info

If the X-Forwarded-For header already exists on a request, we
should append our client's IP to it after a comma+space instead
of overwriting it.

Fixes #3846.

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

12 years agotext/template/parse/lex.go: fix typo
Rob Pike [Mon, 30 Jul 2012 22:23:36 +0000 (15:23 -0700)]
text/template/parse/lex.go: fix typo

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

12 years agopkg/syscall: unexport Prlimit.
Han-Wen Nienhuys [Mon, 30 Jul 2012 22:21:24 +0000 (08:21 +1000)]
pkg/syscall: unexport Prlimit.

This syscall was inadvertently exported when fixing
Getrlimit/Setrlimit on 32-bit platforms.

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

12 years agotext/template/parse: fix data race
Rob Pike [Mon, 30 Jul 2012 22:11:20 +0000 (15:11 -0700)]
text/template/parse: fix data race
The situation only affects diagnostics but is easy to fix.
When computing lineNumber, use the position of the last item
returned by nextItem rather than the current state of the lexer.
This is internal only and does not affect the API.

Fixes #3886.

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

12 years agoregexp: fix glitch in doc for FindReaderIndex
Rob Pike [Mon, 30 Jul 2012 19:46:50 +0000 (12:46 -0700)]
regexp: fix glitch in doc for FindReaderIndex
Fixes #3878.

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

12 years agotest: add a compiledir pattern in run.go
Rémy Oudompheng [Mon, 30 Jul 2012 19:12:05 +0000 (21:12 +0200)]
test: add a compiledir pattern in run.go

The compiledir pattern compiles all files xxx.dir/*.go
in lexicographic order (which is assumed to coincide with
the topological order of dependencies).

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

12 years agomisc/dashboard/codereview: add LastUpdate field to CL
Russ Cox [Mon, 30 Jul 2012 14:13:54 +0000 (10:13 -0400)]
misc/dashboard/codereview: add LastUpdate field to CL

To be filled in by a later CL. I deployed a test version to
App Engine to work on setting the values, so there are
a few records that have this field set already.

That field is breaking the live version, so I have pushed
a new copy with this 1-line change to the live version

I assumed that appengine/datastore was like every other
marshaling and unmarshaling package we have in Go
(for example, encoding/gob, encoding/json, encoding/xml,
and protobuf) and that if it loaded an unknown field it would
just ignore it. Apparently not. Sorry.

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

12 years agocmd/gc: fix initialization order involving method calls.
Rémy Oudompheng [Mon, 30 Jul 2012 07:14:49 +0000 (09:14 +0200)]
cmd/gc: fix initialization order involving method calls.

They were previously ignored when deciding order and
detecting dependency loops.
Fixes #3824.

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

12 years agodoc: remove mention of weekly tag from source install doc
Andrew Gerrand [Mon, 30 Jul 2012 05:36:56 +0000 (15:36 +1000)]
doc: remove mention of weekly tag from source install doc

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

12 years agomisc/dashboard/codereview: pass user information to gobot when assigning reviewer.
David Symonds [Mon, 30 Jul 2012 04:41:04 +0000 (14:41 +1000)]
misc/dashboard/codereview: pass user information to gobot when assigning reviewer.

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

12 years agocmd/go: show $GOPATH in 'go env' output
Russ Cox [Mon, 30 Jul 2012 04:22:42 +0000 (00:22 -0400)]
cmd/go: show $GOPATH in 'go env' output

Also, sort output.

R=golang-dev, patrick, dave, iant
CC=golang-dev, patrick
https://golang.org/cl/6446064

12 years agomisc/dashboard/codereview: switch to using gobot to update CL reviewer info.
David Symonds [Mon, 30 Jul 2012 04:13:12 +0000 (14:13 +1000)]
misc/dashboard/codereview: switch to using gobot to update CL reviewer info.

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

12 years agomisc/dashboard/codereview: bump user-specific table limits to 100.
David Symonds [Mon, 30 Jul 2012 04:11:51 +0000 (14:11 +1000)]
misc/dashboard/codereview: bump user-specific table limits to 100.

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

12 years agonet/http: don't allow zero byte in FileServer paths
Brad Fitzpatrick [Mon, 30 Jul 2012 03:57:30 +0000 (13:57 +1000)]
net/http: don't allow zero byte in FileServer paths

Should probably be fixed in the syscall package, either
additional or instead of this CL.

Fixes #3842

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

12 years agomisc/dashboard/codereview: interpret zero reviewers as the CL being closed.
David Symonds [Mon, 30 Jul 2012 03:51:21 +0000 (13:51 +1000)]
misc/dashboard/codereview: interpret zero reviewers as the CL being closed.

This is the state when the CL has been submitted by someone other than
the CL author, but before the CL author has synched their client.

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

12 years agocmd/gc: point "no new variables" error at right line number.
Daniel Morsing [Mon, 30 Jul 2012 02:24:19 +0000 (22:24 -0400)]
cmd/gc: point "no new variables" error at right line number.

Fixes #3856.

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

12 years agomisc/dashboard/codereview: make all active CL tables hold up to 50 CLs.
David Symonds [Mon, 30 Jul 2012 01:45:17 +0000 (11:45 +1000)]
misc/dashboard/codereview: make all active CL tables hold up to 50 CLs.

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

12 years agomisc/dashboard/codereview: fix tag nesting.
David Symonds [Mon, 30 Jul 2012 01:37:20 +0000 (11:37 +1000)]
misc/dashboard/codereview: fix tag nesting.

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

12 years agomisc/dashboard/codereview: recognize "NOT LGTM".
David Symonds [Mon, 30 Jul 2012 00:54:50 +0000 (10:54 +1000)]
misc/dashboard/codereview: recognize "NOT LGTM".

A "NOT LGTM" overrules a previous "LGTM" by the same person, and vice versa.
"NOT LGTM"s are shown in the same location as LGTMs, colored red.

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

12 years agonet/http: don't modify Request Method's case
Brad Fitzpatrick [Mon, 30 Jul 2012 00:05:24 +0000 (10:05 +1000)]
net/http: don't modify Request Method's case

This fixes a data race (usually just harmlessly updating
"GET" to "GET"), but also follows RFC 2616 Sec 5.1.1 which
says that the request method is case-sensitive.

Fixes #3881

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

12 years agosyscall: apply comment from Mikioh
Russ Cox [Sun, 29 Jul 2012 23:50:23 +0000 (19:50 -0400)]
syscall: apply comment from Mikioh

This comment was suggested in CL 6456045
but never got applied.

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

12 years agosyscall: workaround accept() bug on Darwin
Alexey Borzenkov [Sun, 29 Jul 2012 23:02:24 +0000 (09:02 +1000)]
syscall: workaround accept() bug on Darwin

Darwin kernels have a bug in accept() where error result from
an internal call is not checked and socket is accepted instead
of ECONNABORTED error. However, such sockets have no sockaddr,
which results in EAFNOSUPPORT error from anyToSockaddr, making
Go http servers running on Mac OS X easily susceptible to
denial of service from simple port scans with nmap.
Fixes #3849.

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

12 years agoruntime/cgo: fix netbsd build
Benny Siegert [Sun, 29 Jul 2012 22:51:06 +0000 (18:51 -0400)]
runtime/cgo: fix netbsd build

Copy over freebsd.c to netbsd.c.

Fixes #3823.

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

12 years agomisc/vim: fix :Import insertion heuristic.
David Symonds [Sun, 29 Jul 2012 22:48:51 +0000 (08:48 +1000)]
misc/vim: fix :Import insertion heuristic.

If a factored import group has a blank line, assume it is dividing
separate groups of imports (e.g. standard library vs. site-specific).
        import (
                "bytes"
                "io"

                "mycorp/package"
        )

The most common case is inserting new standard library imports,
which are usually (stylistically) the first group, so we should drop
"net" in the above example immediately after "io".

Since this logic is getting non-trivial, add a test.

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

12 years agosyscall: don't clobber source files if mksyscall.pl fails.
Han-Wen Nienhuys [Sun, 29 Jul 2012 21:59:14 +0000 (17:59 -0400)]
syscall: don't clobber source files if mksyscall.pl fails.

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

12 years agoexp/html: replace NUL with U+FFFD in text in foreign content
Andrew Balholm [Sun, 29 Jul 2012 06:29:49 +0000 (16:29 +1000)]
exp/html: replace NUL with U+FFFD in text in foreign content

Pass 5 additional tests.

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

12 years agomisc/cgo/test: only run setgid test on GNU/Linux
Ian Lance Taylor [Sat, 28 Jul 2012 17:40:51 +0000 (10:40 -0700)]
misc/cgo/test: only run setgid test on GNU/Linux

Fixes #3874.

R=golang-dev, nj, r, minux.ma
CC=golang-dev
https://golang.org/cl/6446060

12 years agoexp/locale/collate: changed trie in first step towards support for multiple locales.
Marcel van Lohuizen [Sat, 28 Jul 2012 16:44:14 +0000 (18:44 +0200)]
exp/locale/collate: changed trie in first step towards support for multiple locales.
- Allow handles into the trie for different locales.  Multiple tables share the same
  try to allow for reuse of blocks.
- Significantly improved memory footprint and reduced allocations of trieNodes.
  This speeds up generation by about 30% and allows keeping trieNodes around
  for multiple locales during generation.
- Renamed print method to fprint.

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

12 years agoflag: fix bug in handling of booleans on error
Rob Pike [Fri, 27 Jul 2012 23:13:29 +0000 (16:13 -0700)]
flag: fix bug in handling of booleans on error
Fixes #3869.

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

12 years agolog/syslog: don't append \n if there is one
Shenghou Ma [Fri, 27 Jul 2012 18:22:27 +0000 (14:22 -0400)]
log/syslog: don't append \n if there is one
   pkg log already appends a linefeed to the log message,
so log/syslog doesn't need to append another.

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

12 years agoos: move epipecheck from file_posix.go and into file_unix.go to fix windows build
Alex Brainman [Fri, 27 Jul 2012 12:21:33 +0000 (22:21 +1000)]
os: move epipecheck from file_posix.go and into file_unix.go to fix windows build

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

12 years agoos: fix data race in epipecheck()
Dmitriy Vyukov [Fri, 27 Jul 2012 11:05:13 +0000 (15:05 +0400)]
os: fix data race in epipecheck()
Fixes #3860.

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

12 years agomisc/cgo/test: add test for issue 3871: cgo setgid hang on GNU/Linux
Ian Lance Taylor [Fri, 27 Jul 2012 06:21:41 +0000 (23:21 -0700)]
misc/cgo/test: add test for issue 3871: cgo setgid hang on GNU/Linux

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

12 years agoexp/html: parse CDATA sections in foreign content
Andrew Balholm [Fri, 27 Jul 2012 06:05:25 +0000 (16:05 +1000)]
exp/html: parse CDATA sections in foreign content

Also convert NUL to U+FFFD in comments.

Pass 23 additional tests.

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

12 years agoruntime: ignore signal 33 == SIGSETXID on GNU/Linux
Ian Lance Taylor [Fri, 27 Jul 2012 05:46:20 +0000 (22:46 -0700)]
runtime: ignore signal 33 == SIGSETXID on GNU/Linux

When a cgo program calls setuid, setgid, etc., the GNU/Linux
pthread library sends signal SIGSETXID to each thread to tell
it to update its UID info.  If Go is permitted to intercept
the default SIGSETXID signal handler, the program will hang.

This patch tells the runtime package to not try to intercept
SIGSETXID on GNU/Linux.  This will be odd if a Go program
wants to try to use that signal, but it means that cgo
programs that call setuid, etc., won't hang.

Fixes #3871.

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

12 years agogo/printer: don't crash if ast.FuncType.Params is nil
Robert Griesemer [Fri, 27 Jul 2012 00:09:11 +0000 (17:09 -0700)]
go/printer: don't crash if ast.FuncType.Params is nil

The go/ast comment for FuncType.Params says that the field may be nil.
Make sure the printer accepts such a value. The go/parser always sets
the field (to provide parenthesis position information), but a program
creating a Go AST from scatch may not.

Added corresponding test case.

Fixes #3870.

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

12 years agoexp/html: replace NUL bytes in plaintext, raw text, and RCDATA
Andrew Balholm [Thu, 26 Jul 2012 23:27:10 +0000 (09:27 +1000)]
exp/html: replace NUL bytes in plaintext, raw text, and RCDATA

If NUL bytes occur inside certain elements, convert them to U+FFFD
replacement character.

Pass 1 additional test.

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

12 years agoexp/types: process ast.Fun in checkObj; fix variadic function building
Andrew Wilkins [Thu, 26 Jul 2012 18:47:46 +0000 (11:47 -0700)]
exp/types: process ast.Fun in checkObj; fix variadic function building

Fixed creation of Func's, taking IsVariadic from parameter list rather
than results.

Updated checkObj to process ast.Fun objects.

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

12 years agoA+C: added Andrew Wilkins (individual contributor)
Robert Griesemer [Thu, 26 Jul 2012 18:47:29 +0000 (11:47 -0700)]
A+C: added Andrew Wilkins (individual contributor)

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

12 years agoexp/html: don't insert empty text nodes
Andrew Balholm [Thu, 26 Jul 2012 00:32:24 +0000 (10:32 +1000)]
exp/html: don't insert empty text nodes

Pass 1 additional test.

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

12 years agocgo: fix declarations in _cgo_export.c
Ian Lance Taylor [Wed, 25 Jul 2012 21:14:37 +0000 (14:14 -0700)]
cgo: fix declarations in _cgo_export.c

Declare crosscall2.  Declare the functions passed to it as
returning void, rather than relying on implicit return type.

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

12 years agocmd/godoc: delete -path flag
Dave Cheney [Wed, 25 Jul 2012 17:49:50 +0000 (10:49 -0700)]
cmd/godoc: delete -path flag

Fixes #3453.

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

12 years agotesting: allow concurrent use of T and B
Brad Fitzpatrick [Wed, 25 Jul 2012 17:17:27 +0000 (10:17 -0700)]
testing: allow concurrent use of T and B

Notably, allow concurrent logging and failing.

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

12 years agoexp/html: allow frameset if body contains whitespace
Andrew Balholm [Wed, 25 Jul 2012 02:09:58 +0000 (12:09 +1000)]
exp/html: allow frameset if body contains whitespace

If the body of an HTML document contains text, the <frameset> tag is
ignored. But not if the text is only whitespace.

Pass 4 additional tests.

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