]> Cypherpunks repositories - gostls13.git/log
gostls13.git
14 years agogc: unsafe.Pointer is not a pointer
Russ Cox [Mon, 7 Mar 2011 20:10:01 +0000 (15:10 -0500)]
gc: unsafe.Pointer is not a pointer

Change unsafe.Pointer to be its own kind of
type, instead of making it equivalent to *any.
The change complicates import and export
but avoids the need to find all the places that
operate on pointers but should not operate on
unsafe.Pointer.

Fixes #1566. (a different way)
Fixes #1582.

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

14 years agogob: support GobEncoder for type T when the receiver is *T.
Rob Pike [Mon, 7 Mar 2011 20:08:31 +0000 (12:08 -0800)]
gob: support GobEncoder for type T when the receiver is *T.
Still to do: **T.

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

14 years agohttp: change Hijacker to return a net.Conn
Brad Fitzpatrick [Mon, 7 Mar 2011 20:04:04 +0000 (12:04 -0800)]
http: change Hijacker to return a net.Conn

net.Conn is itself a io.ReadWriteCloser, so
most code should be unaffected.

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

14 years agohttp: fix cookie_test
Russ Cox [Mon, 7 Mar 2011 19:45:45 +0000 (14:45 -0500)]
http: fix cookie_test

Was only breaking on some dashboard builds because
not all run the network tests.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240086

14 years agogo/ast, go/parser: populate identifier scopes at parse time
Robert Griesemer [Mon, 7 Mar 2011 19:01:23 +0000 (11:01 -0800)]
go/ast, go/parser: populate identifier scopes at parse time

The parser populates all scopes for a given file (except
type-related scopes for structs, interfaces, and methods
of types) at parse time.

A new parser flag, DeclarationErrors, enables error messages
related to declaration errors (as far as it is possible to
provide them).

The resulting AST has all (non-field, non-method) identifiers
resolved that can be resolved w/o doing imports or parsing
missing package files.

The ast.File node contains the (partially complete)
package scope and a list of unresolved global identifiers.

All type-specific data structures have been removed from the AST.

The existing typechecker is functional but needs to be adjusted
(simplified) accordingly. Utility functions to resolve all
identifiers for a package (after handling imports and parsing
all package files) are  missing.

Unrelated changes:
- Rename typechecker/testdata files to that they are not considered
  by gofmt.
- Minor cleanups/simplifications.

Parses all .go files in src and misc without declaration errors.
Runs all tests. Changes do not affect gofmt output.

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

14 years agomisc/dashboard/builder/doc.go: gofmt it
Robert Griesemer [Mon, 7 Mar 2011 19:00:57 +0000 (11:00 -0800)]
misc/dashboard/builder/doc.go: gofmt it

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

14 years agogoinstall: handle .c files with gc when cgo isn't used
Gustavo Niemeyer [Mon, 7 Mar 2011 17:53:39 +0000 (12:53 -0500)]
goinstall: handle .c files with gc when cgo isn't used

