]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agocrypto/openpgp: fixed dangerous use of for loop variable
Gideon Jan-Wessel Redelinghuys [Thu, 7 Jul 2011 00:49:03 +0000 (10:49 +1000)]
crypto/openpgp: fixed dangerous use of for loop variable

In function readSignedMessage a pointer to for loop variable 'key' was incorrectly being assigned
to md.SignedBy. Changed so that md.SignedBy is pointing to the 'more correct' memory position.

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

13 years agoC+A: Gideon Jan-Wessel Redelinghuys
Rob Pike [Thu, 7 Jul 2011 00:46:54 +0000 (10:46 +1000)]
C+A: Gideon Jan-Wessel Redelinghuys

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

13 years agosyscall: rearrange windows code so 386 and amd64 can share files
Alex Brainman [Thu, 7 Jul 2011 00:40:45 +0000 (10:40 +1000)]
syscall: rearrange windows code so 386 and amd64 can share files

R=golang-dev, r
CC=golang-dev, vcc.163
https://golang.org/cl/4641093

13 years agoCONTRIBUTORS: add Google contributor mpvl@golang.org
Rob Pike [Thu, 7 Jul 2011 00:35:37 +0000 (10:35 +1000)]
CONTRIBUTORS: add Google contributor mpvl@golang.org

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

13 years agoexp/template: index: forgot the always last-to-arrive uintptr.
Rob Pike [Wed, 6 Jul 2011 21:00:48 +0000 (07:00 +1000)]
exp/template: index: forgot the always last-to-arrive uintptr.

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

13 years agoasn1: support T61 and UTF8 string.
Adam Langley [Wed, 6 Jul 2011 20:25:44 +0000 (16:25 -0400)]
asn1: support T61 and UTF8 string.

There is no end to the kitchen sink of string types in ASN.1.

Fixes #1953.

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

13 years agocrypto/tls: fix generate_cert.go
Adam Langley [Wed, 6 Jul 2011 20:22:21 +0000 (16:22 -0400)]
crypto/tls: fix generate_cert.go

Fixes #2030.

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

13 years agojson: fix test if rand returns 0.
Ian Lance Taylor [Wed, 6 Jul 2011 20:00:54 +0000 (13:00 -0700)]
json: fix test if rand returns 0.

Fixes test when run with gccgo using optimization, which
changes the order of the calls to rand.

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

13 years agoexp/template: index function for arrays, slices, and maps.
Rob Pike [Wed, 6 Jul 2011 12:27:06 +0000 (22:27 +1000)]
exp/template: index function for arrays, slices, and maps.

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

13 years agoexp/template: silence test noise (but add a flag to put it back)
Rob Pike [Wed, 6 Jul 2011 07:46:36 +0000 (17:46 +1000)]
exp/template: silence test noise (but add a flag to put it back)
Also delete a TODO and clean up a little evaluation code.

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

13 years agoexp/template: add a JavaScript escaper.
David Symonds [Wed, 6 Jul 2011 06:51:49 +0000 (16:51 +1000)]
exp/template: add a JavaScript escaper.

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

13 years agoexp/template: allow an empty interface value to be the target of range, etc.
Rob Pike [Wed, 6 Jul 2011 06:40:46 +0000 (16:40 +1000)]
exp/template: allow an empty interface value to be the target of range, etc.
We extract the concrete value inside.

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

13 years agoexp/template: improve error message for non-exported field.
Rob Pike [Wed, 6 Jul 2011 05:56:39 +0000 (15:56 +1000)]
exp/template: improve error message for non-exported field.

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

13 years agomaketables: update debugging data.
Rob Pike [Wed, 6 Jul 2011 05:35:23 +0000 (15:35 +1000)]
maketables: update debugging data.
This is unused in the generation of the tables, but was incorrect if we ever needed it.
Also update the reference to the document.

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

13 years agoexp/template: add missing dotNode case.
David Symonds [Wed, 6 Jul 2011 05:14:10 +0000 (15:14 +1000)]
exp/template: add missing dotNode case.

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

13 years agoexp/template: fixes and updates.
Rob Pike [Wed, 6 Jul 2011 04:46:41 +0000 (14:46 +1000)]
exp/template: fixes and updates.
- fix line numbers - forgot to update state.line during execution
- add a comment convention {{/* comment */}}
- set.Template returns the named template in the set
- set.Execute executes the named template in the set
- use a local methodByName so this package can be used with earlier release of reflect.
- use initial cap to detect exported names

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

13 years agoexp/template: remove debugging dreg.
David Symonds [Wed, 6 Jul 2011 04:18:46 +0000 (14:18 +1000)]
exp/template: remove debugging dreg.

R=r, gri
TBR=r
CC=golang-dev
https://golang.org/cl/4671047

13 years agohtml: parse start tags that aren't explicitly otherwise dealt with.
Yasuhiro Matsumoto [Wed, 6 Jul 2011 03:08:52 +0000 (13:08 +1000)]
html: parse start tags that aren't explicitly otherwise dealt with.

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

