]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoeffective_go.html: add a section on type assertions
Rob Pike [Fri, 8 Mar 2013 21:53:17 +0000 (13:53 -0800)]
effective_go.html: add a section on type assertions
The information was missing, oddly enough.

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

12 years agoeffective_go.html: move and rework the blank identifier section
Rob Pike [Fri, 8 Mar 2013 18:41:20 +0000 (10:41 -0800)]
effective_go.html: move and rework the blank identifier section
Also rename the relevant examples and make sure the working one compiles.

R=golang-dev, bradfitz, adg, iant, rsc
CC=golang-dev
https://golang.org/cl/7597043

12 years agodatabase/sql: fix Conn leak
Brad Fitzpatrick [Fri, 8 Mar 2013 18:04:17 +0000 (10:04 -0800)]
database/sql: fix Conn leak

Fixes #4902

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

12 years agoruntime: clear locked bit when goroutine exits
Russ Cox [Fri, 8 Mar 2013 16:26:00 +0000 (11:26 -0500)]
runtime: clear locked bit when goroutine exits

Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.

While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.

Fixes #4971.

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

12 years agoruntime: make TestStackMem a little less flaky
Russ Cox [Fri, 8 Mar 2013 16:25:21 +0000 (11:25 -0500)]
runtime: make TestStackMem a little less flaky

Have seen failures with GOMAXPROCS=4 on Windows.

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

12 years agocmd/6l, cmd/8l: fix BSD builds
Russ Cox [Fri, 8 Mar 2013 05:23:59 +0000 (21:23 -0800)]
cmd/6l, cmd/8l: fix BSD builds

Before this CL, running

        cd misc/cgo/test
        go test -c
        readelf --dyn-syms test.test | grep cgoexp

turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.

The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.

This CL eliminates the symbols from the dyn-syms table.

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

12 years agospec: clarify unsafe.Offsetof
Robert Griesemer [Fri, 8 Mar 2013 04:11:37 +0000 (20:11 -0800)]
spec: clarify unsafe.Offsetof

Fixes #4905.

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

12 years agocmd/ld: steps toward 386 host linking
Russ Cox [Fri, 8 Mar 2013 03:57:25 +0000 (19:57 -0800)]
cmd/ld: steps toward 386 host linking

- Introduce MaxAlign constant and use in data layout
and ELF section header.

- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).

- Emit ELF symbol for .rathole (global /dev/null used by 8c).

- Invoke gcc with -m32/-m64 as appropriate.

- Don't invoke gcc if writing the .o file failed.

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

12 years agoruntime: change 386 startup convention
Russ Cox [Fri, 8 Mar 2013 03:57:10 +0000 (19:57 -0800)]
runtime: change 386 startup convention

Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.

This makes the _rt0_386 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

386 analogue of https://golang.org/cl/7525043

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

12 years agonet/http: Transport socket late binding
Brad Fitzpatrick [Fri, 8 Mar 2013 01:56:00 +0000 (17:56 -0800)]
net/http: Transport socket late binding

Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/

In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.

The implementation looks like a classic "Learning Go
Concurrency" slide.

Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7587043

12 years agosyscall: Plan 9: use lightweight errstr in entersyscall mode
Akshat Kumar [Thu, 7 Mar 2013 23:54:44 +0000 (00:54 +0100)]
syscall: Plan 9: use lightweight errstr in entersyscall mode

Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.

Fixes #4994.

R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043

12 years agonet: fix multicast listener tests
Mikio Hara [Thu, 7 Mar 2013 21:51:06 +0000 (06:51 +0900)]
net: fix multicast listener tests

This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.

Fixes #4059.

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

12 years agocmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions
Keith Randall [Thu, 7 Mar 2013 20:54:00 +0000 (12:54 -0800)]
cmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions

Instructions for use in AES hashing.  See CL#7543043

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

12 years agocmd/8g: fix code generation of int64(0) == int64(0).
Rémy Oudompheng [Thu, 7 Mar 2013 20:47:45 +0000 (21:47 +0100)]
cmd/8g: fix code generation of int64(0) == int64(0).

The code would violate the contract of cmp64.

Fixes #5002.

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

12 years agoC: add Keith Randall (Google CLA)
Brad Fitzpatrick [Thu, 7 Mar 2013 20:46:44 +0000 (12:46 -0800)]
C: add Keith Randall (Google CLA)

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