As a data point, this enables goinstall to handle the standard
syscall package almost unchanged (there's one file with the _bsd
extension, and a .c file which isn't supposed to be compiled in).

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

14 years agorpc: clean up dregs from June 2010
Russ Cox [Mon, 7 Mar 2011 17:09:00 +0000 (12:09 -0500)]
rpc: clean up dregs from June 2010

In June 2010 I accidentally checked in pending
changes to package rpc in a compiler CL:
https://golang.org/cl/1736041

I backed them out by hand in a followup CL:
https://golang.org/cl/1736042

That followup CL missed the lines being deleted
in this CL, spotted by Petar.

hg diff -r 5678:5683 src/cmd/prof/gopprof \
        src/pkg/image/png/reader.go \
        src/pkg/rpc/client.go \
        src/pkg/rpc/jsonrpc/all_test.go \
        src/pkg/rpc/jsonrpc/server.go \
        src/pkg/rpc/server.go \
        test/arm-pass.txt

confirms that these lines in server.go are the
only ones that were missed by the original followup.

Fixes #1583.

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

14 years agogoinstall: handle .s files with gc
Gustavo Niemeyer [Mon, 7 Mar 2011 17:08:52 +0000 (12:08 -0500)]
goinstall: handle .s files with gc

As a data point, with this change goinstall is able to
fully build package big out of the box.

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

14 years agohttp: adapt Cookie code to follow IETF draft
Petar Maymounkov [Mon, 7 Mar 2011 17:08:39 +0000 (12:08 -0500)]
http: adapt Cookie code to follow IETF draft

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

14 years agoruntime: fix windows/386 build
Russ Cox [Mon, 7 Mar 2011 16:48:35 +0000 (11:48 -0500)]
runtime: fix windows/386 build

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

14 years agogoinstall: fix build
Russ Cox [Mon, 7 Mar 2011 16:33:26 +0000 (11:33 -0500)]
goinstall: fix build

func init runs *after* var declarations

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

14 years agohash: new FNV-1a implementation
Pascal S. de Kloe [Mon, 7 Mar 2011 16:11:21 +0000 (11:11 -0500)]
hash: new FNV-1a implementation

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

14 years agogoinstall: handle $(GOOS) and $(GOARCH) in filenames
Gustavo Niemeyer [Mon, 7 Mar 2011 15:54:53 +0000 (10:54 -0500)]
goinstall: handle $(GOOS) and $(GOARCH) in filenames

This enables goinstall to handle .go and .c files (for cgo)
which are named after the following patterns:

    name_$(GOOS).*
    name_$(GOARCH).*
    name_$(GOOS)_$(GOARCH).*

Files with those names are only included if the $(GOOS) and
$(GOARCH) match the current system.

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

14 years agoruntime: scheduler, cgo reorganization
Russ Cox [Mon, 7 Mar 2011 15:37:42 +0000 (10:37 -0500)]
runtime: scheduler, cgo reorganization

* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).

Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).

The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack.  Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler.  If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless.  Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.

* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.

Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.

The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).

The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc.  Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.

Fixes #1560.

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

14 years agoio: reimplement Pipe
Russ Cox [Mon, 7 Mar 2011 15:37:28 +0000 (10:37 -0500)]
io: reimplement Pipe

No known bugs in the current pipe,
but this one is simpler and easier to
understand.

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

14 years agorpc: use httptest.Server for tests
Robert Hencke [Mon, 7 Mar 2011 15:37:10 +0000 (10:37 -0500)]
rpc: use httptest.Server for tests

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

14 years agotag release.2011-03-07.1
Andrew Gerrand [Mon, 7 Mar 2011 05:19:25 +0000 (16:19 +1100)]
tag release.2011-03-07.1

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

14 years agorelease.2011-03-07.1 release.r56 weekly.2011-03-07.1
Andrew Gerrand [Mon, 7 Mar 2011 05:18:24 +0000 (16:18 +1100)]
release.2011-03-07.1

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

14 years agohttp: close after responding to HTTP/1.0 request without Connection: keep-alive
Russ Cox [Mon, 7 Mar 2011 05:14:40 +0000 (00:14 -0500)]
http: close after responding to HTTP/1.0 request without Connection: keep-alive

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

14 years agodoc/codelab/wiki: include into windows build
Alex Brainman [Mon, 7 Mar 2011 04:48:39 +0000 (15:48 +1100)]
doc/codelab/wiki: include into windows build

R=adg, rsc
CC=Joe Poirier, golang-dev
https://golang.org/cl/4257052

14 years agohttp: use Header type consistently
Russ Cox [Mon, 7 Mar 2011 04:02:29 +0000 (23:02 -0500)]
http: use Header type consistently

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

14 years agodoc: amend release.2011-03-07 notes to mention reflect and path changes
Andrew Gerrand [Mon, 7 Mar 2011 03:46:55 +0000 (14:46 +1100)]
doc: amend release.2011-03-07 notes to mention reflect and path changes

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

14 years agohttp: add Hijacker type; remove Hijack from ResponseWriter
Brad Fitzpatrick [Mon, 7 Mar 2011 02:59:50 +0000 (18:59 -0800)]
http: add Hijacker type; remove Hijack from ResponseWriter

The Hijack functionality wasn't removed, but now you have
to test if your ResponseWriter is also a Hijacker:

func ServeHTTP(rw http.ResponseWriter, req *http.Request) {
    if hj, ok := rw.(http.Hijacker); ok {
        hj.Hijack(..)
    }
}

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

14 years agotag release.2011-03-07
Andrew Gerrand [Mon, 7 Mar 2011 02:57:15 +0000 (13:57 +1100)]
tag release.2011-03-07

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

14 years agorelease.2011-03-07 weekly.2011-03-07
Andrew Gerrand [Mon, 7 Mar 2011 02:55:22 +0000 (13:55 +1100)]
release.2011-03-07

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

14 years agoio/ioutil: use filepath.Join, handle trailing / in $TMPDIR
Russ Cox [Mon, 7 Mar 2011 02:52:37 +0000 (21:52 -0500)]
io/ioutil: use filepath.Join, handle trailing / in $TMPDIR

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

14 years agopath/filepath: disable test on windows to fix build
Alex Brainman [Mon, 7 Mar 2011 01:23:57 +0000 (12:23 +1100)]
path/filepath: disable test on windows to fix build

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4235054

14 years agomime/multipart: switch from map to MIMEHeader
Brad Fitzpatrick [Sun, 6 Mar 2011 23:12:03 +0000 (15:12 -0800)]
mime/multipart: switch from map to MIMEHeader

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

14 years agocgo: fix dwarf type parsing
Gustavo Niemeyer [Sun, 6 Mar 2011 23:05:57 +0000 (18:05 -0500)]
cgo: fix dwarf type parsing

The recursive algorithm used to parse types in cgo
has a bug related to building the C type representation.

As an example, when the recursion starts at a type *T,
the C type representation won't be known until type T
itself is parsed.  But then, it is possible that type T
references the type **T internally.  The latter
representation is built based on the one of *T, which
started the recursion, so it won't attempt to parse it
again, and will instead use the current representation
value for *T, which is still empty at this point.

This problem was fixed by introducing a simple TypeRepr
type which builds the string representation lazily,
analogous to how the Go type information is built within
the same algorithm.  This way, even if a type
representation is still unknown at some level in the
recursion, representations dependant on it can still
be created correctly.

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

14 years agopath/filepath: new OS-specific path support
Gustavo Niemeyer [Sun, 6 Mar 2011 22:33:23 +0000 (17:33 -0500)]
path/filepath: new OS-specific path support

The path package now contains only functions which
deal with slashed paths, sensible for any OS when dealing
with network paths or URLs.  OS-specific functionality
has been moved into the new path/filepath package.

This also includes fixes for godoc, goinstall and other
packages which were mixing slashed and OS-specific paths.

R=rsc, gri, mattn, brainman
CC=golang-dev
https://golang.org/cl/4252044

14 years agowebsocket: use httptest.Server for tests
Robert Hencke [Sun, 6 Mar 2011 22:05:12 +0000 (17:05 -0500)]
websocket: use httptest.Server for tests

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

14 years agobuild: remove old cgo files
Russ Cox [Sun, 6 Mar 2011 22:04:24 +0000 (17:04 -0500)]
build: remove old cgo files

Cgo changed to write these files into _obj, but some
trees may still have the old ones in the source directory.
They need to be removed during make clean so that
a subsequent build will use the ones in _obj.

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

14 years agohttp: add cookie support
Petar Maymounkov [Sun, 6 Mar 2011 20:02:06 +0000 (15:02 -0500)]
http: add cookie support

R=rsc1, mattn, bradfitzwork, pascal, bradfitzgo
CC=golang-dev
https://golang.org/cl/4214042

14 years agosyscall: work around FreeBSD execve kernel bug
Devon H. O'Dell [Sun, 6 Mar 2011 19:57:05 +0000 (14:57 -0500)]
syscall: work around FreeBSD execve kernel bug

FreeBSD's execve implementation has an integer underflow in a bounds test which
causes it to erroneously think the argument list is too long when argv[0] is
longer than interpreter + path.

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

14 years agogob: clean up getTypeInfo (address a TODO)
Rob Pike [Sun, 6 Mar 2011 18:50:07 +0000 (10:50 -0800)]
gob: clean up getTypeInfo (address a TODO)
also fix a caching bug.

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