13 years agoexp/template: remove the need for a goroutine.
Rob Pike [Wed, 6 Jul 2011 01:02:53 +0000 (11:02 +1000)]
exp/template: remove the need for a goroutine.

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

13 years agoexp/template: remove the visibility of the token channel from the parser.
Rob Pike [Wed, 6 Jul 2011 00:13:53 +0000 (10:13 +1000)]
exp/template: remove the visibility of the token channel from the parser.

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

13 years agogc: fix %N for OGOTO nodes.
Luuk van Dijk [Tue, 5 Jul 2011 22:02:03 +0000 (00:02 +0200)]
gc: fix %N for OGOTO nodes.

6g -W crashed on any source with a goto. this fixes that.

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

13 years agoexp/template: add templates to sets; boolean logic.
Rob Pike [Tue, 5 Jul 2011 07:05:15 +0000 (17:05 +1000)]
exp/template: add templates to sets; boolean logic.

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

13 years agogodoc: ignore directories that begin with '.'
Andrew Gerrand [Tue, 5 Jul 2011 07:00:18 +0000 (17:00 +1000)]
godoc: ignore directories that begin with '.'

Fixes #2017.

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

13 years agoexp/template: statically check that functions names have been defined.
Rob Pike [Tue, 5 Jul 2011 06:02:34 +0000 (16:02 +1000)]
exp/template: statically check that functions names have been defined.

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

13 years agoos: fix build for Plan 9
Fazlul Shahriar [Tue, 5 Jul 2011 06:01:29 +0000 (16:01 +1000)]
os: fix build for Plan 9

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

13 years agoexp/template: add an html escaping function.
Rob Pike [Tue, 5 Jul 2011 05:58:54 +0000 (15:58 +1000)]
exp/template: add an html escaping function.

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

13 years agoimage: add a test for filling sub-images.
Nigel Tao [Tue, 5 Jul 2011 04:42:31 +0000 (14:42 +1000)]
image: add a test for filling sub-images.

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

13 years agoexp/template: functions
Rob Pike [Tue, 5 Jul 2011 04:23:51 +0000 (14:23 +1000)]
exp/template: functions
Add the ability to attach functions to template and template sets.
Make variadic functions and methods work.
Still to come: static checking of function names during parse.

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

13 years agodocs: fold the prog.sh scripting from makehtml into htmlgen itself.
Rob Pike [Mon, 4 Jul 2011 06:15:14 +0000 (16:15 +1000)]
docs: fold the prog.sh scripting from makehtml into htmlgen itself.
This allows us to drop some crufty scripting and provides a firmer
footing for building better tools for preparing documents with source
code inside.

Also eliminate line numbers from the examples and text.

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

13 years agogoinstall: only report successfully-installed packages to the dashboard
Andrew Gerrand [Mon, 4 Jul 2011 06:05:11 +0000 (16:05 +1000)]
goinstall: only report successfully-installed packages to the dashboard

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

13 years agoexp/template: add template sets, allowing templates to reference one another
Rob Pike [Mon, 4 Jul 2011 05:15:47 +0000 (15:15 +1000)]
exp/template: add template sets, allowing templates to reference one another

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

13 years agoexp/template: allow complex numbers, add 'with', 'define', and 'template' keywords.
Rob Pike [Mon, 4 Jul 2011 01:50:35 +0000 (11:50 +1000)]
exp/template: allow complex numbers, add 'with', 'define', and 'template' keywords.
Also simplify the handling of keywords.

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

13 years agoreflect: allow Len on String values.
Rob Pike [Mon, 4 Jul 2011 01:45:31 +0000 (11:45 +1000)]
reflect: allow Len on String values.
It's probably just an oversight that it doesn't work,
perhaps caused by analogy with Cap.

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

13 years agogo/build: evaluate symlinks before comparing path to GOPATH
Andrew Gerrand [Mon, 4 Jul 2011 00:26:03 +0000 (10:26 +1000)]
go/build: evaluate symlinks before comparing path to GOPATH

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

13 years agogodoc: search GOPATH for documentation
Andrew Gerrand [Sat, 2 Jul 2011 04:07:06 +0000 (14:07 +1000)]
godoc: search GOPATH for documentation

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

13 years agogoinstall: documentation for new remote repository behavior and tweaks
Andrew Gerrand [Sat, 2 Jul 2011 04:05:43 +0000 (14:05 +1000)]
goinstall: documentation for new remote repository behavior and tweaks

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

13 years agodashboard: show build state and package comments on dashboard
Andrew Gerrand [Sat, 2 Jul 2011 04:02:42 +0000 (14:02 +1000)]
dashboard: show build state and package comments on dashboard

This permits full URLs to be shown on the dashboard,
not just the repository roots.

This has been tested.

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