12 years agolib9: fix windows build (don't use runesmprint)
Russ Cox [Thu, 7 Mar 2013 19:38:49 +0000 (14:38 -0500)]
lib9: fix windows build (don't use runesmprint)

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

12 years agogo/types: more internal cleanups
Robert Griesemer [Thu, 7 Mar 2013 19:17:30 +0000 (11:17 -0800)]
go/types: more internal cleanups

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

12 years ago misc/emacs: Rewrite gofmt to use own function for applying patch instead of using...
Dominik Honnef [Thu, 7 Mar 2013 18:12:37 +0000 (13:12 -0500)]
misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.

    Instead of relying on gofmt's diff output (which is a unified
    diff), we manually invoke diff -n and produce an RCS format diff,
    which can easily be parsed in Emacs, with the go--apply-rcs-patch
    function.

    This fixes undocumented issues with the old implementation such as
    skipping over hunks of changes, and it fixes the documented issue
    of not being able to handle file names that include whitespace.

    It can also apply the patch on a buffer that has no file name
    attached at all.

    Last but not least, it greatly simplifies the gofmt function
    itself.

Fixes #4766.
Fixes #4475.

R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7516046

12 years agonet: more refactoring in preparation for runtime integrated pollster
Dmitriy Vyukov [Thu, 7 Mar 2013 17:44:24 +0000 (21:44 +0400)]
net: more refactoring in preparation for runtime integrated pollster
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go

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

12 years agoruntime: fix deadlock
Dmitriy Vyukov [Thu, 7 Mar 2013 17:39:59 +0000 (21:39 +0400)]
runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
        runtime·atomicload(&runtime·sched.nmspinning) +
        runtime·atomicload(&runtime·sched.npidle) > 0)
        continue;

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

12 years agocmd/ld: host linking support for linux/amd64
Russ Cox [Thu, 7 Mar 2013 14:19:02 +0000 (09:19 -0500)]
cmd/ld: host linking support for linux/amd64

Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.

"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.

Much may yet change, but this seems a reasonable checkpoint.

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

12 years agoruntime: fix cgo callbacks on windows
Russ Cox [Thu, 7 Mar 2013 14:18:48 +0000 (09:18 -0500)]
runtime: fix cgo callbacks on windows

Fixes #4955.

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

12 years agonet: fix accept/connect deadline handling
Dmitriy Vyukov [Thu, 7 Mar 2013 13:03:40 +0000 (17:03 +0400)]
net: fix accept/connect deadline handling
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.

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

12 years agonet: fix typo in skip message
Mikio Hara [Thu, 7 Mar 2013 10:17:18 +0000 (19:17 +0900)]
net: fix typo in skip message

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7523044

12 years agonet: fix plan9 build
Mikio Hara [Thu, 7 Mar 2013 10:15:00 +0000 (19:15 +0900)]
net: fix plan9 build

R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7564043

12 years agocmd/fix: remove redundant 0 port
Tyler Bunnell [Thu, 7 Mar 2013 10:06:19 +0000 (19:06 +0900)]
cmd/fix: remove redundant 0 port

Fixes #4505.

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

12 years agoall: delete a couple of mentions of the exp and old trees
Rob Pike [Thu, 7 Mar 2013 00:52:03 +0000 (16:52 -0800)]
all: delete a couple of mentions of the exp and old trees

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

12 years agogo/types: implement constant string(x) conversions
Robert Griesemer [Thu, 7 Mar 2013 00:15:04 +0000 (16:15 -0800)]
go/types: implement constant string(x) conversions

Fixes #4982.

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

12 years agogo/types: cleanup of assignment checks
Robert Griesemer [Thu, 7 Mar 2013 00:14:07 +0000 (16:14 -0800)]
go/types: cleanup of assignment checks

Also:
- cleaner handling of constants w/ unknown value
- removed several TODOs

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

12 years agoall: Skip AllocsPerRun tests if GOMAXPROCS>1.
Albert Strasheim [Wed, 6 Mar 2013 23:52:32 +0000 (15:52 -0800)]
all: Skip AllocsPerRun tests if GOMAXPROCS>1.

Fixes #4974.

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

12 years agodoc/effective_go.html: unify and expand the discussion of Sprintf and String
Rob Pike [Wed, 6 Mar 2013 23:47:49 +0000 (15:47 -0800)]
doc/effective_go.html: unify and expand the discussion of Sprintf and String
It's a common mistake to build a recursive String method; explain it well and
show how to avoid it.

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

