]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoliblink: allow either of a pair of conflicting symbols to say dupok
Russ Cox [Thu, 19 Dec 2013 21:52:47 +0000 (16:52 -0500)]
liblink: allow either of a pair of conflicting symbols to say dupok

This makes the linker's -X flag work again.

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

11 years agonet/http: add Hihack benchmark
Brad Fitzpatrick [Thu, 19 Dec 2013 21:24:42 +0000 (13:24 -0800)]
net/http: add Hihack benchmark

Notably, to show allocs. Currently: 11766 B/op, 21 allocs/op,
at least one alloc of which is in the benchmark loop itself.

R=golang-dev, jnewlin
CC=golang-dev
https://golang.org/cl/40370057

11 years agoruntime: reduce delays in finalizer test.
Rémy Oudompheng [Thu, 19 Dec 2013 20:37:44 +0000 (21:37 +0100)]
runtime: reduce delays in finalizer test.

The runtime tests are executed 4 times in all.bash
and there is currently a 5-second delay each time.

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

11 years agoos: rename only works as part of the same directory on Plan 9
David du Colombier [Thu, 19 Dec 2013 20:20:03 +0000 (21:20 +0100)]
os: rename only works as part of the same directory on Plan 9

R=golang-dev, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/44080046

11 years agogo/build: mention 'tag' as an alias for 'build constraint'
Rob Pike [Thu, 19 Dec 2013 19:43:34 +0000 (11:43 -0800)]
go/build: mention 'tag' as an alias for 'build constraint'
The code is all about tags, and the cmd/go documentation
said to look in the go/build documentation for information
about tags, but the documentation said nothing about tags,
only build constraints. Make things clearer.

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

11 years agocrypto/x509: import crypto/sha256
Adam Langley [Thu, 19 Dec 2013 19:06:28 +0000 (14:06 -0500)]
crypto/x509: import crypto/sha256

Since SHA-256 is now the default hash function, x509 should import it
otherwise some programs may fail because it hasn't been linked in.

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

11 years agocmd/yacc: expr example support windows
ChaiShushan [Thu, 19 Dec 2013 17:14:07 +0000 (12:14 -0500)]
cmd/yacc: expr example support windows

1. expr append executable extension.
2. support '\r' character.

Fixes #6851.

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

11 years agocmd/ld: make hostobj work on newer openbsd
Joel Sing [Thu, 19 Dec 2013 16:58:27 +0000 (03:58 +1100)]
cmd/ld: make hostobj work on newer openbsd

Make hostobj work on OpenBSD 5.3/5.4/-current - these have PIE
enabled by default and linking fails since the Go linker generates
objects that are neither PIC nor PIE.

Fixes #5067

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

11 years agonet: rename TestReadConfig to TestDNSReadConfig
Mikio Hara [Thu, 19 Dec 2013 04:02:06 +0000 (13:02 +0900)]
net: rename TestReadConfig to TestDNSReadConfig

To make it possible to type "go test -run=DNS".
Also removes unnecessary parens.

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

11 years agosyscall: add NewCallbackCDecl again
Alex Brainman [Thu, 19 Dec 2013 03:38:50 +0000 (14:38 +1100)]
syscall: add NewCallbackCDecl again

Fixes #6338

R=golang-dev, kin.wilson.za, rsc
CC=golang-dev
https://golang.org/cl/36180044

11 years agoruntime/pprof: skip tests that fail on windows-amd64-race builder
Alex Brainman [Thu, 19 Dec 2013 03:15:57 +0000 (14:15 +1100)]
runtime/pprof: skip tests that fail on windows-amd64-race builder

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

11 years agocompress/flate: use io.ByteReader in docs
Brad Fitzpatrick [Thu, 19 Dec 2013 02:24:55 +0000 (18:24 -0800)]
compress/flate: use io.ByteReader in docs

We did this elsewhere when io.ByteReader was added
but forgot this one.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/43480052

11 years agoruntime: mark objects in free lists as allocated and unscannable.
Keith Randall [Thu, 19 Dec 2013 01:13:59 +0000 (17:13 -0800)]
runtime: mark objects in free lists as allocated and unscannable.

On the plus side, we don't need to change the bits when mallocing
pointerless objects.  On the other hand, we need to mark objects in the
free lists during GC.  But the free lists are small at GC time, so it
should be a net win.

benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    40           33  -17.65%
BenchmarkMalloc16                   45           38  -15.72%
BenchmarkMallocTypeInfo8            58           59   +0.85%
BenchmarkMallocTypeInfo16           63           64   +1.10%

R=golang-dev, rsc, dvyukov
CC=cshapiro, golang-dev
https://golang.org/cl/41040043

11 years agonet: don't return a nested error when happy eyeballs dialing
Mikio Hara [Thu, 19 Dec 2013 01:00:15 +0000 (10:00 +0900)]
net: don't return a nested error when happy eyeballs dialing