13 years agocrypto/openpgp: add ability to reserialize keys.
Adam Langley [Fri, 1 Jul 2011 17:53:12 +0000 (13:53 -0400)]
crypto/openpgp: add ability to reserialize keys.

This changes Signature so that parsed signatures can be reserialized
exactly. With this ability we can add Serialize to Entity and also the
ability to sign other public keys.

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

13 years agocsv: new package
Paul Borman [Fri, 1 Jul 2011 16:16:56 +0000 (12:16 -0400)]
csv: new package

csv reader/writer based on RFC 4180

R=rsc, mattn.jp, r, dchest
CC=golang-dev
https://golang.org/cl/4629085

13 years agoCONTRIBUTORS: add Paul Borman (Google CLA)
Russ Cox [Fri, 1 Jul 2011 16:09:53 +0000 (12:09 -0400)]
CONTRIBUTORS: add Paul Borman (Google CLA)

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

13 years ago5c, 6c: fix build
Russ Cox [Fri, 1 Jul 2011 15:13:38 +0000 (11:13 -0400)]
5c, 6c: fix build

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

13 years agolib9: stop build if ../version.bash fails
Alex Brainman [Fri, 1 Jul 2011 14:42:25 +0000 (10:42 -0400)]
lib9: stop build if ../version.bash fails

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

13 years agowindows: define and use syscall.Handle
Wei Guangjing [Fri, 1 Jul 2011 14:18:07 +0000 (10:18 -0400)]
windows: define and use syscall.Handle
Fixes #1487.

R=rsc, alex.brainman, go.peter.90, mikioh.mikioh, mattn.jp
CC=golang-dev
https://golang.org/cl/4600042

13 years agocmd/goinstall: try to access via https.
Yasuhiro Matsumoto [Fri, 1 Jul 2011 14:11:33 +0000 (10:11 -0400)]
cmd/goinstall: try to access via https.

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

13 years ago8c: fixes for Plan 9 build
Lucio De Re [Fri, 1 Jul 2011 13:50:24 +0000 (09:50 -0400)]
8c: fixes for Plan 9 build

8c/gc.h:
. Added <u.h> header.
. Added "lD" pragma for "*Adr" to supplement "D".

8c/swt.c:
. Removed unreferenced "thestring" arguments in Bprint() calls.

cc/acid.c:
cc/com.c:
cc/com64.c:
cc/dcl.c:
cc/scon.c:
. Added <u.h>, required by "cc.h".

cc/bits.c:
. Added <u.h>, required by "cc.h".

cc/cc.h:
. Removed <u.h> and <ctype.h>.
. Added "O" pragma to accept "uint" as well as "int".
. Added new "U" pragma (char *).

cc/cc.y:
. Added <u.h> before <stdio.h> (and "cc.h").

cc/dpchk.c:
cc/mac.c:
. Added <u.h> and <ctype.h>.

cc/funct.c:
. Added <u.h>, required by "cc.h".

cc/godefs.c
. Added <u.h>, required by "cc.h".
. Dropped unused "t" argument in Bprint().

cc/lex.c:
. Added <u.h> and <ctype.h>.
. Removed unnecessary incrementation.
. Changed exit() invocations with exits().

cc/omachcap.c:
. Added <u.h>, required by "cc.h".
. USED(n) for unused argument to machcap().

cc/sub.c:
. Added <u.h> and <ctype.h>.

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

13 years agofix build; add simplify.go to regexp Makefile
Brad Fitzpatrick [Thu, 30 Jun 2011 17:45:36 +0000 (10:45 -0700)]
fix build; add simplify.go to regexp Makefile

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

13 years agohttp/cgi: add Handler.Dir to specify working directory
Yasuhiro Matsumoto [Thu, 30 Jun 2011 16:44:23 +0000 (09:44 -0700)]
http/cgi: add Handler.Dir to specify working directory

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

13 years agosync: improve Mutex to allow successive acquisitions
Dmitriy Vyukov [Thu, 30 Jun 2011 15:13:29 +0000 (11:13 -0400)]
sync: improve Mutex to allow successive acquisitions
This implementation allows a goroutine to do successive acquisitions
of a mutex even if there are blocked goroutines.
Moreover, it allows a newcomer goroutine to acquire a mutex ahead of
blocked goroutines (that is, it does not enforce FIFO).
On implementation level it's achieved by separating waiter count and
locked flag.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows (with 4631059 "replace Semacquire/Semrelease implementation"
patch applied):
benchmark                                        old ns/op    new ns/op    delta
sync_test.BenchmarkMutexUncontended                  24.10        25.40   +5.39%
sync_test.BenchmarkMutexUncontended-2                12.00        13.00   +8.33%
sync_test.BenchmarkMutexUncontended-4                 6.06         6.83  +12.71%
sync_test.BenchmarkMutexUncontended-8                 3.63         3.60   -0.83%
sync_test.BenchmarkMutexUncontended-16                2.38         2.49   +4.62%