14 years agohttp/cgi: skip test if perl or CGI.pm not available
Russ Cox [Sun, 6 Mar 2011 16:23:47 +0000 (11:23 -0500)]
http/cgi: skip test if perl or CGI.pm not available

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4264047

14 years agofmt: trivial cleanup
Robert Hencke [Sun, 6 Mar 2011 01:55:53 +0000 (17:55 -0800)]
fmt: trivial cleanup

R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4235052

14 years agoA+C: Robert Hencke (individual CLA)
Brad Fitzpatrick [Sun, 6 Mar 2011 01:51:53 +0000 (17:51 -0800)]
A+C: Robert Hencke (individual CLA)

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

14 years agogob: don't send type information about unexported fields.
Rob Pike [Sun, 6 Mar 2011 00:05:35 +0000 (16:05 -0800)]
gob: don't send type information about unexported fields.

A change a while back stop sending data for unexported fields
but due to an oversight the type info was being sent also. It's
inconsequential but wrong to do that.

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

14 years agohttptest: fix docs out-of-sync from earlier renaming
Brad Fitzpatrick [Sat, 5 Mar 2011 23:43:26 +0000 (15:43 -0800)]
httptest: fix docs out-of-sync from earlier renaming

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

14 years agohttptest: introduce TempServer, clean up tests
Brad Fitzpatrick [Sat, 5 Mar 2011 21:51:35 +0000 (13:51 -0800)]
httptest: introduce TempServer, clean up tests

This also breaks fs_test into two parts
as the range tests test http's private httpRange
and I had to change the fs_test package from
"http" to "http_test" to use httptest which otherwise
has a cyclic depedency back on http.

Aside: we should start exposing the Range
stuff in the future.

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

14 years agobuild: avoid calling gomake wrapper in recursive make
Dave Cheney [Sat, 5 Mar 2011 19:53:29 +0000 (14:53 -0500)]
build: avoid calling gomake wrapper in recursive make

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

14 years agohttp: fixed race condition in persist.go
Petar Maymounkov [Sat, 5 Mar 2011 19:44:05 +0000 (14:44 -0500)]
http: fixed race condition in persist.go

R=rsc, bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4266042

14 years agohttp: fix, use WriteProxy
Russ Cox [Sat, 5 Mar 2011 19:35:15 +0000 (14:35 -0500)]
http: fix, use WriteProxy

Fixes #53.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240075

14 years agocompress/flate: fix test
Russ Cox [Sat, 5 Mar 2011 19:35:03 +0000 (14:35 -0500)]
compress/flate: fix test

The test was checking for a buffer to be empty but
actually racing with the background goroutine that
was emptying it.  Left a comment so that the check
is not reintroduced later.

Fixes #1557.

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

14 years agocgo: use correct frame size for 0 arguments
Russ Cox [Sat, 5 Mar 2011 19:24:44 +0000 (14:24 -0500)]
cgo: use correct frame size for 0 arguments

Passing a frame size of 1 was causing the cgo callback
to push 1 byte of arguments onto the stack, making
the stack pointer misaligned, which had the effect of
hiding all the pointers on the stack from the garbage
collector.

SWIG only wraps calls to C++ virtual methods, so it
always has at least 1 argument, so SWIG does not need
to be fixed too.

Fixes #1328.

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

14 years agoA+C: Pascal S. de Kloe (individual CLA)
Russ Cox [Sat, 5 Mar 2011 19:24:26 +0000 (14:24 -0500)]
A+C: Pascal S. de Kloe (individual CLA)

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

14 years agogc, gopack: add some missing flags to the docs.
David Symonds [Sat, 5 Mar 2011 04:21:26 +0000 (20:21 -0800)]
gc, gopack: add some missing flags to the docs.

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

14 years agotime: split os-dependent part into sys.go.
David Symonds [Sat, 5 Mar 2011 03:57:39 +0000 (19:57 -0800)]
time: split os-dependent part into sys.go.

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