12 years agoexp/norm: delete, part of moving to go.text
Rob Pike [Wed, 6 Mar 2013 22:34:03 +0000 (14:34 -0800)]
exp/norm: delete, part of moving to go.text
See also https://golang.org/cl/7520044

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

12 years agonet/http: remove allocations in HeaderWriteSubset
Brad Fitzpatrick [Wed, 6 Mar 2013 22:10:47 +0000 (14:10 -0800)]
net/http: remove allocations in HeaderWriteSubset

Before:
BenchmarkHeaderWriteSubset  500000  2354 ns/op  197 B/op  2 allocs/op
After:
BenchmarkHeaderWriteSubset 1000000  2085 ns/op    0 B/op  0 allocs/op

Fixes #3761

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

12 years agocmd/cgo: split cgo_export into cgo_export_static and cgo_export_dynamic
Russ Cox [Wed, 6 Mar 2013 21:57:14 +0000 (16:57 -0500)]
cmd/cgo: split cgo_export into cgo_export_static and cgo_export_dynamic

Also emit cgo_ldflag pragmas.

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

12 years agonet/http/httputil: fix build
Russ Cox [Wed, 6 Mar 2013 21:56:53 +0000 (16:56 -0500)]
net/http/httputil: fix build

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/7540043

12 years agoruntime: fix netbsd, windows build
Russ Cox [Wed, 6 Mar 2013 21:55:08 +0000 (16:55 -0500)]
runtime: fix netbsd, windows build

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

12 years agonet/http: change user agent string
Russ Cox [Wed, 6 Mar 2013 21:48:20 +0000 (16:48 -0500)]
net/http: change user agent string

Some IDS somewhere thinks "Go http package" is a virus.
Make it something else for Go 1.1. Dumb but easy.

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

12 years agomake.bash,bat: add -tags gotypes to the build
Rob Pike [Wed, 6 Mar 2013 21:16:43 +0000 (13:16 -0800)]
make.bash,bat: add -tags gotypes to the build
This installs type checking into go vet.
(To be removed before releasing Go 1.1)

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

12 years agocmd/vet: isolate the type checking code into a separate file
Rob Pike [Wed, 6 Mar 2013 20:49:56 +0000 (12:49 -0800)]
cmd/vet: isolate the type checking code into a separate file
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.

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

12 years agolib9: add mktempdir, removeall, runprog
Russ Cox [Wed, 6 Mar 2013 20:48:28 +0000 (15:48 -0500)]
lib9: add mktempdir, removeall, runprog

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

12 years agotext/template: improve error reporting for executing an empty template
Rob Pike [Wed, 6 Mar 2013 20:34:19 +0000 (12:34 -0800)]
text/template: improve error reporting for executing an empty template
Fixes #4522.

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

12 years agostrings: remove allocations in Split(s, "")
Ewan Chou [Wed, 6 Mar 2013 20:21:19 +0000 (15:21 -0500)]
strings: remove allocations in Split(s, "")

BenchmarkSplit1     77984460     24131380  -69.06%

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

12 years agoA+C: Ewan Chou (individual CLA)
Russ Cox [Wed, 6 Mar 2013 20:20:24 +0000 (15:20 -0500)]
A+C: Ewan Chou (individual CLA)

Generated by addca.

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

12 years agoruntime,misc/cgo/test: disable broken tests so we can test the rest
Alex Brainman [Wed, 6 Mar 2013 20:19:01 +0000 (15:19 -0500)]
runtime,misc/cgo/test: disable broken tests so we can test the rest

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

12 years agolibmach: fix amd64 pe handling
Alex Brainman [Wed, 6 Mar 2013 20:14:07 +0000 (15:14 -0500)]
libmach: fix amd64 pe handling

Fixes #4841.

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

12 years agomisc/cgo/test: do not stop on first error
Russ Cox [Wed, 6 Mar 2013 20:03:28 +0000 (15:03 -0500)]
misc/cgo/test: do not stop on first error

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

12 years agoruntime: change amd64 startup convention
Russ Cox [Wed, 6 Mar 2013 20:03:04 +0000 (15:03 -0500)]
runtime: change amd64 startup convention

Now the default startup is that the program begins at _rt0_amd64_$GOOS,
which sets DI = argc, SI = argv and jumps to _rt0_amd64.

This makes the _rt0_amd64 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