sync_test.BenchmarkMutex                             25.00        26.40   +5.60%
sync_test.BenchmarkMutex-2                          231.00        49.00  -78.79%
sync_test.BenchmarkMutex-4                          259.00       114.00  -55.98%
sync_test.BenchmarkMutex-8                          641.00       110.00  -82.84%
sync_test.BenchmarkMutex-16                        1380.00        96.30  -93.02%

sync_test.BenchmarkMutexSlack                        24.80        26.20   +5.65%
sync_test.BenchmarkMutexSlack-2                     210.00       106.00  -49.52%
sync_test.BenchmarkMutexSlack-4                     453.00       119.00  -73.73%
sync_test.BenchmarkMutexSlack-8                    1024.00       105.00  -89.75%
sync_test.BenchmarkMutexSlack-16                   1291.00        91.90  -92.88%

sync_test.BenchmarkMutexWork                        796.00       796.00   +0.00%
sync_test.BenchmarkMutexWork-2                      399.00       401.00   +0.50%
sync_test.BenchmarkMutexWork-4                      216.00       212.00   -1.85%
sync_test.BenchmarkMutexWork-8                     1547.00       196.00  -87.33%
sync_test.BenchmarkMutexWork-16                    2754.00       287.00  -89.58%

sync_test.BenchmarkMutexWorkSlack                   792.00       800.00   +1.01%
sync_test.BenchmarkMutexWorkSlack-2                 430.00       420.00   -2.33%
sync_test.BenchmarkMutexWorkSlack-4                 467.00       230.00  -50.75%
sync_test.BenchmarkMutexWorkSlack-8                1860.00       273.00  -85.32%
sync_test.BenchmarkMutexWorkSlack-16               3029.00       294.00  -90.29%

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

13 years agoexp/regexp/syntax: finish Regexp manipulation
Russ Cox [Thu, 30 Jun 2011 14:26:22 +0000 (10:26 -0400)]
exp/regexp/syntax: finish Regexp manipulation

Except for the inevitable bug fixes, the Regexp code is done.

R=sam.thorogood, r
CC=golang-dev
https://golang.org/cl/4635082

13 years agogovet: automate test
Russ Cox [Thu, 30 Jun 2011 14:26:11 +0000 (10:26 -0400)]
govet: automate test

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

13 years agohtml: fix nesting when parsing a close tag.
Yasuhiro Matsumoto [Thu, 30 Jun 2011 13:16:33 +0000 (23:16 +1000)]
html: fix nesting when parsing a close tag.

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

13 years agogoinstall: Add support for generic hosts using special import form
Julian Phillips [Thu, 30 Jun 2011 08:54:53 +0000 (18:54 +1000)]
goinstall: Add support for generic hosts using special import form

This change extends goinstall to support "magic" package names of the
form:
        <host>/<repo>.<vcs>/<path>

Where <host> is the hostname, <repo> the path to the repository, <vcs>
the type of vcs (git, hg, bzr or svn), and <path> is the path inside the
repository that contains the source code for the package.

For example: "example.com/pub/foo.hg/src" means download the Mercurial
repository at either pub/foo.hg or pub/foo from example.com and then
build and install the source files from src inside the repository
checkout.

Repositories on the built-in hostings sites (github, bitbucket,
launchpad and googlecode) must still use the old form (i.e.
github.com/xxx/yyy.git/src will be rejected).

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

13 years agomisc/vim: allow only utf-8 for fileencoding (fix CL4625078).
Yasuhiro Matsumoto [Thu, 30 Jun 2011 07:07:44 +0000 (17:07 +1000)]
misc/vim:  allow only utf-8 for fileencoding (fix CL4625078).

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

13 years agomisc/vim: allow only utf-8 for fileencoding.
Yasuhiro Matsumoto [Thu, 30 Jun 2011 06:19:53 +0000 (16:19 +1000)]
misc/vim: allow only utf-8 for fileencoding.

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

13 years agobuild: make version.bash aware of branches
Andrew Gerrand [Thu, 30 Jun 2011 05:39:00 +0000 (15:39 +1000)]
build: make version.bash aware of branches

Fixes #2026.

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

13 years agonet: break up and simplify Dial a bit
Brad Fitzpatrick [Thu, 30 Jun 2011 04:56:13 +0000 (21:56 -0700)]
net: break up and simplify Dial a bit

No API or functional change.

R=jacek.masiulaniec, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/4630081

13 years agotime: zero-pad two-digit years.
Rob Pike [Thu, 30 Jun 2011 04:05:29 +0000 (14:05 +1000)]
time: zero-pad two-digit years.
Fixes #2024

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

13 years agoos: use a different symbol from syscall in mkunixsignals.sh.
David Symonds [Thu, 30 Jun 2011 03:35:40 +0000 (13:35 +1000)]
os: use a different symbol from syscall in mkunixsignals.sh.