14 years agogob: enable the GobEncoder and GobDecoder interfaces.
Rob Pike [Fri, 4 Mar 2011 22:18:52 +0000 (14:18 -0800)]
gob: enable the GobEncoder and GobDecoder interfaces.
These allow data items to control their own representation.

For now, the implementation requires that the value passed
to Encode and Decode must be exactly the type of the
methods' receiver; it cannot be, for instance, T if the receiver
is of type *T.  This will be fixed in a later CL.

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

14 years agohttp/cgi: skip tests on Windows
Brad Fitzpatrick [Fri, 4 Mar 2011 22:12:39 +0000 (14:12 -0800)]
http/cgi: skip tests on Windows

The tests require Perl, not commonly installed on Windows.

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

14 years agoruntime: make printf work on misaligned stack
Russ Cox [Fri, 4 Mar 2011 20:42:39 +0000 (15:42 -0500)]
runtime: make printf work on misaligned stack

(Shouldn't happen, but if it does, it's useful to be
able to use printf to debug it.)

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

14 years agogob: beginning of support for GobEncoder/GobDecoder interfaces.
Rob Pike [Fri, 4 Mar 2011 20:25:18 +0000 (12:25 -0800)]
gob: beginning of support for GobEncoder/GobDecoder interfaces.

This allows a data item that can marshal itself to be transmitted by its
own encoding, enabling some types to be handled that cannot be
normally, plus providing a way to use gobs on data with unexported
fields.

In this CL, the necessary methods are protected by leading _, so only
package gob can use the facilities (in its tests, of course); this
code is not ready for real use yet.  I could be talked into enabling
it for experimentation, though.  The main drawback is that the
methods must be implemented by the actual type passed through,
not by an indirection from it.  For instance, if *T implements
GobEncoder, you must send a *T, not a T.  This will be addressed
in due course.

Also there is improved commentary and a couple of unrelated
minor bug fixes.

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

14 years agohttp: rename ClientTransport to Transport
Brad Fitzpatrick [Fri, 4 Mar 2011 19:41:57 +0000 (11:41 -0800)]
http: rename ClientTransport to Transport

http.Transport looks nicer, and ServerTransport
doesn't make much sense anyway.

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

14 years agohttp: add packages http/cgi and http/httptest
Brad Fitzpatrick [Fri, 4 Mar 2011 18:55:47 +0000 (10:55 -0800)]
http: add packages http/cgi and http/httptest

R=rsc, adg, jnw, bradfitzwork
CC=golang-dev
https://golang.org/cl/4247048

14 years agodoc: there's no such thing as a .cgo file
Andrew Gerrand [Fri, 4 Mar 2011 05:28:27 +0000 (16:28 +1100)]
doc: there's no such thing as a .cgo file

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

14 years agodoc: add "implements" question to FAQ
Andrew Gerrand [Fri, 4 Mar 2011 02:11:07 +0000 (13:11 +1100)]
doc: add "implements" question to FAQ

R=r, fw, gri, r2, yiyus
CC=golang-dev
https://golang.org/cl/4248051

14 years agodoc: describe platform-specific conventions in code.html
Andrew Gerrand [Fri, 4 Mar 2011 01:28:08 +0000 (12:28 +1100)]
doc: describe platform-specific conventions in code.html

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

14 years agogofmt: exclude test file that is not legal Go
Robert Griesemer [Fri, 4 Mar 2011 00:52:56 +0000 (16:52 -0800)]
gofmt: exclude test file that is not legal Go

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

14 years agogo spec: minor clarification of scope rule for functions
Robert Griesemer [Thu, 3 Mar 2011 23:24:28 +0000 (15:24 -0800)]
go spec: minor clarification of scope rule for functions

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

14 years agohttp: change localhost URL; maybe fix Windows
Brad Fitzpatrick [Thu, 3 Mar 2011 21:29:31 +0000 (13:29 -0800)]
http: change localhost URL; maybe fix Windows

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

14 years agohttp: allow handlers to send non-chunked responses
Brad Fitzpatrick [Thu, 3 Mar 2011 20:22:13 +0000 (12:22 -0800)]
http: allow handlers to send non-chunked responses

