]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocmd/go: make malformed import path message more precise
Russ Cox [Fri, 26 Sep 2014 17:47:51 +0000 (13:47 -0400)]
cmd/go: make malformed import path message more precise

If you say 'go get -v' you get extra information when import
paths are not of the expected form.

If you say 'go get -v src/rsc.io/pdf' the message says that
src/rsc.io/pdf does not contain a hostname, which is incorrect.
The problem is that it does not begin with a hostname.

Fixes #7432.

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant
https://golang.org/cl/144650043

10 years agocmd/go: re-resolve and check vcs roots during go get -u
Russ Cox [Fri, 26 Sep 2014 16:10:13 +0000 (12:10 -0400)]
cmd/go: re-resolve and check vcs roots during go get -u

If you do 'go get -u rsc.io/pdf' and then rsc.io/pdf's redirect
changes to point somewhere else, after this CL a later
'go get -u rsc.io/pdf' will tell you that.

Fixes #8548.

LGTM=iant
R=golang-codereviews, iant
CC=adg, golang-codereviews, n13m3y3r, r
https://golang.org/cl/147170043

10 years agocmd/go: fix 'go get vanity/repo/...' in clean GOPATH
Russ Cox [Fri, 26 Sep 2014 16:09:27 +0000 (12:09 -0400)]
cmd/go: fix 'go get vanity/repo/...' in clean GOPATH

The pattern was only working if the checkout had
already been done, but the code was trying to make
it work even the first time. Test and fix.

Fixes #8335.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/146310043

10 years agocrypto/tls: ensure that we don't resume when tickets are disabled.
Adam Langley [Fri, 26 Sep 2014 01:02:09 +0000 (11:02 +1000)]
crypto/tls: ensure that we don't resume when tickets are disabled.

LGTM=r
R=r, adg, rsc
https://golang.org/cl/148080043

10 years agodoc: document Go 1.3.2
Andrew Gerrand [Fri, 26 Sep 2014 01:00:49 +0000 (11:00 +1000)]
doc: document Go 1.3.2

LGTM=r
R=r, rsc, iant, agl
https://golang.org/cl/142650045

10 years agotag go1.3.2
Andrew Gerrand [Fri, 26 Sep 2014 00:53:09 +0000 (10:53 +1000)]
tag go1.3.2

LGTM=r
R=r, rsc
CC=golang-codereviews
https://golang.org/cl/150100044

10 years ago.hgignore: delete some dregs
Rob Pike [Fri, 26 Sep 2014 00:30:12 +0000 (17:30 -0700)]
.hgignore: delete some dregs
I'd rather delete the file but I doubt that will be popular.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/150100043

10 years agoencoding/gob: fix 386 build
Rob Pike [Fri, 26 Sep 2014 00:16:27 +0000 (17:16 -0700)]
encoding/gob: fix 386 build

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/146320043

10 years agoencoding/gob: error rather than panic when decoding enormous slices
Rob Pike [Thu, 25 Sep 2014 22:18:25 +0000 (15:18 -0700)]
encoding/gob: error rather than panic when decoding enormous slices
Fixes #8084.

LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/142710043

10 years agodoc/gopher: add biplane.jpg
Rob Pike [Thu, 25 Sep 2014 21:10:56 +0000 (14:10 -0700)]
doc/gopher: add biplane.jpg

LGTM=0intro
R=golang-codereviews, 0intro
CC=golang-codereviews
https://golang.org/cl/150960043

10 years agocmd/go: install dependencies for 'go build -i' on a command
Russ Cox [Thu, 25 Sep 2014 19:57:52 +0000 (15:57 -0400)]
cmd/go: install dependencies for 'go build -i' on a command

Fixes #8242.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/147150043

10 years agospec: clarify scope and re-use of iteration variables
Robert Griesemer [Thu, 25 Sep 2014 19:52:05 +0000 (12:52 -0700)]
spec: clarify scope and re-use of iteration variables

Fixes #7834.

LGTM=iant, rsc, r
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/148940044

10 years agospec: clarify embedding of interfaces
Robert Griesemer [Thu, 25 Sep 2014 19:49:42 +0000 (12:49 -0700)]
spec: clarify embedding of interfaces

Fixes #7886.

LGTM=iant, r, rsc
R=r, iant, rsc, ken
CC=golang-codereviews
https://golang.org/cl/149010043

10 years agobufio: fix handling of empty tokens at end of line/file
Rob Pike [Thu, 25 Sep 2014 19:45:21 +0000 (12:45 -0700)]
bufio: fix handling of empty tokens at end of line/file
Fixes #8672.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/145390043

10 years agotime: make it clear that time.Time values do not compare with ==
Rob Pike [Thu, 25 Sep 2014 17:52:02 +0000 (10:52 -0700)]
time: make it clear that time.Time values do not compare with ==

LGTM=bradfitz, josharian, adg, rsc
R=golang-codereviews, bradfitz, josharian, rsc, adg
CC=golang-codereviews
https://golang.org/cl/141340043

10 years agocmd/gc: emit error for out-of-bounds slice of constant string
Russ Cox [Thu, 25 Sep 2014 17:24:43 +0000 (13:24 -0400)]
cmd/gc: emit error for out-of-bounds slice of constant string

Fixes #7200.

LGTM=gri, iant
R=golang-codereviews, gri, iant
CC=golang-codereviews, r
https://golang.org/cl/150020044

