Commit Graph

7846 Commits

Author SHA1 Message Date
Brad Fitzpatrick
d64a18a27e cgi: child support (e.g. Go CGI under Apache)
The http/cgi package now supports both being
a CGI host or being a CGI child process.

R=rsc, adg, bradfitzwork
CC=golang-dev
https://golang.org/cl/4245070
2011-03-08 08:01:19 -08:00
Rob Pike
8c76218f89 gob: finish up GobEncoder/Decoder by providing indirection
to the receiver. Remove lots of TODOS.

R=rsc
CC=golang-dev
https://golang.org/cl/4257057
2011-03-08 00:02:07 -08:00
Robert Hencke
c55fb521cc flag: failf documentation nit
"standard output" should have been "standard error".  Sorry about that..

R=adg
CC=golang-dev
https://golang.org/cl/4240088
2011-03-08 18:02:07 +11:00
Andrew Gerrand
d2e011d518 http: add test for recently fixed HTTP/1.0 keep-alive issue
R=bradfitzgo, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4235056
2011-03-08 16:12:44 +11:00
Ross Light
d7eacee603 misc/vim: Add indent script for Vim
R=adg
CC=golang-dev
https://golang.org/cl/4258041
2011-03-08 15:42:23 +11:00
Robert Hencke
2a36f9df1c flag: replace fail with failf
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4254061
2011-03-08 15:41:36 +11:00
Russ Cox
4c052844dd gc: fix handling of return values named _
Fixes #1586.

R=ken2
CC=golang-dev
https://golang.org/cl/4244057
2011-03-07 19:36:17 -05:00
Robert Griesemer
fb64e0d96f go spec: clarify return statement rules
Added example of a return statement w/o expressions
in a function with a _ result parameter.