Currently all http handlers reply to HTTP/1.1 requests with
chunked responses.  This patch allows handlers to opt-out of
that behavior by pre-declaring their Content-Length (which is
then enforced) and unsetting their Transfer-Encoding or
setting it to the "identity" encoding.

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

14 years agoio/ioutil: add TempDir
Russ Cox [Thu, 3 Mar 2011 19:51:49 +0000 (14:51 -0500)]
io/ioutil: add TempDir

It's a little confusing that os.TempDir and ioutil.TempDir have
different meanings.  I don't know what to change the names to,
if anything.  At least they also have different signatures.

R=golang-dev, bradfitzgo, r, gri
CC=golang-dev
https://golang.org/cl/4247051

14 years agotesting: run GC before each benchmark run.
Roger Peppe [Thu, 3 Mar 2011 19:26:53 +0000 (11:26 -0800)]
testing: run GC before each benchmark run.

R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055

14 years agofmt: make recursive scan more efficient.
Roger Peppe [Thu, 3 Mar 2011 18:43:29 +0000 (10:43 -0800)]
fmt: make recursive scan more efficient.
Detect when scan is being called recursively and
re-use the same scan state.

On my machine, for a recursion-heavy benchmark, this
results in 44x speed up. This does impose a 4% penalty
on the non-recursive case, which can be removed by
heap-allocating the saved state, at 40% performance penalty
on the recursive case. Either way is fine with me.

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

14 years agoreflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr)
Russ Cox [Thu, 3 Mar 2011 18:20:17 +0000 (13:20 -0500)]
reflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr)

This change makes it possible to take the address of a
struct field or slice element in order to call a method that
requires a pointer receiver.

Existing code that uses the Value.Addr method will have
to change (as gob does in this CL) to call UnsafeAddr instead.

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

14 years agogc, ld: reflect support for PtrTo
Russ Cox [Thu, 3 Mar 2011 18:17:54 +0000 (13:17 -0500)]
gc, ld: reflect support for PtrTo

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

14 years agofix build (observed in wild, not on dashboard)
Russ Cox [Thu, 3 Mar 2011 16:51:16 +0000 (11:51 -0500)]
fix build (observed in wild, not on dashboard)

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

14 years agobzip2: speed up decompression.
Adam Langley [Thu, 3 Mar 2011 14:13:06 +0000 (09:13 -0500)]
bzip2: speed up decompression.

This borrows a trick from the bzip2 source and effects a decent speed
up when decompressing highly compressed sources. Rather than unshuffle
the BTW block when performing the IBTW, a linked-list is threaded
through the array, in place. This improves cache hit rates.

R=bradfitzgo, bradfitzwork, cw
CC=golang-dev
https://golang.org/cl/4247047

14 years agoimage: add a decoding test for common file formats.
Nigel Tao [Thu, 3 Mar 2011 09:35:49 +0000 (20:35 +1100)]
image: add a decoding test for common file formats.

The test image was converted from doc/video-001.png using the
convert command line tool (ImageMagick 6.5.7-8) at -quality 100.

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

14 years agodoc: remove reference to bug count from install.html
Andrew Gerrand [Thu, 3 Mar 2011 05:41:03 +0000 (16:41 +1100)]
doc: remove reference to bug count from install.html

Fixes #1574.

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

14 years agogobuilder: add -package flag to build external packages
Andrew Gerrand [Thu, 3 Mar 2011 03:41:09 +0000 (14:41 +1100)]
gobuilder: add -package flag to build external packages

Also add -v for verbose logging.

R=rsc, gri, r, r2
CC=golang-dev
https://golang.org/cl/4172056

14 years agounsafe: fix the documentation
Rob Pike [Thu, 3 Mar 2011 03:39:08 +0000 (19:39 -0800)]
unsafe: fix the documentation
Reflection is about Pointer, not uintptr.
Also clarify that Reflect and Unreflect are indirect.

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

14 years agogc: fix init of packages named main
Gustavo Niemeyer [Wed, 2 Mar 2011 21:18:17 +0000 (16:18 -0500)]
gc: fix init of packages named main

This change removes the special case which existed
for handling the initalization of the main package,
so that other modules named 'main' get properly
initialized when imported.