Open is more likely to be present than Syscall.

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

13 years agohttp: document that ServerConn and ClientConn are low-level
Brad Fitzpatrick [Thu, 30 Jun 2011 01:23:38 +0000 (18:23 -0700)]
http: document that ServerConn and ClientConn are low-level

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

13 years agotag release.r58
Andrew Gerrand [Wed, 29 Jun 2011 23:59:44 +0000 (09:59 +1000)]
tag release.r58

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

13 years agodocument release.r58
Andrew Gerrand [Wed, 29 Jun 2011 23:45:10 +0000 (09:45 +1000)]
document release.r58

R=rsc, r, bsiegert
CC=golang-dev
https://golang.org/cl/4643058

13 years agorun.bash: small fix
Alex Brainman [Wed, 29 Jun 2011 23:44:16 +0000 (09:44 +1000)]
run.bash: small fix

Fixes #2025.

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

13 years agohttp: make NewChunkedReader public
Andrew Balholm [Wed, 29 Jun 2011 19:27:53 +0000 (12:27 -0700)]
http: make NewChunkedReader public

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

13 years agoC+A: add Andy Balholm
Brad Fitzpatrick [Wed, 29 Jun 2011 18:46:06 +0000 (11:46 -0700)]
C+A: add Andy Balholm

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

13 years agotesting: make ResetTimer not start/stop the timer
Russ Cox [Wed, 29 Jun 2011 14:26:16 +0000 (10:26 -0400)]
testing: make ResetTimer not start/stop the timer

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

13 years agoreflect: support for struct tag use by multiple packages
Russ Cox [Wed, 29 Jun 2011 13:52:34 +0000 (09:52 -0400)]
reflect: support for struct tag use by multiple packages

Each package using struct field tags assumes that
it is the only package storing data in the tag.
This CL adds support in package reflect for sharing
tags between multiple packages.  In this scheme, the
tags must be of the form

        key:"value" key2:"value2"

(raw strings help when writing that tag in Go source).

reflect.StructField's Tag field now has type StructTag
(a string type), which has method Get(key string) string
that returns the associated value.

Clients of json and xml will need to be updated.
Code that says

        type T struct {
                X int "name"
        }

should become

        type T struct {
                X int `json:"name"`  // or `xml:"name"`
        }

Use govet to identify struct tags that need to be changed
to use the new syntax.

R=r, r, dsymonds, bradfitz, kevlar, fvbommel, n13m3y3r
CC=golang-dev
https://golang.org/cl/4645069

13 years agoruntime: windows/amd64 port
Wei Guangjing [Wed, 29 Jun 2011 07:37:56 +0000 (17:37 +1000)]
runtime: windows/amd64 port

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

13 years agogofix: fixes for os/signal changes
Robert Hencke [Wed, 29 Jun 2011 06:44:47 +0000 (16:44 +1000)]
gofix: fixes for os/signal changes

Fixes #1971.

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

13 years agoregexp: document that Regexp is thread-safe.
Rob Pike [Wed, 29 Jun 2011 05:41:09 +0000 (15:41 +1000)]
regexp: document that Regexp is thread-safe.

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

13 years agoexp/template: boolean constants
Rob Pike [Wed, 29 Jun 2011 05:02:04 +0000 (15:02 +1000)]
exp/template: boolean constants

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

13 years agoexp/regexp/syntax: incremental concat, alternate
Russ Cox [Wed, 29 Jun 2011 04:55:37 +0000 (00:55 -0400)]
exp/regexp/syntax: incremental concat, alternate
Also reuse of *Regexp nodes.

I believe this is the end of the parser.
The only non-execution code that remains is
the code to expand x{3,5} into simpler operations.

R=sam.thorogood, r
CC=golang-dev
https://golang.org/cl/4629078

13 years agocodereview: restrict sync to default branch
Russ Cox [Wed, 29 Jun 2011 04:45:29 +0000 (00:45 -0400)]
codereview: restrict sync to default branch

'default' is the name of the main branch,
the one that isn't a release branch.

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

13 years agogc: fix package quoting logic
Russ Cox [Wed, 29 Jun 2011 03:58:35 +0000 (23:58 -0400)]
gc: fix package quoting logic

The decision for when to say "hash/crc32".New instead of
crc32.New in an error was double-counting imports
from different packages or indirect imports, so it was
quoting even when there was no ambiguity.

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

13 years agogob: delete some unused bits from the GobEncoder/GobDecoder code.
Rob Pike [Wed, 29 Jun 2011 03:57:59 +0000 (13:57 +1000)]
gob: delete some unused bits from the GobEncoder/GobDecoder code.

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

13 years agoexp/template: fix build
Rob Pike [Wed, 29 Jun 2011 03:55:49 +0000 (13:55 +1000)]
exp/template: fix build
wrong path in Makefile. why didn't my all.bash fail?
TBR=dsymonds

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