See also: http://code.google.com/p/go/issues/detail?id=1586

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4266049
2011-03-07 16:29:07 -08:00
Ian Lance Taylor
800217f8c5 net: fix test for Solaris: gopher and http are not in /etc/services.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4250063
2011-03-07 15:31:41 -08:00
Ian Lance Taylor
89930bda9d os: adjust test: /bin is a symlink, not a directory, on Solaris.
R=rsc
CC=golang-dev
https://golang.org/cl/4239066
2011-03-07 15:30:51 -08:00
Ian Lance Taylor
6892155ded runtime: remove unused declarations from mgc0.c.
R=rsc
CC=golang-dev
https://golang.org/cl/4252063
2011-03-07 15:30:25 -08:00
Russ Cox
5c2666c18c 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
2011-03-07 15:10:01 -05:00
Rob Pike
22c45c558b 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
2011-03-07 12:08:31 -08:00
Brad Fitzpatrick
2168e6aaf1 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
2011-03-07 12:04:04 -08:00
Russ Cox
792ff38604 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
2011-03-07 14:45:45 -05:00
Robert Griesemer
021b040a1e 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
2011-03-07 11:01:23 -08:00
Robert Griesemer
4b4a1ea899 misc/dashboard/builder/doc.go: gofmt it
R=r, adg
CC=golang-dev
https://golang.org/cl/4256052
2011-03-07 11:00:57 -08:00
Gustavo Niemeyer
e08f0c18c9 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
2011-03-07 12:53:39 -05:00
Russ Cox
02323c0e21 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
2011-03-07 12:09:00 -05:00
Gustavo Niemeyer
ff40deee62 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
2011-03-07 12:08:52 -05:00
Petar Maymounkov
3e042ebb57 http: adapt Cookie code to follow IETF draft
R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4235055
2011-03-07 12:08:39 -05:00
Russ Cox
ad29ef9561 runtime: fix windows/386 build
TBR=brainman
CC=golang-dev
https://golang.org/cl/4237060
2011-03-07 11:48:35 -05:00
Russ Cox
5946e46138 goinstall: fix build
func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055
2011-03-07 11:33:26 -05:00
Pascal S. de Kloe
4371e09457 hash: new FNV-1a implementation
R=agl1, rsc
CC=golang-dev
https://golang.org/cl/4257042
2011-03-07 11:11:21 -05:00
Gustavo Niemeyer
70f08b47a0 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
2011-03-07 10:54:53 -05:00
Russ Cox
f9ca3b5d5b 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
2011-03-07 10:37:42 -05:00
Russ Cox
6d6f3381ff 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
2011-03-07 10:37:28 -05:00
Robert Hencke
c7ef0fd26b rpc: use httptest.Server for tests
R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4253060
2011-03-07 10:37:10 -05:00
Andrew Gerrand
c6093e6b82 tag release.2011-03-07.1
R=rsc
CC=golang-dev
https://golang.org/cl/4268041
2011-03-07 16:19:25 +11:00
Andrew Gerrand
251cdc917d release.2011-03-07.1
R=rsc
CC=golang-dev
https://golang.org/cl/4240082
2011-03-07 16:18:24 +11:00
Russ Cox
c4407b7552 http: close after responding to HTTP/1.0 request without Connection: keep-alive
R=adg
CC=golang-dev
https://golang.org/cl/4245065
2011-03-07 00:14:40 -05:00
Alex Brainman
2ae4f356cc doc/codelab/wiki: include into windows build
R=adg, rsc
CC=Joe Poirier, golang-dev
https://golang.org/cl/4257052
2011-03-07 15:48:39 +11:00
Russ Cox
0db312b6a8 http: use Header type consistently
R=bradfitzgo, dsymonds
CC=golang-dev
https://golang.org/cl/4244053
2011-03-06 23:02:29 -05:00
Andrew Gerrand
7fb65a936b doc: amend release.2011-03-07 notes to mention reflect and path changes
R=rsc
CC=golang-dev
https://golang.org/cl/4250061
2011-03-07 14:46:55 +11:00
Brad Fitzpatrick
545a1eef6a 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
2011-03-06 18:59:50 -08:00
Andrew Gerrand
8b432848f4 tag release.2011-03-07
R=rsc
CC=golang-dev
https://golang.org/cl/4264048
2011-03-07 13:57:15 +11:00
Andrew Gerrand
c1d44c9453 release.2011-03-07
R=r, rsc, dfc
CC=golang-dev
https://golang.org/cl/4240081
2011-03-07 13:55:22 +11:00
Russ Cox
2b4a9603d3 io/ioutil: use filepath.Join, handle trailing / in $TMPDIR
R=niemeyer
CC=golang-dev
https://golang.org/cl/4256057
2011-03-06 21:52:37 -05:00
Alex Brainman
94401f524e path/filepath: disable test on windows to fix build
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4235054
2011-03-07 12:23:57 +11:00
Brad Fitzpatrick
6193e0ba00 mime/multipart: switch from map to MIMEHeader
R=rsc
CC=golang-dev
https://golang.org/cl/4253058
2011-03-06 15:12:03 -08:00
Gustavo Niemeyer
99686ec789 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
2011-03-06 18:05:57 -05:00
Gustavo Niemeyer
04ca4f8242 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
2011-03-06 17:33:23 -05:00
Robert Hencke
ce65b72508 websocket: use httptest.Server for tests
R=rsc
CC=golang-dev
https://golang.org/cl/4266044
2011-03-06 17:05:12 -05:00
Russ Cox
59d2acd2d4 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
2011-03-06 17:04:24 -05:00
Petar Maymounkov
6afe7eba32 http: add cookie support
R=rsc1, mattn, bradfitzwork, pascal, bradfitzgo
CC=golang-dev
https://golang.org/cl/4214042
2011-03-06 15:02:06 -05:00
Devon H. O'Dell
eeb8d00c86 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
2011-03-06 14:57:05 -05:00
Rob Pike
9e25eccf48 gob: clean up getTypeInfo (address a TODO)
also fix a caching bug.

R=rsc
CC=golang-dev
https://golang.org/cl/4261049
2011-03-06 10:50:07 -08:00
Russ Cox
255b538152 http/cgi: skip test if perl or CGI.pm not available
R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4264047
2011-03-06 11:23:47 -05:00
Robert Hencke
ff3ef8a963 fmt: trivial cleanup
R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4235052
2011-03-05 17:55:53 -08:00
Brad Fitzpatrick
e9135403cf A+C: Robert Hencke (individual CLA)
R=dsymonds
CC=golang-dev
https://golang.org/cl/4256053
2011-03-05 17:51:53 -08:00