10 years agocmd/gc: print x++ (not x += 1) in errors about x++
Russ Cox [Thu, 25 Sep 2014 17:13:02 +0000 (13:13 -0400)]
cmd/gc: print x++ (not x += 1) in errors about x++

Fixes #8311.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/146270043

10 years agocmd/gc: avoid infinite recursion on invalid recursive type
Russ Cox [Thu, 25 Sep 2014 17:08:37 +0000 (13:08 -0400)]
cmd/gc: avoid infinite recursion on invalid recursive type

Fixes #8507.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/144560043

10 years agoruntime: add load_g call in arm callback.
Keith Randall [Thu, 25 Sep 2014 15:37:04 +0000 (08:37 -0700)]
runtime: add load_g call in arm callback.

Need to restore the g register.  Somehow this line vaporized from
CL 144130043.  Also cgo_topofstack -> _cgo_topofstack, that vaporized also.

TBR=rsc
CC=golang-codereviews
https://golang.org/cl/150940044

10 years agocgo: adjust return value location to account for stack copies.
Keith Randall [Thu, 25 Sep 2014 14:59:01 +0000 (07:59 -0700)]
cgo: adjust return value location to account for stack copies.

During a cgo call, the stack can be copied.  This copy invalidates
the pointer that cgo has into the return value area.  To fix this
problem, pass the address of the location containing the stack
top value (which is in the G struct).  For cgo functions which
return values, read the stktop before and after the cgo call to
compute the adjustment necessary to write the return value.

Fixes #8771

LGTM=iant, rsc
R=iant, rsc, khr
CC=golang-codereviews
https://golang.org/cl/144130043

10 years agonet/http: update ProxyFromEnvironment docs for HTTPS_PROXY addition
Brad Fitzpatrick [Thu, 25 Sep 2014 00:39:00 +0000 (17:39 -0700)]
net/http: update ProxyFromEnvironment docs for HTTPS_PROXY addition

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/142650043

10 years agonet/http: allow double-quotes only on cookie values, not cookie
Nigel Tao [Thu, 25 Sep 2014 00:21:52 +0000 (10:21 +1000)]
net/http: allow double-quotes only on cookie values, not cookie
attribute values, a la RFC 6265 section 4.1.1 "Syntax".

Fixes #7751.

LGTM=dr.volker.dobler
R=dr.volker.dobler
CC=bradfitz, golang-codereviews
https://golang.org/cl/148890043

10 years agonet/http: check for CloseWrite interface, not TCPConn implementation
Brad Fitzpatrick [Thu, 25 Sep 2014 00:01:54 +0000 (17:01 -0700)]
net/http: check for CloseWrite interface, not TCPConn implementation

Fixes #8724

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/148040043

10 years agonet/http: support https_proxy in ProxyFromEnvironment
Brad Fitzpatrick [Wed, 24 Sep 2014 23:55:39 +0000 (16:55 -0700)]
net/http: support https_proxy in ProxyFromEnvironment

Fixes #6181

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/148980043

10 years agocmd/go: fix bytes and net the right way
Russ Cox [Wed, 24 Sep 2014 23:18:01 +0000 (19:18 -0400)]
cmd/go: fix bytes and net the right way

Not sure why they used empty.s and all these other
packages were special cased in cmd/go instead.
Add them to the list.

This avoids problems with net .s files being compiled
with gcc in cgo mode and gcc not supporting // comments
on ARM.

Not a problem with bytes, but be consistent.

The last change fixed the ARM build but broke the Windows build.
Maybe *this* will make everyone happy. Sigh.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/144530046

10 years agonet: only "build" empty.s in non-cgo mode
Russ Cox [Wed, 24 Sep 2014 23:09:43 +0000 (19:09 -0400)]
net: only "build" empty.s in non-cgo mode

In cgo mode it gets passed to gcc, and on ARM
it appears that gcc does not support // comments.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/142640043

10 years agoruntime: more NOPTR
Russ Cox [Wed, 24 Sep 2014 23:04:06 +0000 (19:04 -0400)]
runtime: more NOPTR

Fixes linux builds (_vdso); may fix others.
I can at least cross-compile cmd/go for every
implemented system now.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/142630043

10 years agoos: fix Args setup on Windows
Brad Fitzpatrick [Wed, 24 Sep 2014 22:50:54 +0000 (18:50 -0400)]
os: fix Args setup on Windows

Should fix the Windows build. Untested.

on Windows, args are made by src/os/exec_windows.go, not package runtime.
runtime·goargs has if(Windows) return;

The two init funcs in pkg os were conflicting, with the second
overwriting Args back to an empty slice.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/143540044

10 years agoruntime: more NOPTR
Russ Cox [Wed, 24 Sep 2014 21:50:44 +0000 (17:50 -0400)]
runtime: more NOPTR

Fixes (or makes better) various builds.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/146280043

10 years agocmd/go: strip -fsanitize= flags when building cgo object
Dmitriy Vyukov [Wed, 24 Sep 2014 21:49:04 +0000 (01:49 +0400)]
cmd/go: strip -fsanitize= flags when building cgo object
Fixes #8788.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/142470043

10 years agobuild: fix elf builds
Russ Cox [Wed, 24 Sep 2014 21:45:11 +0000 (14:45 -0700)]
build: fix elf builds

Corrections due to new strict type rules for data+bss.
Also disable misc/cgo/cdefstest since you can't compile C code anymore.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/148050044