Also removes an unused variable.

Fixes #6795.

R=adg, dave, bradfitz, gobot
CC=golang-dev
https://golang.org/cl/29440043

11 years agoregexp: use sync.Pool
Brad Fitzpatrick [Thu, 19 Dec 2013 00:43:19 +0000 (16:43 -0800)]
regexp: use sync.Pool

For machines, not threads.

Update #4720

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

11 years agoliblink: use explicit field for globl duplicate detection
Russ Cox [Thu, 19 Dec 2013 00:36:14 +0000 (19:36 -0500)]
liblink: use explicit field for globl duplicate detection

Overloading size leads to problems if clients
try to set up an LSym by hand.

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

11 years agodebug/goobj: expand package prefix correctly
Russ Cox [Thu, 19 Dec 2013 00:00:52 +0000 (19:00 -0500)]
debug/goobj: expand package prefix correctly

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

11 years agosyscall: disallow slashes in file names on Plan 9
David du Colombier [Wed, 18 Dec 2013 23:58:23 +0000 (00:58 +0100)]
syscall: disallow slashes in file names on Plan 9

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

11 years agonet/http: use sync.Pool
Brad Fitzpatrick [Wed, 18 Dec 2013 23:52:20 +0000 (15:52 -0800)]
net/http: use sync.Pool

Update #4720

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

11 years agoencoding/json: use sync.Pool
Brad Fitzpatrick [Wed, 18 Dec 2013 23:52:05 +0000 (15:52 -0800)]
encoding/json: use sync.Pool

Benchmark is within the noise. I had to run this a dozen times
each before & after (on wall power, without a browser running)
before I could get halfway consistent numbers, and even then
they jumped all over the place, with the new one sometimes
being better. But these are the best of a dozen each.

Slowdown is expected anyway, since I imagine channels are
optimized more.

benchmark                 old ns/op    new ns/op    delta
BenchmarkCodeEncoder       26556987     27291072   +2.76%
BenchmarkEncoderEncode         1069         1071   +0.19%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkCodeEncoder          73.07        71.10    0.97x

benchmark                old allocs   new allocs    delta
BenchmarkEncoderEncode            2            2    0.00%

benchmark                 old bytes    new bytes    delta
BenchmarkEncoderEncode          221          221    0.00%

Update #4720

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

11 years agoliblink, cmd/gc: resolve several shift warnings
Dave Cheney [Wed, 18 Dec 2013 23:34:33 +0000 (10:34 +1100)]
liblink, cmd/gc: resolve several shift warnings

Address several warnings generated by clang -fsanitize=undefined

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

11 years agocmd/go: show testflag help for "go test -h"
Shenghou Ma [Wed, 18 Dec 2013 22:40:31 +0000 (17:40 -0500)]
cmd/go: show testflag help for "go test -h"
Fixes #6576.

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

11 years agonet: add test cases for the both of netgo, cgo DNS lookups
Mikio Hara [Wed, 18 Dec 2013 22:40:10 +0000 (07:40 +0900)]
net: add test cases for the both of netgo, cgo DNS lookups

Update #4078

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

11 years agoencoding/asn1: Fix parsing of non-printable strings in
Jakob Borg [Wed, 18 Dec 2013 22:06:17 +0000 (17:06 -0500)]
encoding/asn1: Fix parsing of non-printable strings in
sequences.

Use the same criteria for when to modify the tag type when
parsing a string in a sequence as when parsing a bare string
field.

Fixes #6726.

R=golang-dev, bradfitz, gobot, agl
CC=golang-dev
https://golang.org/cl/22460043

11 years agomath/rand: Float32/64 must only return values in [0,1)
Jeff R. Allen [Wed, 18 Dec 2013 20:38:53 +0000 (15:38 -0500)]
math/rand: Float32/64 must only return values in [0,1)

Float32 and Float64 are now both created by taking the ratio
of two integers which are chosen to fit entirely into the
precision of the desired float type. The previous code
could cast a Float64 with more than 23 bits of ".99999"
into a Float32 of 1.0, which is not in [0,1).

Float32 went from 15 to 21 ns/op (but is now correct).

Fixes #6721.

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

11 years agocmd/yacc: gofmt y.go
ChaiShushan [Wed, 18 Dec 2013 20:17:08 +0000 (15:17 -0500)]
cmd/yacc: gofmt y.go

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

11 years agoimage/gif: respect local color table transparency.
Nigel Tao [Wed, 18 Dec 2013 20:10:40 +0000 (15:10 -0500)]
image/gif: respect local color table transparency.

Fixes #6441.

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

11 years agocmd/6g, cmd/gc, cmd/ld: fix Plan 9 amd64 warnings
David du Colombier [Wed, 18 Dec 2013 19:20:46 +0000 (20:20 +0100)]
cmd/6g, cmd/gc, cmd/ld: fix Plan 9 amd64 warnings