13 years agoexp/template: use MethodByName, add to build.
Rob Pike [Wed, 29 Jun 2011 03:44:13 +0000 (13:44 +1000)]
exp/template: use MethodByName, add to build.

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

13 years agoreflect: MethodByName
Rob Pike [Wed, 29 Jun 2011 03:11:49 +0000 (13:11 +1000)]
reflect: MethodByName
It's more common to ask for methods by name than by index, so might
as well make it easy to do so.

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

13 years agoruntime/cgo: fix build
Mikio Hara [Wed, 29 Jun 2011 02:26:31 +0000 (22:26 -0400)]
runtime/cgo: fix build

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

13 years agold: fix ELF strip by removing overlap of sections
Gustavo Niemeyer [Tue, 28 Jun 2011 21:28:30 +0000 (22:28 +0100)]
ld: fix ELF strip by removing overlap of sections

The gosymtab and gopclntab sections were pointing to the proper
data, but that data was already owned by the rodata section.
Some ELF references explicitly prohibit multiple sections from
owning the same data, and strip behaves accordingly.

The data for these sections was moved to after rodata, and the
gosymtab and gopclntab sections now own their respective ranges.

This change makes strip happy both with and without -s being
provided at link time.  Note that it won't remove these sections
because they are still allocated, and that's by design since
they are necessary at runtime for generating proper backtraces
and similar introspection operations.

Unlike the previous behavior, -s will now maintain zero-sized
gosymtab and gopclntab sections.  This makes the implementation
slightly cleaner.

Fixes #1242.

NOTE: Tested on Linux amd64/386/arm only.

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

13 years agocc: broken return is an error, not a warning
Russ Cox [Tue, 28 Jun 2011 20:00:55 +0000 (16:00 -0400)]
cc: broken return is an error, not a warning

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

13 years agoruntime: replace Semacquire/Semrelease implementation
Dmitriy Vyukov [Tue, 28 Jun 2011 19:09:53 +0000 (15:09 -0400)]
runtime: replace Semacquire/Semrelease implementation
1. The implementation uses distributed hash table of waitlists instead of a centralized one.
  It significantly improves scalability for uncontended semaphores.
2. The implementation provides wait-free fast-path for signalers.
3. The implementation uses less locks (1 lock/unlock instead of 5 for Semacquire).
4. runtime·ready() call is moved out of critical section.
5. Semacquire() does not call semwake().
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark                                        old ns/op    new ns/op    delta
runtime_test.BenchmarkSemaUncontended                58.20        36.30  -37.63%
runtime_test.BenchmarkSemaUncontended-2             199.00        18.30  -90.80%
runtime_test.BenchmarkSemaUncontended-4             327.00         9.20  -97.19%
runtime_test.BenchmarkSemaUncontended-8             491.00         5.32  -98.92%
runtime_test.BenchmarkSemaUncontended-16            946.00         4.18  -99.56%

runtime_test.BenchmarkSemaSyntNonblock               59.00        36.80  -37.63%
runtime_test.BenchmarkSemaSyntNonblock-2            167.00       138.00  -17.37%
runtime_test.BenchmarkSemaSyntNonblock-4            333.00       129.00  -61.26%
runtime_test.BenchmarkSemaSyntNonblock-8            464.00       130.00  -71.98%
runtime_test.BenchmarkSemaSyntNonblock-16          1015.00       136.00  -86.60%

runtime_test.BenchmarkSemaSyntBlock                  58.80        36.70  -37.59%
runtime_test.BenchmarkSemaSyntBlock-2               294.00       149.00  -49.32%
runtime_test.BenchmarkSemaSyntBlock-4               333.00       177.00  -46.85%
runtime_test.BenchmarkSemaSyntBlock-8               471.00       221.00  -53.08%
runtime_test.BenchmarkSemaSyntBlock-16              990.00       227.00  -77.07%

runtime_test.BenchmarkSemaWorkNonblock              829.00       832.00   +0.36%
runtime_test.BenchmarkSemaWorkNonblock-2            425.00       419.00   -1.41%
runtime_test.BenchmarkSemaWorkNonblock-4            308.00       220.00  -28.57%
runtime_test.BenchmarkSemaWorkNonblock-8            394.00       147.00  -62.69%
runtime_test.BenchmarkSemaWorkNonblock-16          1510.00       149.00  -90.13%

runtime_test.BenchmarkSemaWorkBlock                 828.00       813.00   -1.81%
runtime_test.BenchmarkSemaWorkBlock-2               428.00       436.00   +1.87%
runtime_test.BenchmarkSemaWorkBlock-4               232.00       219.00   -5.60%
runtime_test.BenchmarkSemaWorkBlock-8               392.00       251.00  -35.97%
runtime_test.BenchmarkSemaWorkBlock-16             1524.00       298.00  -80.45%