10 years agofmt: document and fix the handling of precision for strings and byte slices
Rob Pike [Wed, 24 Sep 2014 21:33:30 +0000 (14:33 -0700)]
fmt: document and fix the handling of precision for strings and byte slices
Previous behavior was undocumented and inconsistent. Now it is documented
and consistent and measures the input size, since that makes more sense
when talking about %q and %x. For %s the change has no effect.

Fixes #8151.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/144540044

10 years agocmd/cc, cmd/ld, runtime: disallow conservative data/bss objects
Russ Cox [Wed, 24 Sep 2014 20:55:26 +0000 (16:55 -0400)]
cmd/cc, cmd/ld, runtime: disallow conservative data/bss objects

In linker, refuse to write conservative (array of pointers) as the
garbage collection type for any variable in the data/bss GC program.

In the linker, attach the Go type to an already-read C declaration
during dedup. This gives us Go types for C globals for free as long
as the cmd/dist-generated Go code contains the declaration.
(Most runtime C declarations have a corresponding Go declaration.
Both are bss declarations and so the linker dedups them.)

In cmd/dist, add a few more C files to the auto-Go-declaration list
in order to get Go type information for the C declarations into the linker.

In C compiler, mark all non-pointer-containing global declarations
and all string data as NOPTR. This allows them to exist in C files
without any corresponding Go declaration. Count C function pointers
as "non-pointer-containing", since we have no heap-allocated C functions.

In runtime, add NOPTR to the remaining pointer-containing declarations,
none of which refer to Go heap objects.

In runtime, also move os.Args and syscall.envs data into runtime-owned
variables. Otherwise, in programs that do not import os or syscall, the
runtime variables named os.Args and syscall.envs will be missing type
information.

I believe that this CL eliminates the final source of conservative GC scanning
in non-SWIG Go programs, and therefore...

Fixes #909.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/149770043

10 years agodebug/dwarf: correct name for clang-generated complex type
Russ Cox [Wed, 24 Sep 2014 20:53:47 +0000 (16:53 -0400)]
debug/dwarf: correct name for clang-generated complex type

Fixes #8694.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/143570043

10 years agocmd/gc: fix import of package with var func returning _
Russ Cox [Wed, 24 Sep 2014 20:53:34 +0000 (16:53 -0400)]
cmd/gc: fix import of package with var func returning _

Fixes #8280.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://golang.org/cl/146240043

10 years agosrc: pass GO_GCFLAGS down to go test std
Brad Fitzpatrick [Wed, 24 Sep 2014 19:42:47 +0000 (12:42 -0700)]
src: pass GO_GCFLAGS down to go test std

Update #8725

LGTM=rsc, josharian
R=rsc, josharian
CC=golang-codereviews
https://golang.org/cl/149000043

10 years agocmd/gc: run escape analysis always (even in -N mode)
Russ Cox [Wed, 24 Sep 2014 19:20:03 +0000 (15:20 -0400)]
cmd/gc: run escape analysis always (even in -N mode)

Fixes #8585.
Removes some little-used code paths.

LGTM=josharian
R=golang-codereviews, minux, josharian
CC=golang-codereviews, iant, r
https://golang.org/cl/132970043

10 years agodoc/go1.4.txt: document that C sources in non-cgo packages are no longer allowed
Russ Cox [Wed, 24 Sep 2014 19:10:54 +0000 (15:10 -0400)]
doc/go1.4.txt: document that C sources in non-cgo packages are no longer allowed

CC=golang-codereviews
https://golang.org/cl/145890046

10 years agocmd/go: prohibit C sources files unless using cgo
Russ Cox [Wed, 24 Sep 2014 19:10:38 +0000 (15:10 -0400)]
cmd/go: prohibit C sources files unless using cgo

Those C files would have been compiled with 6c.
It's close to impossible to use C correctly anymore,
and the C compilers are going away eventually.
Make them unavailable now.

go1.4.txt change in CL 145890046

LGTM=iant
R=iant
CC=golang-codereviews, r
https://golang.org/cl/149720043

10 years agoruntime: fix LastGC comment
Russ Cox [Wed, 24 Sep 2014 18:18:25 +0000 (14:18 -0400)]
runtime: fix LastGC comment

I have no idea what "absolute time" means.

LGTM=dvyukov, r
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/144320043

10 years agoruntime: keep g->syscallsp consistent after cgo->Go callbacks
Hector Martin Cantero [Wed, 24 Sep 2014 17:20:25 +0000 (13:20 -0400)]
runtime: keep g->syscallsp consistent after cgo->Go callbacks

Normally, the caller to runtime.entersyscall() must not return before
calling runtime.exitsyscall(), lest g->syscallsp become a dangling
pointer. runtime.cgocallbackg() violates this constraint. To work around
this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then
restore them after calling runtime.entersyscall(), which restores the
syscall stack frame pointer saved by cgocall. This allows the GC to
correctly trace a goroutine that is currently returning from a
Go->cgo->Go chain.

This also adds a check to proc.c that panics if g->syscallsp is clearly
invalid. It is not 100% foolproof, as it will not catch a case where the
stack was popped then pushed back beyond g->syscallsp, but it does catch
the present cgo issue and makes existing tests fail without the bugfix.

Fixes #7978.

LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc
CC=golang-codereviews, rsc
https://golang.org/cl/131910043