warning: src/cmd/6g/reg.c:671 format mismatch d VLONG, arg 4
warning: src/cmd/gc/pgen.c:230 set and not used: oldstksize
warning: src/cmd/gc/plive.c:877 format mismatch lx UVLONG, arg 2
warning: src/cmd/gc/walk.c:2878 set and not used: cbv
warning: src/cmd/gc/walk.c:2885 set and not used: hbv
warning: src/cmd/ld/data.c:198 format mismatch s IND FUNC(IND CHAR) INT, arg 2
warning: src/cmd/ld/data.c:230 format mismatch s IND FUNC(IND CHAR) INT, arg 2
warning: src/cmd/ld/dwarf.c:1517 set and not used: pc
warning: src/cmd/ld/elf.c:1507 format mismatch d VLONG, arg 2
warning: src/cmd/ld/ldmacho.c:509 set and not used: dsymtab

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

11 years agolibmach, cmd/8l: fix Plan 9 warnings
David du Colombier [Wed, 18 Dec 2013 19:19:59 +0000 (20:19 +0100)]
libmach, cmd/8l: fix Plan 9 warnings

warning: src/libmach/sym.c:1861 non-interruptable temporary
warning: src/cmd/8l/../ld/pcln.c:29 set and not used: p

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

11 years agoliblink: fix Plan 9 warnings
David du Colombier [Wed, 18 Dec 2013 19:19:29 +0000 (20:19 +0100)]
liblink: fix Plan 9 warnings

warning: src/liblink/asm5.c:485 non-interruptable temporary
warning: src/liblink/asm5.c:565 set and not used: c
warning: src/liblink/asm5.c:622 format mismatch ux VLONG, arg 2
warning: src/liblink/asm5.c:1218 overspecified class: asmout GLOBL STATIC
warning: src/liblink/asm5.c:2088 overspecified class: oprrr GLOBL STATIC
warning: src/liblink/asm5.c:2202 overspecified class: opbra GLOBL STATIC
warning: src/liblink/asm5.c:2237 overspecified class: olr GLOBL STATIC
warning: src/liblink/asm5.c:2266 overspecified class: olhr GLOBL STATIC
warning: src/liblink/asm5.c:2291 overspecified class: osr GLOBL STATIC
warning: src/liblink/asm5.c:2302 overspecified class: oshr GLOBL STATIC
warning: src/liblink/asm5.c:2312 overspecified class: osrr GLOBL STATIC
warning: src/liblink/asm5.c:2319 overspecified class: oshrr GLOBL STATIC
warning: src/liblink/asm5.c:2325 overspecified class: olrr GLOBL STATIC
warning: src/liblink/asm5.c:2332 overspecified class: olhrr GLOBL STATIC
warning: src/liblink/asm5.c:2338 overspecified class: ofsr GLOBL STATIC
warning: src/liblink/asm5.c:2375 overspecified class: omvl GLOBL STATIC
warning: src/liblink/asm8.c:1261 format mismatch d VLONG, arg 3
warning: src/liblink/asm8.c:1274 format mismatch +d VLONG, arg 5
warning: src/liblink/list5.c:153 format mismatch d VLONG, arg 3
warning: src/liblink/list5.c:310 format mismatch d VLONG, arg 3
warning: src/liblink/obj6.c:665 set and not used: q
warning: src/liblink/pcln.c:32 set and not used: p

R=golang-dev, jas, gobot, rsc
CC=golang-dev
https://golang.org/cl/40370043

11 years agofmt: use sync.Pool
Brad Fitzpatrick [Wed, 18 Dec 2013 19:09:07 +0000 (11:09 -0800)]
fmt: use sync.Pool

Update #4720

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

11 years agosync: add Pool type
Brad Fitzpatrick [Wed, 18 Dec 2013 19:08:34 +0000 (11:08 -0800)]
sync: add Pool type

Adds the Pool type and docs, and use it in fmt.
This is a temporary implementation, until Dmitry
makes it fast.

Uses the API proposal from Russ in http://goo.gl/cCKeb2 but
adds an optional New field, as used in fmt and elsewhere.
Almost all callers want that.

Update #4720

R=golang-dev, rsc, cshapiro, iant, r, dvyukov, khr
CC=golang-dev
https://golang.org/cl/41860043

11 years agoapi: update next.txt
Brad Fitzpatrick [Wed, 18 Dec 2013 18:37:27 +0000 (10:37 -0800)]
api: update next.txt

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

11 years agoliblink: don't search for an import file with an absolute path
Ian Lance Taylor [Wed, 18 Dec 2013 18:33:47 +0000 (10:33 -0800)]
liblink: don't search for an import file with an absolute path

This restores the old behaviour, and makes it possible to
continue to use 6g and 6l directly, rather than the go tool,
with dot imports.

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