sync_test.BenchmarkMutexUncontended                  24.10        24.00   -0.41%
sync_test.BenchmarkMutexUncontended-2                12.00        12.00   +0.00%
sync_test.BenchmarkMutexUncontended-4                 6.25         6.17   -1.28%
sync_test.BenchmarkMutexUncontended-8                 3.43         3.34   -2.62%
sync_test.BenchmarkMutexUncontended-16                2.34         2.32   -0.85%

sync_test.BenchmarkMutex                             24.70        24.70   +0.00%
sync_test.BenchmarkMutex-2                          208.00        99.50  -52.16%
sync_test.BenchmarkMutex-4                         2744.00       256.00  -90.67%
sync_test.BenchmarkMutex-8                         5137.00       556.00  -89.18%
sync_test.BenchmarkMutex-16                        5368.00      1284.00  -76.08%

sync_test.BenchmarkMutexSlack                        24.70        25.00   +1.21%
sync_test.BenchmarkMutexSlack-2                    1094.00       186.00  -83.00%
sync_test.BenchmarkMutexSlack-4                    3430.00       402.00  -88.28%
sync_test.BenchmarkMutexSlack-8                    5051.00      1066.00  -78.90%
sync_test.BenchmarkMutexSlack-16                   6806.00      1363.00  -79.97%

sync_test.BenchmarkMutexWork                        793.00       792.00   -0.13%
sync_test.BenchmarkMutexWork-2                      398.00       398.00   +0.00%
sync_test.BenchmarkMutexWork-4                     1441.00       308.00  -78.63%
sync_test.BenchmarkMutexWork-8                     8532.00       847.00  -90.07%
sync_test.BenchmarkMutexWork-16                    8225.00      2760.00  -66.44%

sync_test.BenchmarkMutexWorkSlack                   793.00       793.00   +0.00%
sync_test.BenchmarkMutexWorkSlack-2                 418.00       414.00   -0.96%
sync_test.BenchmarkMutexWorkSlack-4                4481.00       480.00  -89.29%
sync_test.BenchmarkMutexWorkSlack-8                6317.00      1598.00  -74.70%
sync_test.BenchmarkMutexWorkSlack-16               9111.00      3038.00  -66.66%

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

13 years agofmt: rename errno and error to err for doc consistency
Brad Fitzpatrick [Tue, 28 Jun 2011 18:00:31 +0000 (11:00 -0700)]
fmt: rename errno and error to err for doc consistency

The public godoc looked confused. I imagine these were
written before current conventions were established.

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

13 years agoruntime/cgo: check for errors from pthread_create
Albert Strasheim [Tue, 28 Jun 2011 16:04:50 +0000 (12:04 -0400)]
runtime/cgo: check for errors from pthread_create

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

13 years agoruntime: add Semacquire/Semrelease benchmarks
Dmitriy Vyukov [Tue, 28 Jun 2011 15:15:24 +0000 (11:15 -0400)]
runtime: add Semacquire/Semrelease benchmarks

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

13 years agosync: add fast path to Once
Dmitriy Vyukov [Tue, 28 Jun 2011 13:43:01 +0000 (09:43 -0400)]
sync: add fast path to Once
The implementation does not grab the lock,
if Once is already initalized.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark                                        old ns/op    new ns/op    delta
sync_test.BenchmarkOnce                             187.00        14.00  -92.51%
sync_test.BenchmarkOnce-2                           909.00        21.40  -97.65%
sync_test.BenchmarkOnce-4                          3684.00        20.90  -99.43%
sync_test.BenchmarkOnce-8                          5987.00        23.00  -99.62%
sync_test.BenchmarkOnce-16                         5051.00        21.60  -99.57%

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

13 years agoAdd the beginnings of the template execution code. Lots still to do,
Rob Pike [Tue, 28 Jun 2011 13:04:08 +0000 (23:04 +1000)]
Add the beginnings of the template execution code.  Lots still to do,
including evaluation up the data tree (in this code all fields must be
in dot itself), plus more control structure, but the basics are in place.

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

13 years agosync: replace Mutex benchmarks
Dmitriy Vyukov [Tue, 28 Jun 2011 12:14:54 +0000 (08:14 -0400)]
sync: replace Mutex benchmarks
For both contended and uncontended case:
 - support arbitrary number of cpus (not just 2)
 - dynamic load balancing (improves stability)
 - periodic execution of Gosched() to work around non-preemptiviness
For uncontended case eliminates possible false-sharing.
For contended case includes additional variation with some
amount of local work between mutex operations.

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

13 years agoio.WriteString: if the object has a WriteString method, use it
Evan Shaw [Tue, 28 Jun 2011 06:10:39 +0000 (16:10 +1000)]
io.WriteString: if the object has a WriteString method, use it

This avoids allocation when writing to bytes.Buffers and bufio.Writers, for
example.

R=golang-dev, rsc, r, consalus, r
CC=golang-dev
https://golang.org/cl/4625068