R=golang-dev, devon.odell, minux.ma
CC=golang-dev
https://golang.org/cl/7525043

12 years agomisc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32
Dominik Honnef [Wed, 6 Mar 2013 19:35:29 +0000 (14:35 -0500)]
misc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32

This CL adds compatibility for GNU Emacs 23 (fixing fontification
issues) and XEmacs >=21.5.32 (fixing a lot of issues). Earlier
versions of XEmacs will not be supported because they do not
support POSIX character classes. Because of that, we also make use
of a lot of functions that were added in 21.5.32.

A known and currently unfixable issue with XEmacs is that go-mode
will not always fontify identifiers that use unicode correctly.

All changes for XEmacs are annotated in the diff.

Note: go--position-bytes is not currently used anywhere, but will
be in a future CL.

Fixes #4927.

R=golang-dev, adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7456051

12 years agoapi: update next.txt
Brad Fitzpatrick [Wed, 6 Mar 2013 19:16:58 +0000 (11:16 -0800)]
api: update next.txt

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

12 years agoeffective_go.html: round 3 of minor edits.
Rob Pike [Wed, 6 Mar 2013 18:08:48 +0000 (10:08 -0800)]
effective_go.html: round 3 of minor edits.

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

12 years agonet/http: close TCP connection on Response.Body.Close
Brad Fitzpatrick [Wed, 6 Mar 2013 02:47:27 +0000 (18:47 -0800)]
net/http: close TCP connection on Response.Body.Close

Previously the HTTP client's (*Response).Body.Close would try
to keep reading until EOF, hoping to reuse the keep-alive HTTP
connection, but the EOF might never come, or it might take a
long time. Now we immediately close the TCP connection if we
haven't seen EOF.

This shifts the burden onto clients to read their whole response
bodies if they want the advantage of reusing TCP connections.

In the future maybe we could decide on heuristics to read some
number of bytes for some max amount of time before forcefully
closing, but I'd rather not for now.

Statistically, touching this code makes things regress, so I
wouldn't be surprised if this introduces new bugs, but all the
tests pass, and I think the code is simpler now too. Maybe.

Please test your HTTP client code before Go 1.1.

Fixes #3672

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

12 years agoimage/jpeg: for progressive JPEGs, the first SOS segment doesn't
Nigel Tao [Tue, 5 Mar 2013 23:08:46 +0000 (10:08 +1100)]
image/jpeg: for progressive JPEGs, the first SOS segment doesn't
necessarily contain all components.

Fixes #4975.

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

12 years agovet: check for useless assignments.
David Symonds [Tue, 5 Mar 2013 22:55:04 +0000 (09:55 +1100)]
vet: check for useless assignments.

The only check so far is for self-assignments of the form "expr = expr",
but even that found one instance in the standard library.

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

12 years agocmd/vet: change some warnings to errors for consistency.
Rob Pike [Tue, 5 Mar 2013 22:31:17 +0000 (14:31 -0800)]
cmd/vet: change some warnings to errors for consistency.
Fixes #4980.

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

12 years agodoc/effective_go.html: update slices and maps.
Rob Pike [Tue, 5 Mar 2013 22:13:53 +0000 (14:13 -0800)]
doc/effective_go.html: update slices and maps.
Drop the phrase "reference types", which has caused confusion.
Add a section about 2D arrays, a common newbie question.

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

12 years agoundo CL 7301062 / 9742f722b558
Russ Cox [Tue, 5 Mar 2013 20:36:40 +0000 (15:36 -0500)]
undo CL 7301062 / 9742f722b558

broke arm garbage collector

traceback_arm fails with a missing pc. It needs CL 7494043.
But that only makes the build break later, this time with
"invalid freelist". Roll back until it can be fixed correctly.

««« original CL description
runtime: restrict stack root scan to locals and arguments

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

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

12 years agogo/types: add test typechecking std lib
Robert Griesemer [Tue, 5 Mar 2013 19:42:43 +0000 (11:42 -0800)]
go/types: add test typechecking std lib

- run time is limited if -short is set
- also added missing TODO to unrelated file return.go

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

12 years agosyscall: handle getsockname for unix sockets on openbsd 5.2
Joel Sing [Tue, 5 Mar 2013 10:40:37 +0000 (21:40 +1100)]
syscall: handle getsockname for unix sockets on openbsd 5.2