10 years agoA+C: Hector Martin Cantero (individual CLA)
Russ Cox [Wed, 24 Sep 2014 17:12:15 +0000 (13:12 -0400)]
A+C: Hector Martin Cantero (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/147080043

10 years agocmd/pack: fix c command for existing file
Rob Pike [Wed, 24 Sep 2014 01:24:35 +0000 (18:24 -0700)]
cmd/pack: fix c command for existing file
There were at least two bugs:
1) It would overwrite a non-archive.
2) It would truncate a non-archive and then fail.
In general the file handling was too clever to be correct.
Make it more straightforward, doing the creation
separately from archive management.

Fixes #8369.

LGTM=adg, iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/147010046

10 years agoos: add a comment inside RemoveAll
Brad Fitzpatrick [Tue, 23 Sep 2014 21:55:19 +0000 (14:55 -0700)]
os: add a comment inside RemoveAll

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/149950043

10 years agoos: fix another case where RemoveAll should return nil
Brad Fitzpatrick [Tue, 23 Sep 2014 21:26:20 +0000 (14:26 -0700)]
os: fix another case where RemoveAll should return nil

This hopefully fixes issue 8793.

Fixes #8793

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/150860046

10 years agoruntime: fix runtime.Breakpoint on ARMv5
Dave Cheney [Tue, 23 Sep 2014 05:34:38 +0000 (15:34 +1000)]
runtime: fix runtime.Breakpoint on ARMv5

Fixes #8775.

Use the illegal instruction suggested by Ian in https://golang.org/cl/144180043/#msg4 on all arm arches.

LGTM=minux
R=golang-codereviews, gobot, rsc
CC=golang-codereviews, iant, minux
https://golang.org/cl/146130043

10 years agoruntime: remove unused function declaration
Dmitriy Vyukov [Tue, 23 Sep 2014 02:51:53 +0000 (19:51 -0700)]
runtime: remove unused function declaration

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/145970043

10 years agotext/template: type-check chained node as argument
Rob Pike [Tue, 23 Sep 2014 00:48:13 +0000 (17:48 -0700)]
text/template: type-check chained node as argument
Was just a missing case (literally) in the type checker.

Fixes #8473.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/142460043

10 years agofmt: document that self-recursive data structures can be fatal
Rob Pike [Mon, 22 Sep 2014 22:35:25 +0000 (15:35 -0700)]
fmt: document that self-recursive data structures can be fatal

Fixes #8241.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/144420043

10 years agodoc/go1.4.txt: text/template comparison functions allow int==uint
Rob Pike [Mon, 22 Sep 2014 19:00:37 +0000 (12:00 -0700)]
doc/go1.4.txt: text/template comparison functions allow int==uint

CC=golang-codereviews
https://golang.org/cl/142450043

10 years agofmt: make printing of ints 25-35% faster
Rob Pike [Mon, 22 Sep 2014 18:58:15 +0000 (11:58 -0700)]
fmt: make printing of ints 25-35% faster
Inspired by a remark by Leonard Holz, use constants for division

BenchmarkSprintfEmpty           130           132           +1.54%
BenchmarkSprintfString          438           437           -0.23%
BenchmarkSprintfInt             417           414           -0.72%
BenchmarkSprintfIntInt          663           691           +4.22%
BenchmarkSprintfPrefixedInt     791           774           -2.15%
BenchmarkSprintfFloat           701           686           -2.14%
BenchmarkManyArgs               2584          2469          -4.45%
BenchmarkFprintInt              488           357           -26.84%
BenchmarkFprintIntNoAlloc       402           265           -34.08%
BenchmarkScanInts               1244346       1267574       +1.87%
BenchmarkScanRecursiveInt       1748741       1724138       -1.41%

Update #3463

LGTM=josharian, rsc
R=golang-codereviews, josharian, rsc
CC=golang-codereviews
https://golang.org/cl/144250043

10 years agotext/template: allow comparison functions to work between any integers
Rob Pike [Mon, 22 Sep 2014 18:46:02 +0000 (11:46 -0700)]
text/template: allow comparison functions to work between any integers
Previously, signed and unsigned integers could not be compared, but
this has problems with things like comparing 'x' with a byte in a string.
Since signed and unsigned integers have a well-defined ordering,
even though their types are different, and since we already allow
comparison regardless of the size of the integers, why not allow it
regardless of the sign?

Integers only, a fine place to draw the line.

Fixes #7489.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/149780043

10 years agodatabase/sql: Close per-tx prepared statements when the associated tx ends
Marko Tiikkaja [Mon, 22 Sep 2014 13:19:27 +0000 (09:19 -0400)]
database/sql: Close per-tx prepared statements when the associated tx ends

LGTM=bradfitz
R=golang-codereviews, bradfitz, mattn.jp
CC=golang-codereviews
https://golang.org/cl/131650043

10 years agonet/http: replace z_last_test hack with testing.Main
Brad Fitzpatrick [Mon, 22 Sep 2014 13:13:09 +0000 (09:13 -0400)]
net/http: replace z_last_test hack with testing.Main

LGTM=adg
R=rsc, adg
CC=golang-codereviews
https://golang.org/cl/144240043

10 years agoimage/gif: don't let the per-frame transparent index modify the global
Nigel Tao [Mon, 22 Sep 2014 04:29:45 +0000 (14:29 +1000)]
image/gif: don't let the per-frame transparent index modify the global
palette.

Fixes #7993.