11 years agocmd/nm: minor cleanup from previous CL
Russ Cox [Wed, 18 Dec 2013 18:29:40 +0000 (13:29 -0500)]
cmd/nm: minor cleanup from previous CL

I forgot to apply Ian's suggestions before submitting CL 40600043.

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

11 years agoencoding/csv: remove unused unreadRune function
Shawn Smith [Wed, 18 Dec 2013 18:29:27 +0000 (13:29 -0500)]
encoding/csv: remove unused unreadRune function

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

11 years agohtml: add tests for UnescapeString edge cases
Shawn Smith [Wed, 18 Dec 2013 18:20:25 +0000 (10:20 -0800)]
html: add tests for UnescapeString edge cases

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

11 years agoencoding/asn1: add more test cases for BitString.At and TestUTCTime, add test for...
Shawn Smith [Wed, 18 Dec 2013 18:19:07 +0000 (10:19 -0800)]
encoding/asn1: add more test cases for BitString.At and TestUTCTime, add test for ObjectIdentifier.Equal

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

11 years agoencoding/json: add test for HTMLEscape
Shawn Smith [Wed, 18 Dec 2013 18:18:35 +0000 (10:18 -0800)]
encoding/json: add test for HTMLEscape

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

11 years agomisc/notepadplus: Fix Function List in Notepad++ 6.5
ChaiShushan [Wed, 18 Dec 2013 18:17:38 +0000 (10:17 -0800)]
misc/notepadplus: Fix Function List in Notepad++ 6.5

Since version 6.5, npp change the Function List syntax for User Defined Languages.
We need use userDefinedLangName syntax in association tag in Notepad++ 6.5.

Fix issue 6735.

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

11 years agogo/ast: added example illustrating CommentMap use.
Robert Griesemer [Wed, 18 Dec 2013 18:10:40 +0000 (10:10 -0800)]
go/ast: added example illustrating CommentMap use.

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

11 years agoencoding/ascii85: add empty string case for Encode test
Shawn Smith [Wed, 18 Dec 2013 16:33:59 +0000 (08:33 -0800)]
encoding/ascii85: add empty string case for Encode test

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

11 years agonet: test dnsconfig_unix with sample resolv.conf
Anfernee Yongkun Gui [Wed, 18 Dec 2013 16:26:36 +0000 (08:26 -0800)]
net: test dnsconfig_unix with sample resolv.conf

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

11 years agocrypto/x509: set default signature hash to SHA256 and allow override.
Adam Langley [Wed, 18 Dec 2013 15:57:56 +0000 (10:57 -0500)]
crypto/x509: set default signature hash to SHA256 and allow override.

Previously the hash used when signing an X.509 certificate was fixed
and, for RSA, it was fixed to SHA1. Since Microsoft have announced the
deprecation of SHA1 in X.509 certificates, this change switches the
default to SHA256.

It also allows the hash function to be controlled by the caller by
setting the SignatureAlgorithm field of the template.

[1] http://blogs.technet.com/b/pki/archive/2013/11/12/sha1-deprecation-policy.aspx

Fixes #5302.

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

11 years agocrypto/x509: add non-cgo darwin system anchor certs
Josh Bleecher Snyder [Wed, 18 Dec 2013 15:57:07 +0000 (10:57 -0500)]
crypto/x509: add non-cgo darwin system anchor certs

The set of certs fetched via exec'ing `security` is not quite identical
to the certs fetched via the cgo call. The cgo fetch includes
any trusted root certs that the user may have added; exec does not.
The exec fetch includes an Apple-specific root cert; the cgo fetch
does not. Other than that, they appear to be the same.

Unfortunately, os/exec depends on crypto/x509, via net/http. Break the
circular dependency by moving the exec tests to their own package.

This will not work in iOS; we'll cross that bridge when we get to it.

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

11 years agoencoding/json: speed up decoding
Brad Fitzpatrick [Wed, 18 Dec 2013 15:30:21 +0000 (07:30 -0800)]
encoding/json: speed up decoding

Don't make copies of keys while decoding, and don't use the
expensive strings.EqualFold when it's not necessary. Instead,
note in the existing field cache what algorithm to use to
check fold equality... most keys are just ASCII letters.

benchmark               old ns/op    new ns/op    delta
BenchmarkCodeDecoder    137074314    103974418  -24.15%

benchmark                old MB/s     new MB/s  speedup
BenchmarkCodeDecoder        14.16        18.66    1.32x

Update #6496

R=golang-dev, rsc, adg, r, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/13894045

11 years agoA+C: Anfernee Yongkun Gui (individual CLA)
Brad Fitzpatrick [Wed, 18 Dec 2013 12:06:56 +0000 (04:06 -0800)]
A+C: Anfernee Yongkun Gui (individual CLA)

Generated by addca.

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