On OpenBSD 5.2, calling getsockname on an unbound Unix domain socket
results in a successful syscall, however the AF is unset and the length
is returned as zero. This has been changed to more portable behaviour,
which will be included in the OpenBSD 5.3 release.

For now, work around this by treating a successful getsockname() call
that returns a family of AF_UNSPEC and length of zero as a AF_UNIX
socket.

Makes TestPassFD work on OpenBSD 5.2.

Fixes #4956.

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

12 years agoruntime: add atomic xchg64
Dmitriy Vyukov [Tue, 5 Mar 2013 07:46:52 +0000 (09:46 +0200)]
runtime: add atomic xchg64
It will be handy for network poller.

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

12 years agoruntime: fix false positive deadlock when using runtime.Goexit
Dmitriy Vyukov [Tue, 5 Mar 2013 07:40:17 +0000 (09:40 +0200)]
runtime: fix false positive deadlock when using runtime.Goexit
Fixes #4893.
Actually it's fixed by cl/7314062 (improved scheduler),
just submitting the test.

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

12 years agoruntime: declare addtimer/deltimer in runtime.h
Dmitriy Vyukov [Tue, 5 Mar 2013 07:38:15 +0000 (09:38 +0200)]
runtime: declare addtimer/deltimer in runtime.h
In preparation for integrated network poller
(https://golang.org/cl/7326051),
this is required to handle deadlines.

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

12 years agoruntime: restrict stack root scan to locals and arguments
Carl Shapiro [Tue, 5 Mar 2013 03:48:50 +0000 (19:48 -0800)]
runtime: restrict stack root scan to locals and arguments

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

12 years agotext/template/parse: remove self-assignment.
David Symonds [Tue, 5 Mar 2013 00:16:58 +0000 (11:16 +1100)]
text/template/parse: remove self-assignment.

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

12 years agovet: clean up taglit error print when typechecking fails.
David Symonds [Mon, 4 Mar 2013 22:56:46 +0000 (09:56 +1100)]
vet: clean up taglit error print when typechecking fails.

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

12 years agogo/types: "missing return" check
Robert Griesemer [Mon, 4 Mar 2013 22:40:12 +0000 (14:40 -0800)]
go/types: "missing return" check

Implementation closely based on Russ' CL 7440047.

Future work: The error messages could be better
(e.g., instead of "missing return" it might say
"missing return (no default in switch)", etc.).

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

12 years agocmd/gc: implement new return requirements
Russ Cox [Mon, 4 Mar 2013 22:02:04 +0000 (17:02 -0500)]
cmd/gc: implement new return requirements

Fixes #65.

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

12 years agospec: terminating statements for functions
Robert Griesemer [Mon, 4 Mar 2013 21:55:35 +0000 (13:55 -0800)]
spec: terminating statements for functions

The only functional change is the new section
on terminating statements.

There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).

Includes some minor fixes/additions of missing links.

Based closely on Russ' proposal.

Fixes #65.

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

12 years agospec: cyclic imports are illegal
Robert Griesemer [Mon, 4 Mar 2013 20:59:40 +0000 (12:59 -0800)]
spec: cyclic imports are illegal

Fixes #4976.

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

12 years agomisc/emacs: Add tab completion for godoc command, completing from known installed...
Dominik Honnef [Mon, 4 Mar 2013 20:31:57 +0000 (15:31 -0500)]
misc/emacs: Add tab completion for godoc command, completing from known installed packages

R=golang-dev, adonovan, bradfitz, cw, patrick.allen.higgins, sameer, ugorji
CC=golang-dev
https://golang.org/cl/7373051

12 years agotest/bench/go1: use raw string instead of string addition
Shenghou Ma [Mon, 4 Mar 2013 20:23:37 +0000 (04:23 +0800)]
test/bench/go1: use raw string instead of string addition
to reduce compile time memory/stack usage.
Update #4970
$ go test -c ../test/bench/go1
before:
0.36user 0.07system 0:00.44elapsed 100%CPU
(0avgtext+0avgdata 540720maxresident)k
0inputs+19840outputs (0major+56451minor)pagefaults 0swaps
after:
0.33user 0.05system 0:00.39elapsed 100%CPU
(0avgtext+0avgdata 289936maxresident)k
0inputs+19864outputs (0major+29615minor)pagefaults 0swaps

And stack usage is reduced to below 1MiB.

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