LGTM=r
R=r
CC=golang-codereviews, james.jdunne
https://golang.org/cl/138600043

10 years agoruntime: be very careful with bad pointer tests
Keith Randall [Sun, 21 Sep 2014 06:31:11 +0000 (23:31 -0700)]
runtime: be very careful with bad pointer tests

Saw this on a test:

runtime: bad pointer in frame runtime_test.testSetPanicOnFault at 0xc20801c6b0: 0xfff
fatal error: bad pointer!

runtime stack:
...
copystack(0xc2081bf7a0, 0x1000)
        /root/work/solaris-amd64-smartos-2dde8b453d26/go/src/runtime/stack.c:621 +0x173 fp=0xfffffd7ffd5ffee0 sp=0xfffffd7ffd5ffe20
runtime.newstack()
        /root/work/solaris-amd64-smartos-2dde8b453d26/go/src/runtime/stack.c:774 +0x552 fp=0xfffffd7ffd5fff90 sp=0xfffffd7ffd5ffee0
runtime.morestack()
        /root/work/solaris-amd64-smartos-2dde8b453d26/go/src/runtime/asm_amd64.s:324 +0x90 fp=0xfffffd7ffd5fff98 sp=0xfffffd7ffd5fff90

goroutine 163354 [stack growth]:
...
runtime.convT2E(0x587000, 0xc20807bea8, 0x0, 0x0)
        /root/work/solaris-amd64-smartos-2dde8b453d26/go/src/runtime/iface.go:141 +0xd2 fp=0xc20801c678 sp=0xc20801c640
runtime_test.testSetPanicOnFault(0xc20822c510, 0xfff, 0xc20801c748)
        /root/work/solaris-amd64-smartos-2dde8b453d26/go/src/runtime/runtime_test.go:211 +0xc6 fp=0xc20801c718 sp=0xc20801c678
...

This test is testing bad pointers.  It loads the bad pointer into a pointer variable,
but before it gets a chance to dereference it, calls convT2E.  That call causes a stack copy,
which exposes that live but bad pointer variable.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/146880043

10 years agoruntime: Fix interaction between Goexit and defers
Keith Randall [Fri, 19 Sep 2014 23:33:14 +0000 (16:33 -0700)]
runtime: Fix interaction between Goexit and defers

When running defers, we must check whether the defer
has already been marked as started so we don't run it twice.

Fixes #8774.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/142280044

10 years agospec: add dropped comma
Rob Pike [Fri, 19 Sep 2014 21:13:51 +0000 (14:13 -0700)]
spec: add dropped comma
The proposed text in the last CL had a comma that was missing from the submitted spec.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/150720043

10 years agospec: clarify panic behavior when deferring nil functions
Robert Griesemer [Fri, 19 Sep 2014 20:32:07 +0000 (13:32 -0700)]
spec: clarify panic behavior when deferring nil functions

Fixes #8107.

LGTM=iant, rsc, r
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/145960043

10 years agocmd/go: fix typo
Sameer Ajmani [Fri, 19 Sep 2014 19:59:47 +0000 (15:59 -0400)]
cmd/go: fix typo

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/138700043

10 years agonet/http: document server recovering panics
Russ Cox [Fri, 19 Sep 2014 17:53:33 +0000 (13:53 -0400)]
net/http: document server recovering panics

Fixes #8594.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/145760043

10 years agoruntime: add runtime· prefix to some static variables
Russ Cox [Fri, 19 Sep 2014 17:51:23 +0000 (13:51 -0400)]
runtime: add runtime· prefix to some static variables

Pure renaming. This will make an upcoming CL have smaller diffs.

LGTM=dvyukov, iant
R=iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/142280043

10 years agocmd/go, testing: add TestMain support
Russ Cox [Fri, 19 Sep 2014 17:51:06 +0000 (13:51 -0400)]
cmd/go, testing: add TestMain support

Fixes #8202.

LGTM=r, bradfitz
R=r, josharian, bradfitz
CC=golang-codereviews
https://golang.org/cl/148770043

10 years agonet/http: ensured that proxy errors are returned by Transport.RoundTrip.
John Tuley [Fri, 19 Sep 2014 15:28:38 +0000 (11:28 -0400)]
net/http: ensured that proxy errors are returned by Transport.RoundTrip.

Fixes #8755.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews, jtuley
https://golang.org/cl/136710044

10 years agoruntime: rename SchedType to SchedT
Russ Cox [Fri, 19 Sep 2014 03:51:22 +0000 (23:51 -0400)]
runtime: rename SchedType to SchedT

CL 144940043 renamed it from Sched to SchedType
to avoid a lowercasing conflict in the Go code with
the variable named sched.
We've been using just T resolve those conflicts, not Type.

The FooType pattern is already taken for the kind-specific
variants of the runtime Type structure: ChanType, MapType,
and so on. SchedType isn't a Type.

LGTM=bradfitz, khr
R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/145180043

10 years agosyscall: mark ECONNRESET, ECONNABORTED as temporary network errors
Russ Cox [Fri, 19 Sep 2014 03:07:36 +0000 (23:07 -0400)]
syscall: mark ECONNRESET, ECONNABORTED as temporary network errors

Fixes #6163.

LGTM=adg
R=golang-codereviews, adg, dvyukov
CC=golang-codereviews
https://golang.org/cl/141600043

10 years agoruntime: release Windows thread handle in unminit
Russ Cox [Fri, 19 Sep 2014 02:33:49 +0000 (22:33 -0400)]
runtime: release Windows thread handle in unminit