11 years agolog: fix example (fix build)
Andrew Gerrand [Wed, 18 Dec 2013 06:25:23 +0000 (17:25 +1100)]
log: fix example (fix build)

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

11 years agolog: add example
ChaiShushan [Wed, 18 Dec 2013 05:24:11 +0000 (16:24 +1100)]
log: add example

Fixes #6028.

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

11 years agoA+C: Nicolas Antonius Ernst Leopold Maria Kaiser (individual CLA)
Andrew Gerrand [Wed, 18 Dec 2013 04:48:05 +0000 (15:48 +1100)]
A+C: Nicolas Antonius Ernst Leopold Maria Kaiser (individual CLA)

Generated by addca.

R=gobot, nikai
CC=golang-dev
https://golang.org/cl/43620043

11 years agoflag: remove unused FlagSet.exitOnError field
ChaiShushan [Wed, 18 Dec 2013 04:18:12 +0000 (23:18 -0500)]
flag: remove unused FlagSet.exitOnError field

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

11 years agonet: make TestDNSThreadLimit execute at the end of tests
Mikio Hara [Wed, 18 Dec 2013 04:05:47 +0000 (13:05 +0900)]
net: make TestDNSThreadLimit execute at the end of tests

Because TestDNSThreadLimit consumes tons of file descriptors and
makes other tests flaky when CGO_ENABLE=0 or being with netgo tag.

Fixes #6580.

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

11 years agoliblink: rewrite '\\' in paths to '/' on windows
Shenghou Ma [Wed, 18 Dec 2013 03:40:13 +0000 (22:40 -0500)]
liblink: rewrite '\\' in paths to '/' on windows
At least three Go tests rely on that (log, runtime/{pprof,debug}).

Fixes #6972.
Fixes #6974.
Fixes #6975.

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

11 years agoruntime: skip broken TestRuntimeGogoBytes on windows
Alex Brainman [Wed, 18 Dec 2013 03:17:47 +0000 (14:17 +1100)]
runtime: skip broken TestRuntimeGogoBytes on windows

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

11 years agocmd/go: avoid use of 'go tool pack'
Russ Cox [Wed, 18 Dec 2013 02:44:36 +0000 (21:44 -0500)]
cmd/go: avoid use of 'go tool pack'

All packages now use the -pack option to the compiler.
For a pure Go package, that's enough.
For a package with additional C and assembly files, the extra
archive entries can be added directly (by concatenation)
instead of by invoking go tool pack.

These changes make it possible to rewrite cmd/pack in Go.

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

11 years agocmd/dist: avoid use of 'go tool pack'
Russ Cox [Wed, 18 Dec 2013 02:44:18 +0000 (21:44 -0500)]
cmd/dist: avoid use of 'go tool pack'

All packages now use the -pack option to the compiler.
For a pure Go package, that's enough.
For a package with additional C and assembly files, the extra
archive entries can be added directly (by concatenation)
instead of by invoking go tool pack.

These changes make it possible to rewrite cmd/pack in Go.

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

11 years agocmd/gc: implement -pack flag
Russ Cox [Wed, 18 Dec 2013 02:43:33 +0000 (21:43 -0500)]
cmd/gc: implement -pack flag

The -pack flag causes 5g, 6g, 8g to write a Go archive directly,
instead of requiring the use of 'go tool pack' to convert the .5/.6/.8
to .a format.

Writing directly avoids the copy and also avoids having the
export data stored twice in the archive (once in __.PKGDEF,
once in .5/.6/.8).

A separate CL will enable the use of this flag by cmd/go.

Other build systems that do not know about -pack will be unaffected.

The changes to cmd/ld handle a minor simplification to the format:
an unused section is removed.

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

11 years agoruntime, gc: call interface conversion routines by reference.
Keith Randall [Wed, 18 Dec 2013 00:55:06 +0000 (16:55 -0800)]
runtime, gc: call interface conversion routines by reference.

Part of getting rid of vararg C calls.

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

11 years agonet: rewrite toLower more clearly
David du Colombier [Wed, 18 Dec 2013 00:32:27 +0000 (16:32 -0800)]
net: rewrite toLower more clearly

Rob suggested this change.

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

11 years agoruntime: don't store evacuate bit as low bit of hashtable overflow pointer.
Keith Randall [Tue, 17 Dec 2013 23:23:31 +0000 (15:23 -0800)]
runtime: don't store evacuate bit as low bit of hashtable overflow pointer.

Hash tables currently store an evacuated bit in the low bit
of the overflow pointer.  That's probably not sustainable in the
long term as GC wants correctly typed & aligned pointers.  It is
also a pain to move any of this code to Go in the current state.

This change moves the evacuated bit into the tophash entries.

Performance change is negligable.

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

11 years agodatabase/sql: Fix inaccurate comment
Marko Tiikkaja [Tue, 17 Dec 2013 22:53:31 +0000 (14:53 -0800)]
database/sql: Fix inaccurate comment

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