13 years agobuilder: minor fixes
Andrew Gerrand [Tue, 28 Jun 2011 06:01:52 +0000 (16:01 +1000)]
builder: minor fixes

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

13 years agomime/multipart: parse LF-delimited messages, not just CRLF
Brad Fitzpatrick [Tue, 28 Jun 2011 04:59:51 +0000 (21:59 -0700)]
mime/multipart: parse LF-delimited messages, not just CRLF

Against the spec, but appear in the wild.

Fixes #1966

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

13 years agoexp/regexp/syntax: case-folding in character classes
Russ Cox [Tue, 28 Jun 2011 03:23:51 +0000 (23:23 -0400)]
exp/regexp/syntax: case-folding in character classes

Also fix \x{123} parsing.

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

13 years agoruntime: another attempt to allow stdcall to be used from both 386 and amd64 arch
Alex Brainman [Tue, 28 Jun 2011 02:46:16 +0000 (12:46 +1000)]
runtime: another attempt to allow stdcall to be used from both 386 and amd64 arch

R=rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4627071

13 years agocc: add two new #pragma varargck
Russ Cox [Tue, 28 Jun 2011 02:42:34 +0000 (22:42 -0400)]
cc: add two new #pragma varargck

#pragma varargck countpos f 1
says that the first argument to f is
the count of variadic arguments that follow.

#pragma varargck type f t
says that t is one of the allowed types for
a variadic argument to f.
(can be repeated)

combined, these can be used to check the
runtime.stdcall functions in the windows port
or in any other port that needs a vararg list of
uintptrs even on a 64-bit platform (where it is
very easy to pass a less-than-uintptr in the ...).

demo:

typedef unsigned int uintptr;

#pragma varargck countpos f 1
#pragma varargck type f uintptr
#pragma varargck type f void*

int f(int count, ...);

void *v;
char *p;

void
main(void)
{
        f(1, v);  // ok
        f(1, main);  // ok
        f(1, p);  // ok
        f(2, v, v);  // ok

        f(2, v);  // found 1 argument after count 2
        f(1, 'a');  // invalid type INT in call to f
        f(1, 0);  // invalid type INT in call to f
}

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

13 years agoos: simplify WriteString
Rob Pike [Tue, 28 Jun 2011 01:09:21 +0000 (11:09 +1000)]
os: simplify WriteString
It was working too hard.

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

13 years agoexp/regexp/syntax: compiled form
Russ Cox [Mon, 27 Jun 2011 23:52:59 +0000 (19:52 -0400)]
exp/regexp/syntax: compiled form

R=r, sam.thorogood, kevlar
CC=golang-dev, rsc
https://golang.org/cl/4636046

13 years agostrings.Split: make the default to split all.
Rob Pike [Mon, 27 Jun 2011 23:43:14 +0000 (09:43 +1000)]
strings.Split: make the default to split all.
Change the signature of Split to have no count,
assuming a full split, and rename the existing
Split with a count to SplitN.
Do the same to package bytes.
Add a gofix module.

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

13 years agosyscall: support for tty options in StartProcess
Ken Rockot [Mon, 27 Jun 2011 23:07:49 +0000 (19:07 -0400)]
syscall: support for tty options in StartProcess

These are the relevant changes to exec_unix.go now that
mkerrors.sh outputs have been updated.

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

13 years agoxml: add Marshal and MarshalIndent
Kyle Lemons [Mon, 27 Jun 2011 23:07:28 +0000 (19:07 -0400)]
xml: add Marshal and MarshalIndent

I have written up a Marshal and MarshalIndent pair that should
closely reflect the way that Unmarshal works.  I would love feedback
on making this code more accessible and efficient... I haven't used
reflecton on this scale before, so there is probably a lot of work
that can be done on that.

Some potentially controversial things:
- All tag names are lower-cased by default.
- Zero-valued struct values are skipped.
- No namespace prefix (o:tag, etc) mechanism is supplied.
- You are allowed to marshal non-struct values (even though unmarshal
  cannot handle them).
- A tag for a non-XMLName struct field that isn't "attr", "chardata",
  or "innerxml" is used as the name of the tag.  This could wreak
  havoc if you try to marshal a protobuf struct.
- The "innerxml" and "chardata" are inserted verbatim.  If you try to
  marshal something straight from unmarshal, the results could be
  unexpected (remove "innerxml" support from Marshal would be one
  possible solution).

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

13 years agoCONTRIBUTORS: update Rietveld address for Kyle Lemons
Russ Cox [Mon, 27 Jun 2011 23:07:22 +0000 (19:07 -0400)]
CONTRIBUTORS: update Rietveld address for Kyle Lemons

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

13 years agohttp: respect Handlers setting Connection: close in their response
Brad Fitzpatrick [Mon, 27 Jun 2011 22:53:48 +0000 (15:53 -0700)]
http: respect Handlers setting Connection: close in their response

Fixes #2011

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