Fixes #8517.

LGTM=dvyukov, alex.brainman
R=golang-codereviews, dvyukov, alex.brainman
CC=golang-codereviews
https://golang.org/cl/145890044

10 years agoruntime: fix GOARM<7 build
Dave Cheney [Fri, 19 Sep 2014 02:02:21 +0000 (02:02 +0000)]
runtime: fix GOARM<7 build

Update #8690

If liblink determines that the host doesn't support TLS it replaces the MRC call with a BL runtime.tls_read_fallback. The problem is save_g doesn't expect anyone to make any BL calls and hasn't setup its own link register properly so when runtime.tls_read_fallback returns the LR points to save_g, not save_g's caller so the RET at the end of the function turns into an infinite loop.

This fix is only a proof of concept, I think the real fix should go into liblink as its MRC substitution is not as transparent as expected.

LGTM=rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/143050043

10 years agopath/filepath: document that Glob ignores i/o errors
Russ Cox [Fri, 19 Sep 2014 01:50:22 +0000 (21:50 -0400)]
path/filepath: document that Glob ignores i/o errors

Fixes #8008.

LGTM=adg
R=golang-codereviews, nightlyone, adg
CC=golang-codereviews
https://golang.org/cl/138630045

10 years agoruntime: revise TestSetPanicOnFault
Russ Cox [Fri, 19 Sep 2014 01:43:09 +0000 (21:43 -0400)]
runtime: revise TestSetPanicOnFault

We can't assume all those addresses are unmapped.
But at least one should be.

What we're really testing is that the program doesn't crash.

Fixes #8542.

LGTM=iant
R=golang-codereviews, iant, minux
CC=golang-codereviews
https://golang.org/cl/144120043

10 years agoruntime: allow OutputDebugString to be sent to debugger
Alex Brainman [Fri, 19 Sep 2014 01:38:48 +0000 (11:38 +1000)]
runtime: allow OutputDebugString to be sent to debugger

We mark DBG_PRINTEXCEPTION_C messages in VEH handler
as handled, thus preventing debugger from seeing them.
I don't see reason for doing that. The comment warns
of crashes, but I added test and don't see any crashes.

This is also simplify VEH handler before making
changes to fix issue 8006.

Update #8006

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/146800043

10 years agoreflect: adjust Value.String to give correct answer for methods
Russ Cox [Fri, 19 Sep 2014 01:19:18 +0000 (21:19 -0400)]
reflect: adjust Value.String to give correct answer for methods

Fixes #7859.

LGTM=r
R=adonovan, r
CC=golang-codereviews
https://golang.org/cl/136710043

10 years agoos: handle 'has been removed' error as IsNotExist on Plan 9
David du Colombier [Fri, 19 Sep 2014 01:16:01 +0000 (21:16 -0400)]
os: handle 'has been removed' error as IsNotExist on Plan 9

It fixes the TestRemoveAllRace test introduced
in CL 145860043.

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/147820044

10 years agoruntime: remove useless code around of EXCEPTION_BREAKPOINT
Alex Brainman [Fri, 19 Sep 2014 01:14:51 +0000 (11:14 +1000)]
runtime: remove useless code around of EXCEPTION_BREAKPOINT

This is to simplify VEH handler before making
changes to fix issue 8006.

Update #8006

LGTM=adg, rsc
R=golang-codereviews, adg, rsc
CC=golang-codereviews
https://golang.org/cl/138630043

10 years agoruntime: fix Windows SysUsed
Russ Cox [Fri, 19 Sep 2014 00:41:00 +0000 (20:41 -0400)]
runtime: fix Windows SysUsed

Same fix as for SysUnused.
Fixes #8038.

LGTM=iant, alex.brainman
R=golang-codereviews, iant, alex.brainman
CC=golang-codereviews
https://golang.org/cl/147820043

10 years agoruntime: show frames for exported runtime functions
Russ Cox [Fri, 19 Sep 2014 00:35:36 +0000 (20:35 -0400)]
runtime: show frames for exported runtime functions

The current Windows build failure happens because by
default runtime frames are excluded from stack traces.
Apparently the Windows breakpoint path dies with an
ordinary panic, while the Unix path dies with a throw.
Breakpoint is a strange function and I don't mind that it's
a little different on the two operating systems.

The panic squelches runtime frames but the throw shows them,
because throw is considered something that shouldn't have
happened at all, so as much detail as possible is wanted.

The runtime exclusion is meant to prevents printing too much noise
about internal runtime details. But exported functions are
not internal details, so show exported functions.
If the program dies because you called runtime.Breakpoint,
it's okay to see that frame.
This makes the Breakpoint test show Breakpoint in the
stack trace no matter how it is handled.

Should fix Windows build.
Tested on Unix by changing Breakpoint to fault instead
of doing a breakpoint.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/143300043

10 years agolib9, cmd/ld: fixes for cross-linking on a Windows host
Ian Lance Taylor [Fri, 19 Sep 2014 00:27:26 +0000 (17:27 -0700)]
lib9, cmd/ld: fixes for cross-linking on a Windows host

This fixes a couple of problems that occur when the linker
removes its temporary directory on Windows.  The linker only
creates and removes a temporary directory when doing external
linking.  Windows does not yet support external linking.
Therefore, these problems are only seen when using a
cross-compiler hosted on Windows.