11 years agoreflect: Add tests for Call with functions taking and returning structs.
Michael Hudson-Doyle [Tue, 17 Dec 2013 22:49:51 +0000 (14:49 -0800)]
reflect: Add tests for Call with functions taking and returning structs.

gccgo has problems using reflect.Call with functions that take and
return structs with no members.  Prior to fixing that problem there, I
thought it sensible to add some tests of this situation.

Update #6761

First contribution to Go, apologies in advance if I'm doing it wrong.

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

11 years agoC+A: add Michael Hudson (Linaro CLA)
Brad Fitzpatrick [Tue, 17 Dec 2013 22:49:07 +0000 (14:49 -0800)]
C+A: add Michael Hudson (Linaro CLA)

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

11 years agocontainer/list: Add missing period to doc comment for Front
Caleb Spare [Tue, 17 Dec 2013 22:21:11 +0000 (14:21 -0800)]
container/list: Add missing period to doc comment for Front

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

11 years agonet: reimplement toLower to not depend on strings
David du Colombier [Tue, 17 Dec 2013 22:19:11 +0000 (14:19 -0800)]
net: reimplement toLower to not depend on strings

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

11 years agoruntime: don't crash in SetFinalizer if sizeof *x is zero
Brad Fitzpatrick [Tue, 17 Dec 2013 22:18:58 +0000 (14:18 -0800)]
runtime: don't crash in SetFinalizer if sizeof *x is zero

And document it explicitly, even though it already said
it wasn't guaranteed.

Fixes #6857

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/43580043

11 years agodatabase/sql: fix typo in comment
Arne Hormann [Tue, 17 Dec 2013 21:17:43 +0000 (08:17 +1100)]
database/sql: fix typo in comment

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

11 years agoA+C: Arne Hormann (individual CLA)
Andrew Gerrand [Tue, 17 Dec 2013 21:17:17 +0000 (08:17 +1100)]
A+C: Arne Hormann (individual CLA)

Generated by addca.

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

11 years agoos: avoid a string concat in readdir
Brad Fitzpatrick [Tue, 17 Dec 2013 20:25:32 +0000 (12:25 -0800)]
os: avoid a string concat in readdir

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/37690045

11 years agoos, path/filepath: don't ignore Lstat errors in Readdir
Brad Fitzpatrick [Tue, 17 Dec 2013 20:19:01 +0000 (12:19 -0800)]
os, path/filepath: don't ignore Lstat errors in Readdir

os: don't ignore LStat errors in Readdir. If it's ENOENT,
on the second pass, just treat it as missing. If it's another
error, it's real.

path/filepath: use ReaddirNames instead of Readdir in Walk,
in order to obey the documented WalkFunc contract of returning
each walked item's LStat error, if any.

Fixes #6656
Fixes #6680

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

11 years agodatabase/sql: fix auto-reconnect in prepared statements
Julien Schmidt [Tue, 17 Dec 2013 19:57:30 +0000 (11:57 -0800)]
database/sql: fix auto-reconnect in prepared statements

This also fixes several connection leaks.
Fixes #5718

R=bradfitz, adg
CC=alberto.garcia.hierro, golang-dev
https://golang.org/cl/14920046

11 years agoimage: roll back 13239051 (add RGB and RGB48)
Rob Pike [Tue, 17 Dec 2013 18:49:45 +0000 (10:49 -0800)]
image: roll back 13239051 (add RGB and RGB48)

They cause too much bloat in the internals as we find ourselves adding
special case code for all the cross-connections. It's better to use RGBA
and just max out the alpha. We lose a little memory but reduce the number
of special cases the encoders, decoders, and drawers need to provide.

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

11 years agold: fix Plan 9 build
David du Colombier [Tue, 17 Dec 2013 16:46:07 +0000 (08:46 -0800)]
ld: fix Plan 9 build

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

11 years agoall: add missing copyright
ChaiShushan [Tue, 17 Dec 2013 14:52:32 +0000 (06:52 -0800)]
all: add missing copyright

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

11 years agocmd/ld: maintain correct headstring needed by windows port.
Shenghou Ma [Tue, 17 Dec 2013 12:36:01 +0000 (07:36 -0500)]
cmd/ld: maintain correct headstring needed by windows port.
Fixes build for go_bootstrap.
Fixes #6971.

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

11 years agorace.bat: set exit status
Dmitriy Vyukov [Tue, 17 Dec 2013 11:09:42 +0000 (15:09 +0400)]
race.bat: set exit status

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

11 years agorace.bat: fix env setup
Dmitriy Vyukov [Tue, 17 Dec 2013 08:59:13 +0000 (12:59 +0400)]
race.bat: fix env setup

Currently it fails as:
go tool dist: $GOROOT is not set correctly or not exported
GOROOT=c:\go
c:\go\include\u.h does not exist
Fail.

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