12 years agonet: make some tests less flaky
Brad Fitzpatrick [Mon, 4 Mar 2013 19:55:27 +0000 (11:55 -0800)]
net: make some tests less flaky

Fixes #4969

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

12 years agocmd/cgo: use explicit flag to emit dynamic linker path
Russ Cox [Mon, 4 Mar 2013 16:23:17 +0000 (11:23 -0500)]
cmd/cgo: use explicit flag to emit dynamic linker path

Using -import_runtime_cgo would have worked great except
that it doesn't get passed to the second invocation of cgo,
and that's the one that writes the relevant file.

Fixes ARM build on systems with a different dynamic linker
than the one 5l assumes (like Gentoo).

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

12 years agonet/http/cgi: maybe improve darwin test reliability
Brad Fitzpatrick [Mon, 4 Mar 2013 16:13:39 +0000 (08:13 -0800)]
net/http/cgi: maybe improve darwin test reliability

Use a 17 MB payload instead of a 1 MB payload, since
OS X can apparently buffer up to 16 MB in its pipes.

Fixes #4958 maybe

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

12 years agocmd/gc: disallow selectors to the blank identifier
Daniel Morsing [Mon, 4 Mar 2013 16:01:42 +0000 (17:01 +0100)]
cmd/gc: disallow selectors to the blank identifier

Fixes #4941.

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

12 years agoruntime: add garbage collector statistics
Jan Ziak [Mon, 4 Mar 2013 15:54:37 +0000 (16:54 +0100)]
runtime: add garbage collector statistics

If the constant CollectStats is non-zero and GOGCTRACE=1
the garbage collector will print basic statistics about executed
GC instructions.

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

12 years agocmd/gc: simplify and fix defaultlit.
Rémy Oudompheng [Mon, 4 Mar 2013 15:51:42 +0000 (16:51 +0100)]
cmd/gc: simplify and fix defaultlit.

Fixes #4882.
Fixes #4936.
Fixes #4937.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7432044

12 years agotest/bench/garbage: fix parser benchmark
Jan Ziak [Mon, 4 Mar 2013 15:46:04 +0000 (16:46 +0100)]
test/bench/garbage: fix parser benchmark

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

12 years agocmd/gc: unbreak exporting of composite literals.
Rémy Oudompheng [Mon, 4 Mar 2013 15:42:03 +0000 (16:42 +0100)]
cmd/gc: unbreak exporting of composite literals.

Fixes #4932.

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

12 years agoruntime: add link to design doc for new scheduler
Russ Cox [Mon, 4 Mar 2013 15:36:45 +0000 (10:36 -0500)]
runtime: add link to design doc for new scheduler

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

12 years agomisc/dashboard/builder: make -fail mode faster
Russ Cox [Mon, 4 Mar 2013 15:31:01 +0000 (10:31 -0500)]
misc/dashboard/builder: make -fail mode faster

Don't check out the repository if we're just going to fail everything.

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

12 years agocontainer/heap: fix int overflow bug
Stefan Nilsson [Mon, 4 Mar 2013 15:25:21 +0000 (10:25 -0500)]
container/heap: fix int overflow bug

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

12 years agoimage/png: always set up palette during DecodeConfig
Volker Dobler [Mon, 4 Mar 2013 03:54:36 +0000 (14:54 +1100)]
image/png: always set up palette during DecodeConfig

The old code would decode the palette only for 8-bit
images during a DecodeConfig.
This CL keeps the behavior for 8-bit images and sets
up the decoded palette also for 1, 2 and 4-bit images.

Fixes #4279.

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

12 years agocmd/godoc: move note argument to godoc.go
Andrew Gerrand [Sun, 3 Mar 2013 22:02:45 +0000 (09:02 +1100)]
cmd/godoc: move note argument to godoc.go

Fixes the App Engine version of godoc. The other fix is to duplicate
this code inside appinit.go. I think initHandlers is the right place
to put the strings.Split call, as the notesToShow var is used by
docServer, which is what initHandlers sets up.

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

12 years agodoc/go1.1.html: fix typo in URL
Rob Pike [Sun, 3 Mar 2013 17:12:36 +0000 (09:12 -0800)]
doc/go1.1.html: fix typo in URL

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

12 years agonet: disable unixgram test on Plan 9 and Windows
Mikio Hara [Sun, 3 Mar 2013 11:06:51 +0000 (20:06 +0900)]
net: disable unixgram test on Plan 9 and Windows

Fixes build on Plan 9 and Windows.

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