In lib9, FindFirstFileW returns just the file name, not the
full path name.  Don't assume that we will find a slash.
Changed the code to work either way just in case.

In ld, Windows requires that files be closed before they are
removed, so close the output file before we might try to
remove it.

Fixes #8723.

LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=golang-codereviews
https://golang.org/cl/141690043

10 years agoos: skip TestRemoveAllRace on Windows
Russ Cox [Fri, 19 Sep 2014 00:13:07 +0000 (20:13 -0400)]
os: skip TestRemoveAllRace on Windows

It's just fundamentally incompatible with
Windows' pickiness about removing things
that are in use.

TBR=brainman
CC=golang-codereviews
https://golang.org/cl/142270043

10 years agogo/doc: document rationale for recent change
Robert Griesemer [Thu, 18 Sep 2014 23:53:35 +0000 (16:53 -0700)]
go/doc: document rationale for recent change

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/143290043

10 years agobytes, strings: document that FieldsFunc f must not be stateful
Russ Cox [Thu, 18 Sep 2014 23:40:31 +0000 (19:40 -0400)]
bytes, strings: document that FieldsFunc f must not be stateful

Fixes #8738.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/143260045

10 years agosyscall: fix infinite recursion in itoa
Russ Cox [Thu, 18 Sep 2014 23:40:06 +0000 (19:40 -0400)]
syscall: fix infinite recursion in itoa

Fixes #8332.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/138650044

10 years agogo/doc: treat _ consts as exported
Josh Bleecher Snyder [Thu, 18 Sep 2014 22:43:06 +0000 (15:43 -0700)]
go/doc: treat _ consts as exported

Fixes #5397.

LGTM=adg
R=gri, adg
CC=golang-codereviews, rsc
https://golang.org/cl/144110044

10 years agoruntime: fix handling of GOTRACEBACK
David du Colombier [Thu, 18 Sep 2014 21:25:11 +0000 (23:25 +0200)]
runtime: fix handling of GOTRACEBACK

Since CL 130990043, the GOTRACEBACK variable is
only used when the GODEBUG variable is set.
This change restores the original behavior.

LGTM=rsc
R=golang-codereviews, aram, gobot, r, rsc
CC=golang-codereviews
https://golang.org/cl/132520043

10 years agoruntime: delete panicstring; move its checks into gopanic
Russ Cox [Thu, 18 Sep 2014 18:49:24 +0000 (14:49 -0400)]
runtime: delete panicstring; move its checks into gopanic

In Go 1.3 the runtime called panicstring to report errors like
divide by zero or memory faults. Now we call panic (gopanic)
with pre-allocated error values. That new path is missing the
checking that panicstring did, so add it there.

The only call to panicstring left is in cnew, which is problematic
because if it fails, probably the heap is corrupt. In that case,
calling panicstring creates a new errorCString (no allocation there),
but then panic tries to print it, invoking errorCString.Error, which
does a string concatenation (allocating), which then dies.
Replace that one panicstring with a throw: cnew is for allocating
runtime data structures and should never ask for an inappropriate
amount of memory.

With panicstring gone, delete newErrorCString, errorCString.
While we're here, delete newErrorString, not called by anyone.
(It can't be: that would be C code calling Go code that might
block or grow the stack.)

Found while debugging a malloc corruption.
This resulted in 'panic during panic' instead of a more useful message.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/138290045

10 years agoos: avoid error result when dir is removed out from under RemoveAll
Russ Cox [Thu, 18 Sep 2014 18:48:47 +0000 (14:48 -0400)]
os: avoid error result when dir is removed out from under RemoveAll

Fixes #7776.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, r
https://golang.org/cl/145860043

10 years agonet: disable TestDialMultiFDLeak
Russ Cox [Thu, 18 Sep 2014 18:48:26 +0000 (14:48 -0400)]
net: disable TestDialMultiFDLeak

It fails about 25% of the time on OS X.
I don't know what it's trying to do.
Created issue 8764 to correct this, but for now disable.

LGTM=bradfitz, mikioh.mikioh
R=bradfitz, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/144070044

10 years agoencoding/gob: speedup encoding
Dmitriy Vyukov [Thu, 18 Sep 2014 17:13:15 +0000 (10:13 -0700)]
encoding/gob: speedup encoding

Replace typeLock with copy-on-write map using atomic.Value.

benchmark                               old ns/op     new ns/op     delta
BenchmarkEndToEndPipe                   7722          7709          -0.17%
BenchmarkEndToEndPipe-2                 5114          4344          -15.06%
BenchmarkEndToEndPipe-4                 3192          2429          -23.90%
BenchmarkEndToEndPipe-8                 1833          1438          -21.55%
BenchmarkEndToEndPipe-16                1332          983           -26.20%
BenchmarkEndToEndPipe-32                1444          675           -53.25%
BenchmarkEndToEndByteBuffer             6474          6019          -7.03%
BenchmarkEndToEndByteBuffer-2           4280          2810          -34.35%
BenchmarkEndToEndByteBuffer-4           2264          1774          -21.64%
BenchmarkEndToEndByteBuffer-8           1275          979           -23.22%
BenchmarkEndToEndByteBuffer-16          1257          753           -40.10%
BenchmarkEndToEndByteBuffer-32          1342          644           -52.01%
BenchmarkEndToEndArrayByteBuffer        727725        671349        -7.75%
BenchmarkEndToEndArrayByteBuffer-2      394079        320473        -18.68%
BenchmarkEndToEndArrayByteBuffer-4      211785        178175        -15.87%
BenchmarkEndToEndArrayByteBuffer-8      141003        118857        -15.71%
BenchmarkEndToEndArrayByteBuffer-16     139249        86367         -37.98%
BenchmarkEndToEndArrayByteBuffer-32     144128        73454         -49.04%

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/147720043