11 years agotime: fix test error in Chinese edition of Windows
Shenghou Ma [Tue, 17 Dec 2013 07:43:14 +0000 (02:43 -0500)]
time: fix test error in Chinese edition of Windows
On the Chinese Windows XP system that I'm using, GetTimeZoneInformation returns a struct containing "中国标准时间" (China Standard Time in Chinese) in both StandardName and DaylightName (which is correct, because China does not use DST). However, in registry, under key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\China Standard Time, the key Std and Dlt contain "中国标准时间" (China Standard Time in Chinese) and "中国夏季时间" (China Summer Time in Chinese) respectively. This means that time.toEnglishName() cannot determine the abbreviation for the local timezone (CST) and causes test failures (time.Local is empty)

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

11 years agomath/rand: minor optimization to Perm
Josh Bleecher Snyder [Tue, 17 Dec 2013 02:49:34 +0000 (13:49 +1100)]
math/rand: minor optimization to Perm

Instead of writing out 0..n and then reading it
back, just use i when it is needed.

Wikipedia calls this the "inside-out" implementation:
http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

This yields identical values to the previous
implementation, given the same seed. (Note that the
output from Example_rand is unchanged.)

2.8 GHz Intel Core i7, results very stable:

benchmark          old ns/op    new ns/op    delta
BenchmarkPerm3           138          136   -1.45%
BenchmarkPerm30          825          803   -2.67%

Stock Raspberry Pi, minimum improvement out of three runs:

benchmark          old ns/op    new ns/op    delta
BenchmarkPerm3          5774         5664   -1.91%
BenchmarkPerm30        32582        29381   -9.82%

R=golang-dev, dave, mtj, adg
CC=golang-dev
https://golang.org/cl/21030043

11 years agocmd/go: set GOROOT when testing "go install cmd/fix"
Andrew Gerrand [Tue, 17 Dec 2013 01:17:56 +0000 (12:17 +1100)]
cmd/go: set GOROOT when testing "go install cmd/fix"

This particular test would never pass unless you had GOROOT set in your
environment. This changes makes the test use the baked-in GOROOT, as it
does with GOOS and GOARCH.

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

11 years agomisc/vim: use shiftwidth() instead of &sw if available.
Shenghou Ma [Tue, 17 Dec 2013 01:05:48 +0000 (20:05 -0500)]
misc/vim: use shiftwidth() instead of &sw if available.
Fixes #6841.

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

11 years agocmd/gc: fix comparison order of parameters in mpcmpfltc(a, b)
Shenghou Ma [Mon, 16 Dec 2013 21:54:10 +0000 (16:54 -0500)]
cmd/gc: fix comparison order of parameters in mpcmpfltc(a, b)
It should compare a - b to 0, not b - a to 0.
Fixes #6964.

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

11 years agodatabase/sql: Check errors in QueryRow.Scan
Marko Tiikkaja [Mon, 16 Dec 2013 20:48:35 +0000 (12:48 -0800)]
database/sql: Check errors in QueryRow.Scan

The previous coding did not correctly check for errors from the driver's
Next() or Close(), which could mask genuine errors from the database, as
witnessed in issue #6651.

Even after this change errors from Close() will be ignored if the query
returned no rows (as Rows.Next will have closed the handle already), but it
is a lot easier for the drivers to guard against that.

Fixes #6651.

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

11 years agoA+C: Marko Tiikkaja (individual CLA)
Brad Fitzpatrick [Mon, 16 Dec 2013 20:48:12 +0000 (12:48 -0800)]
A+C: Marko Tiikkaja (individual CLA)

Generated by addca.

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

11 years agonet: lookup protocol in lower-case on Plan 9
David du Colombier [Mon, 16 Dec 2013 20:00:23 +0000 (12:00 -0800)]
net: lookup protocol in lower-case on Plan 9

Protocol keywords are case-insensitive,
but the Ndb database is case-sensitive.

Also use the generic net protocol instead
of tcp in lookupHost.

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

11 years agostrings: Add example function for IndexAny
Daniel Lidén [Mon, 16 Dec 2013 18:50:56 +0000 (10:50 -0800)]
strings: Add example function for IndexAny

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

11 years agoA+C: Daniel Lidén (individual CLA)
Brad Fitzpatrick [Mon, 16 Dec 2013 18:48:51 +0000 (10:48 -0800)]
A+C: Daniel Lidén (individual CLA)

Generated by addca.

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

11 years agostrings: Add IndexFunc example
Robin Eklind [Mon, 16 Dec 2013 18:44:23 +0000 (10:44 -0800)]
strings: Add IndexFunc example

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

11 years agostrings: Update Trim example.
Robin Eklind [Mon, 16 Dec 2013 18:40:28 +0000 (10:40 -0800)]
strings: Update Trim example.