12 years agonet: fix windows build
Mikio Hara [Sun, 3 Mar 2013 10:10:59 +0000 (19:10 +0900)]
net: fix windows build

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

12 years agonet: add unixgram dial test
Mikio Hara [Sun, 3 Mar 2013 06:59:53 +0000 (15:59 +0900)]
net: add unixgram dial test

Also replaces testing.Errof with testing.Fatalf, make use of ICMP mock.

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

12 years agonet: add TCP over IPv6 benchmarks
Mikio Hara [Sun, 3 Mar 2013 02:25:49 +0000 (11:25 +0900)]
net: add TCP over IPv6 benchmarks

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

12 years agocmd/dist: support for NetBSD/ARM
Shenghou Ma [Sat, 2 Mar 2013 22:50:17 +0000 (06:50 +0800)]
cmd/dist: support for NetBSD/ARM
1. when executing a unsupported VFP instruction, the NetBSD kernel somehow
doesn't report SIGILL, and instead just spin and spin, we add a alarm(2)
to detect this case (albeit this is a kernel bug).
2. NetBSD/ARM's VFP11 support is not complete, so temporarily disable it.
3. The default gcc shipped with NetBSD-current mis-optimizes our code
at -O2, so lower the optimization level to -O1 on NetBSD/ARM.

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

12 years agoarchive/tar: remove execute bit from common.go
Andrew Gerrand [Sat, 2 Mar 2013 21:56:08 +0000 (08:56 +1100)]
archive/tar: remove execute bit from common.go

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

12 years agoruntime: benchmark for appending N bytes should not append N² bytes.
Rémy Oudompheng [Sat, 2 Mar 2013 20:11:05 +0000 (21:11 +0100)]
runtime: benchmark for appending N bytes should not append N² bytes.

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

12 years agodoc/go1.1.html: document the moving of exp/... and old/....
Rob Pike [Sat, 2 Mar 2013 19:55:25 +0000 (11:55 -0800)]
doc/go1.1.html: document the moving of exp/... and old/....

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

12 years agoold/netchan: delete as part of move to go.exp/old/netchan
Rob Pike [Sat, 2 Mar 2013 19:45:22 +0000 (11:45 -0800)]
old/netchan: delete as part of move to go.exp/old/netchan

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

12 years agomisc/dashboard/app: make the builders test go.talks and go.exp
Shenghou Ma [Sat, 2 Mar 2013 19:17:14 +0000 (03:17 +0800)]
misc/dashboard/app: make the builders test go.talks and go.exp

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

12 years agoexp: delete all packages except norm
Rob Pike [Sat, 2 Mar 2013 19:13:24 +0000 (11:13 -0800)]
exp: delete all packages except norm
They are moving to code.google.com/p/go.exp.
See also https://golang.org/cl/7463043

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

12 years agoruntime: deadlock tests now work with GOMAXPROCS>1
Dmitriy Vyukov [Sat, 2 Mar 2013 06:41:53 +0000 (10:41 +0400)]
runtime: deadlock tests now work with GOMAXPROCS>1
Fixes #4826.

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

12 years agoruntime: move TestGcSys into a separate process
Dmitriy Vyukov [Sat, 2 Mar 2013 06:36:06 +0000 (08:36 +0200)]
runtime: move TestGcSys into a separate process
Fixes #4904.
The problem was that when the test runs the heap had grown to ~100MB,
so GC allows it to grow to 200MB, and so the test fails.
Moving the test to a separate process makes it much more isolated and stable.

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

12 years agonet: skip interface tests when required external command not found
Mikio Hara [Sat, 2 Mar 2013 01:56:51 +0000 (10:56 +0900)]
net: skip interface tests when required external command not found

Fixes #4952.

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

12 years agogo/types: fixed a few failure checks
Robert Griesemer [Sat, 2 Mar 2013 01:39:22 +0000 (17:39 -0800)]
go/types: fixed a few failure checks

More robustness in case of incorrect programs.

Fixes #4962.

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

12 years agocmd/go: pass -intgosize to SWIG
Carlos Castillo [Sat, 2 Mar 2013 00:48:21 +0000 (16:48 -0800)]
cmd/go: pass -intgosize to SWIG

swig >= 2.0.9 requires the size of int values to be passed via a command line flag. Should swig complain about the -intgosize not being supported, then alert the user to their outdated version of swig.

Fixes #4756.

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