10 years agofmt: fix allocation tests
Josh Bleecher Snyder [Thu, 18 Sep 2014 16:45:58 +0000 (09:45 -0700)]
fmt: fix allocation tests

Converting an integer to an interface{} allocates as of CL 130240043.

Fixes #8617.

LGTM=r
R=r
CC=golang-codereviews, khr
https://golang.org/cl/141700043

10 years agonet: separate NaCl dependent placeholders from BSD's
Mikio Hara [Thu, 18 Sep 2014 10:17:55 +0000 (19:17 +0900)]
net: separate NaCl dependent placeholders from BSD's

To clarify the dependency of NaCl platform.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/143830044

10 years agosync/atomic: remove unnecessary race instrumentation in Value
Dmitriy Vyukov [Thu, 18 Sep 2014 04:22:11 +0000 (21:22 -0700)]
sync/atomic: remove unnecessary race instrumentation in Value
It is left from the time when Value was implemented in assembly.
Now it is implemented in Go and race detector understands Go.
In particular the atomic operations must provide
all necessary synchronization.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews, khr, rsc
https://golang.org/cl/145880043

10 years agoruntime: output number of goroutines in GC trace
Dmitriy Vyukov [Thu, 18 Sep 2014 03:38:50 +0000 (20:38 -0700)]
runtime: output number of goroutines in GC trace
Example output:
gc26(1): 1+0+1038+0 us, 0 -> 1 MB, 19074 (88777-69703) objects, 5 gs, 184/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
It's useful to understand long scan times,
because goroutine traceback is slow.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/136310044

10 years agoimage/gif: fix GIF encoding of sub-images.
Nigel Tao [Thu, 18 Sep 2014 02:43:01 +0000 (12:43 +1000)]
image/gif: fix GIF encoding of sub-images.

benchmark                    old ns/op     new ns/op     delta
BenchmarkEncode              8641055       8646829       +0.07%

Fixes #7792.

LGTM=r
R=r
CC=dbathgate, golang-codereviews
https://golang.org/cl/147730043

10 years agoA+C: John Tuley (individual CLA)
Brad Fitzpatrick [Wed, 17 Sep 2014 20:52:01 +0000 (16:52 -0400)]
A+C: John Tuley (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/142200043

10 years agoruntime: free stacks of Gdead goroutines at GC time
Keith Randall [Wed, 17 Sep 2014 20:25:46 +0000 (13:25 -0700)]
runtime: free stacks of Gdead goroutines at GC time

We could probably free the G structures as well, but
for the allg list.  Leaving that for another day.

Fixes #8287

LGTM=rsc
R=golang-codereviews, dvyukov, khr, rsc
CC=golang-codereviews
https://golang.org/cl/145010043

10 years agoruntime: print more detail in adjustframe crash
Russ Cox [Wed, 17 Sep 2014 20:12:17 +0000 (16:12 -0400)]
runtime: print more detail in adjustframe crash

The logic here is copied from mgc0.c's scanframe.
Mostly it is messages although the minsize code is new
(and I believe necessary).

I am hoping to get more information about the current
arm build failures (or, if it's the minsize thing, fix them).

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/143180043

10 years agosync/atomic: add more missing Go prototype
Russ Cox [Wed, 17 Sep 2014 19:30:48 +0000 (15:30 -0400)]
sync/atomic: add more missing Go prototype

Should fix nacl/arm build.

TBR=minux
CC=golang-codereviews
https://golang.org/cl/145070043

10 years agodoc/go1.4.txt: add tinyallocs change
Russ Cox [Wed, 17 Sep 2014 18:50:49 +0000 (14:50 -0400)]
doc/go1.4.txt: add tinyallocs change

CC=golang-codereviews
https://golang.org/cl/145050043

10 years agoruntime: account for tiny allocs, for testing.AllocsPerRun
Russ Cox [Wed, 17 Sep 2014 18:49:32 +0000 (14:49 -0400)]
runtime: account for tiny allocs, for testing.AllocsPerRun

Fixes #8734.

LGTM=r, bradfitz, dvyukov
R=bradfitz, r, dvyukov
CC=golang-codereviews, iant, khr
https://golang.org/cl/143150043

10 years agodoc/go1.4.txt: reduced stack size
Rob Pike [Wed, 17 Sep 2014 15:39:18 +0000 (08:39 -0700)]
doc/go1.4.txt: reduced stack size

CC=golang-codereviews
https://golang.org/cl/144050043

10 years agoruntime: change minimum stack size to 2K.
Keith Randall [Wed, 17 Sep 2014 15:32:15 +0000 (08:32 -0700)]
runtime: change minimum stack size to 2K.

It will be 8K on windows because it needs 4K for the OS.
Similarly, plan9 will be 4K.

On linux/amd64, reduces size of 100,000 goroutines
from ~819MB to ~245MB.

Update #7514

LGTM=dvyukov
R=golang-codereviews, dvyukov, khr, aram
CC=golang-codereviews
https://golang.org/cl/145790043