Use an input which better shows that behaviour of the function. Only leading
and trailing runes are trimed, not intermediate ones.

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

11 years agoruntime: fix test
Russ Cox [Mon, 16 Dec 2013 17:59:30 +0000 (12:59 -0500)]
runtime: fix test

Was supposed to be in the nm CL.

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

11 years agoapi: update next.txt
Brad Fitzpatrick [Mon, 16 Dec 2013 17:57:41 +0000 (09:57 -0800)]
api: update next.txt

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

11 years agodebug/goobj: add package for reading new Go object files
Russ Cox [Mon, 16 Dec 2013 17:52:21 +0000 (12:52 -0500)]
debug/goobj: add package for reading new Go object files

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

11 years agocmd/nm: reimplement in Go
Russ Cox [Mon, 16 Dec 2013 17:52:11 +0000 (12:52 -0500)]
cmd/nm: reimplement in Go

The immediate goal is to support the new object file format,
which libmach (nm's support library) does not understand.
Rather than add code to libmach or reengineer liblink to
support this new use, just write it in Go.

The C version of nm reads the Plan 9 symbol table stored in
Go binaries, now otherwise unused.

This reimplementation uses the standard symbol table for
the corresponding file format instead, bringing us one step
closer to removing the Plan 9 symbol table from Go binaries.

Tell cmd/dist not to build cmd/nm anymore.
Tell cmd/go to install cmd/nm in the tool directory.

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

11 years agocmd/ld: move instruction selection + layout into compilers, assemblers
Russ Cox [Mon, 16 Dec 2013 17:51:58 +0000 (12:51 -0500)]
cmd/ld: move instruction selection + layout into compilers, assemblers

- new object file reader/writer (liblink/objfile.c)
- remove old object file writing routines
- add pcdata iterator
- remove all trace of "line number stack" and "path fragments" from
  object files, linker (!!!)
- dwarf now writes a single "compilation unit" instead of one per package

This CL disables the check for chains of no-split functions that
could overflow the stack red zone. A future CL will attack the problem
of reenabling that check (issue 6931).

This CL is just the liblink and cmd/ld changes.
There are minor associated adjustments in CL 37030045.
Each depends on the other.

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

11 years agocmd/cc, cmd/gc: update compilers, assemblers for liblink changes
Russ Cox [Mon, 16 Dec 2013 17:51:38 +0000 (12:51 -0500)]
cmd/cc, cmd/gc: update compilers, assemblers for liblink changes

- add buffered stdout to all tools and provide to link ctxt.
- avoid extra \n before ! in .6 files written by assemblers
  (makes them match the C compilers).
- use linkwriteobj instead of linkouthist+linkwritefuncs.
- in assemblers and C compilers, record pc explicitly in Prog,
  for use by liblink.
- in C compilers, preserve jump target links.
- in Go compilers (gsubr.c) attach gotype directly to
  corresponding LSym* instead of rederiving from instruction stream.
- in Go compilers, emit just one definition for runtime.zerovalue
  from each compilation.

This CL consists entirely of small adjustments.
The heavy lifting is in CL 39680043.
Each depends on the other.

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

11 years agostrings: Add FieldsFunc example.
Robin Eklind [Mon, 16 Dec 2013 17:43:03 +0000 (09:43 -0800)]
strings: Add FieldsFunc example.

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

11 years agodoc/install-source.html: mention make.bash to skip tests
Shenghou Ma [Mon, 16 Dec 2013 02:03:12 +0000 (21:03 -0500)]
doc/install-source.html: mention make.bash to skip tests

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

11 years agounicode/utf16: add explicit test for decoding invalid runes.
Dave Cheney [Mon, 16 Dec 2013 01:35:25 +0000 (12:35 +1100)]
unicode/utf16: add explicit test for decoding invalid runes.

The EncodeRune test exercises DecodeRune, but only for runes that it can encode. Add an explicit test for invalid utf16 surrogate pairs.

Bonus: coverage is now 100%

unicode/utf16/utf16.go: IsSurrogate     100.0%
unicode/utf16/utf16.go: DecodeRune      100.0%
unicode/utf16/utf16.go: EncodeRune      100.0%
unicode/utf16/utf16.go: Encode          100.0%
unicode/utf16/utf16.go: Decode          100.0%
total:                  (statements)    100.0%

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

11 years agounicode/utf16: add explicit tests for IsSurrogate
Dave Cheney [Mon, 16 Dec 2013 00:15:23 +0000 (11:15 +1100)]
unicode/utf16: add explicit tests for IsSurrogate

Update #6956

Add tests for IsSurrogate.

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

11 years agodoc/articles/wiki: remove GNU make dependency
Aram Hăvărneanu [Sun, 15 Dec 2013 22:51:03 +0000 (17:51 -0500)]
doc/articles/wiki: remove GNU make dependency

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