Note that gotest of main packages will break in most
cases without this.

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

14 years agoruntime: fix unused variable warning
Dave Cheney [Wed, 2 Mar 2011 20:29:13 +0000 (15:29 -0500)]
runtime: fix unused variable warning

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

14 years agoxml: fix typo in test.
Yasuhiro Matsumoto [Wed, 2 Mar 2011 20:05:52 +0000 (15:05 -0500)]
xml: fix typo in test.

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

14 years agogoinstall: protect against malicious filenames.
Roger Peppe [Wed, 2 Mar 2011 20:04:08 +0000 (15:04 -0500)]
goinstall: protect against malicious filenames.
It was possible to make package run arbitrary
commands when installing if its filenames contained
make metacharacters.

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

14 years agobuild: simplify clean.bash
Dave Cheney [Wed, 2 Mar 2011 19:57:47 +0000 (14:57 -0500)]
build: simplify clean.bash

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

14 years agofix build
Russ Cox [Wed, 2 Mar 2011 19:52:35 +0000 (14:52 -0500)]
fix build

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

14 years agobuild: fix race condition building enam.o
Dave Cheney [Wed, 2 Mar 2011 19:22:39 +0000 (14:22 -0500)]
build: fix race condition building enam.o

R=golang-dev, rsc
CC=albert.strasheim, golang-dev
https://golang.org/cl/4240055

14 years agocgo: put temporary source files in _obj.
Roger Peppe [Wed, 2 Mar 2011 19:22:33 +0000 (14:22 -0500)]
cgo: put temporary source files in _obj.
Fixes #1572.
Initially I tried changing things so all object
files get put in _obj, but it's too much - everything
needs changing. Perhaps some other time.

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

14 years agofmt: allow recursive calls to Fscan etc.
Roger Peppe [Wed, 2 Mar 2011 18:54:23 +0000 (10:54 -0800)]
fmt: allow recursive calls to Fscan etc.
Add a new Read method to ScanState so that it
satisfies the io.Reader interface; rename
Getrune and Ungetrune to ReadRune and UnreadRune.
Make sure ReadRune does not read past width restrictions;
remove now-unnecessary Width method from ScanState.
Also make the documentation a little clearer as to
how ReadRune and UnreadRune are used.

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

14 years agoruntime: record goroutine creation pc and display in traceback
Russ Cox [Wed, 2 Mar 2011 18:42:02 +0000 (13:42 -0500)]
runtime: record goroutine creation pc and display in traceback

package main

func main() {
        go func() { *(*int)(nil) = 0 }()
        select{}
}

panic: runtime error: invalid memory address or nil pointer dereference

[signal 0xb code=0x1 addr=0x0 pc=0x1c96]

runtime.panic+0xac /Users/rsc/g/go/src/pkg/runtime/proc.c:1083
        runtime.panic(0x11bf0, 0xf8400011f0)
runtime.panicstring+0xa3 /Users/rsc/g/go/src/pkg/runtime/runtime.c:116
        runtime.panicstring(0x29a57, 0x0)
runtime.sigpanic+0x144 /Users/rsc/g/go/src/pkg/runtime/darwin/thread.c:470
        runtime.sigpanic()
main._func_001+0x16 /Users/rsc/g/go/src/pkg/runtime/x.go:188
        main._func_001()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
main.main+0x3d /Users/rsc/g/go/src/pkg/runtime/x.go:4

goroutine 1 [4]:
runtime.gosched+0x77 /Users/rsc/g/go/src/pkg/runtime/proc.c:598
        runtime.gosched()
runtime.block+0x27 /Users/rsc/g/go/src/pkg/runtime/chan.c:680
        runtime.block()
main.main+0x44 /Users/rsc/g/go/src/pkg/runtime/x.go:5
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:77
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
_rt0_amd64+0x8e /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:64

Fixes #1563.

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

14 years agohttp: initialize request Header for the transport
Brad Fitzpatrick [Wed, 2 Mar 2011 18:21:56 +0000 (10:21 -0800)]
http: initialize request Header for the transport

Fixes #1558

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

14 years agohttp: give ParseHTTPVersion a real example.
David Symonds [Tue, 1 Mar 2011 23:10:12 +0000 (10:10 +1100)]
http: give ParseHTTPVersion a real example.

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

14 years agohttp: expose Client's Transport
Brad Fitzpatrick [Tue, 1 Mar 2011 22:07:28 +0000 (14:07 -0800)]
http: expose Client's Transport

This is again an intentionally minimal change.

The plan is to keep Client's zero value be a usable
client, with optional fields being added over time
(e.g. cookie manager, redirect policy, auth)

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

14 years agodocs: make "runtime" a word only as a name for the package.
Rob Pike [Tue, 1 Mar 2011 21:54:22 +0000 (13:54 -0800)]
docs: make "runtime" a word only as a name for the package.

Computer people have an agglutinating streak that I like to resist.
As a time of execution: run time.
As an adjective: run-time.
As a noun: run-time support/code/library.

Signed,
Mr. Pedant.

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

14 years agofmt: delete debugging print that crept in to test.
Rob Pike [Tue, 1 Mar 2011 21:39:44 +0000 (13:39 -0800)]
fmt: delete debugging print that crept in to test.
(you'd never see it, but ouch.)
Spotted by Florian Weimer.

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

14 years agofmt: make %#p suppress leading 0x
Rob Pike [Tue, 1 Mar 2011 21:25:52 +0000 (13:25 -0800)]
fmt: make %#p suppress leading 0x

Fixes bug 1567.

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

14 years agohttp: export parseHTTPVersion.
David Symonds [Tue, 1 Mar 2011 11:38:18 +0000 (22:38 +1100)]
http: export parseHTTPVersion.

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

14 years agodoc: add FAQ about large binaries and stack vs heap allocation
Andrew Gerrand [Tue, 1 Mar 2011 10:35:46 +0000 (21:35 +1100)]
doc: add FAQ about large binaries and stack vs heap allocation
doc: add internationalization to roadmap

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

14 years agogoyacc: clarify it's package, not binary, that has
Rob Pike [Tue, 1 Mar 2011 04:47:52 +0000 (20:47 -0800)]
goyacc: clarify it's package, not binary, that has
conflict and explain that you could put the grammars
in separate packages instead.

I could be talked into rolling back the previous change
and just making a doc change instead, but I'm content
to let it stand.

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

14 years agogoyacc: provide -p flag to set prefix for names.
Rob Pike [Tue, 1 Mar 2011 01:43:16 +0000 (17:43 -0800)]
goyacc: provide -p flag to set prefix for names.

This should allow multiple goyacc grammars to be
compiled into the same binary. There's a chance it
Fixes #1562.

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

14 years agobuild: convert src/cmd to use make directly and simplify src/make.bash
Dave Cheney [Mon, 28 Feb 2011 22:20:32 +0000 (09:20 +1100)]
build: convert src/cmd to use make directly and simplify src/make.bash

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

14 years agogc: bug325 / issue 1566
Russ Cox [Mon, 28 Feb 2011 22:16:44 +0000 (17:16 -0500)]
gc: bug325 / issue 1566

Fixes #1566.

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

14 years agobuild: move $GOBIN ahead of /bin, /usr/bin in build $PATH
Russ Cox [Mon, 28 Feb 2011 19:55:27 +0000 (14:55 -0500)]
build: move $GOBIN ahead of /bin, /usr/bin in build $PATH

Otherwise if there is an installed /usr/bin/6g the build
will use that one instead of the one it builds.

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

14 years agoxml: permit nested directives
Chris Dollin [Mon, 28 Feb 2011 19:09:04 +0000 (14:09 -0500)]
xml: permit nested directives

Return <!DOCTYPE ...> with nested directives as one big token.

Fixes #1549.

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

14 years agotemplate: document the delimiters better
Rob Pike [Mon, 28 Feb 2011 18:27:33 +0000 (10:27 -0800)]
template: document the delimiters better

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

14 years agosyscall: regenerate zerrors_freebsd_amd64.go
Mikio Hara [Mon, 28 Feb 2011 15:21:19 +0000 (10:21 -0500)]
syscall: regenerate zerrors_freebsd_amd64.go

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