1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:11:22 -06:00
Commit Graph

5558 Commits

Author SHA1 Message Date
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
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
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
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
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
Rob Pike
369c48cafb 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
2011-03-05 16:05:35 -08:00
Brad Fitzpatrick
bfd3d81b92 httptest: fix docs out-of-sync from earlier renaming
R=rh
CC=golang-dev
https://golang.org/cl/4239060
2011-03-05 15:43:26 -08:00
Brad Fitzpatrick
f88abdad0f 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
2011-03-05 13:51:35 -08:00
Dave Cheney
5f54c807f1 build: avoid calling gomake wrapper in recursive make
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4243058
2011-03-05 14:53:29 -05:00
Petar Maymounkov
5db0a8b9ef http: fixed race condition in persist.go
R=rsc, bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4266042
2011-03-05 14:44:05 -05:00
Russ Cox
7bc90eda69 http: fix, use WriteProxy
Fixes #53.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240075
2011-03-05 14:35:15 -05:00
Russ Cox
d044674a0d 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
2011-03-05 14:35:03 -05:00
Russ Cox
1169559658 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
2011-03-05 14:24:44 -05:00
David Symonds
633df67b66 gc, gopack: add some missing flags to the docs.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4260051
2011-03-04 20:21:26 -08:00
David Symonds
4c30ca067d time: split os-dependent part into sys.go.
R=rsc
CC=golang-dev
https://golang.org/cl/4259051
2011-03-04 19:57:39 -08:00
Rob Pike
9442e9518d 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
2011-03-04 14:18:52 -08:00
Brad Fitzpatrick
99f17aa0b8 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
2011-03-04 14:12:39 -08:00
Russ Cox
e339d27db7 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
2011-03-04 15:42:39 -05:00
Rob Pike
c91daefb24 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
2011-03-04 12:25:18 -08:00
Brad Fitzpatrick
7b563be516 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
2011-03-04 11:41:57 -08:00
Brad Fitzpatrick
da679db0f1 http: add packages http/cgi and http/httptest
R=rsc, adg, jnw, bradfitzwork
CC=golang-dev
https://golang.org/cl/4247048
2011-03-04 10:55:47 -08:00
Robert Griesemer
21f3080d0f gofmt: exclude test file that is not legal Go
R=r, r2
CC=golang-dev
https://golang.org/cl/4252053
2011-03-03 16:52:56 -08:00
Brad Fitzpatrick
38a105e48a http: change localhost URL; maybe fix Windows
R=golang-dev, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4259048
2011-03-03 13:29:31 -08:00
Brad Fitzpatrick
61fd11ef96 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
2011-03-03 12:22:13 -08:00
Russ Cox
9ebe384b71 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
2011-03-03 14:51:49 -05:00
Roger Peppe
da833474f5 testing: run GC before each benchmark run.
R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055
2011-03-03 11:26:53 -08:00
Roger Peppe
5bd284e868 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
2011-03-03 10:43:29 -08:00
Russ Cox
e46acb091f 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
2011-03-03 13:20:17 -05:00
Russ Cox
44fd7573aa gc, ld: reflect support for PtrTo
R=ken2
CC=golang-dev
https://golang.org/cl/4245055
2011-03-03 13:17:54 -05:00
Russ Cox
2d404c4bff fix build (observed in wild, not on dashboard)
TBR=r
CC=golang-dev
https://golang.org/cl/4257054
2011-03-03 11:51:16 -05:00
Adam Langley
e7fa307902 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
2011-03-03 09:13:06 -05:00
Nigel Tao
7483c6ee3c 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
2011-03-03 20:35:49 +11:00
Rob Pike
68add46af7 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
2011-03-02 19:39:08 -08:00
Gustavo Niemeyer
daffc2d2ef 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
2011-03-02 16:18:17 -05:00
Dave Cheney
ff1d89d600 runtime: fix unused variable warning
R=rsc
CC=golang-dev
https://golang.org/cl/4188043
2011-03-02 15:29:13 -05:00
Yasuhiro Matsumoto
1a6b1dd0de xml: fix typo in test.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4218042
2011-03-02 15:05:52 -05:00
Roger Peppe
c1fdb6f156 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
2011-03-02 15:04:08 -05:00
Dave Cheney
49a4d7dc39 build: simplify clean.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4257045
2011-03-02 14:57:47 -05:00
Russ Cox
f104a198e4 fix build
TBR=rog
CC=golang-dev
https://golang.org/cl/4259046
2011-03-02 14:52:35 -05:00
Dave Cheney
9a8c079075 build: fix race condition building enam.o
R=golang-dev, rsc
CC=albert.strasheim, golang-dev
https://golang.org/cl/4240055
2011-03-02 14:22:39 -05:00
Roger Peppe
9704d4ec3d 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
2011-03-02 14:22:33 -05:00
Roger Peppe
81bfbe9333 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
2011-03-02 10:54:23 -08:00
Russ Cox
324cc3d040 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
2011-03-02 13:42:02 -05:00
Brad Fitzpatrick
9733f96b47 http: initialize request Header for the transport
Fixes #1558

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4260042
2011-03-02 10:21:56 -08:00
David Symonds
1d258a554a http: give ParseHTTPVersion a real example.
R=rsc
CC=golang-dev
https://golang.org/cl/4239050
2011-03-02 10:10:12 +11:00
Brad Fitzpatrick
60f193781d 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
2011-03-01 14:07:28 -08:00
Rob Pike
a77744f488 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
2011-03-01 13:39:44 -08:00
Rob Pike
2b9ab22732 fmt: make %#p suppress leading 0x
Fixes bug 1567.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4245048
2011-03-01 13:25:52 -08:00
David Symonds
7eaecb8915 http: export parseHTTPVersion.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4244045
2011-03-01 22:38:18 +11:00
Rob Pike
41a23ca08b 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
2011-02-28 20:47:52 -08:00
Rob Pike
bb0e7bda35 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
2011-02-28 17:43:16 -08:00
Dave Cheney
432b4f309b 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
2011-03-01 09:20:32 +11:00
Russ Cox
7da86983a8 gc: bug325 / issue 1566
Fixes #1566.

R=ken2
CC=golang-dev
https://golang.org/cl/4259041
2011-02-28 17:16:44 -05:00
Russ Cox
a3ef19825c 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
2011-02-28 14:55:27 -05:00
Chris Dollin
b00f7310f3 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
2011-02-28 14:09:04 -05:00
Rob Pike
b2efedbf36 template: document the delimiters better
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4248047
2011-02-28 10:27:33 -08:00
Mikio Hara
dd51f3537f syscall: regenerate zerrors_freebsd_amd64.go
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4248043
2011-02-28 10:21:19 -05:00
Russ Cox
582fd17e11 runtime: idle goroutine
This functionality might be used in environments
where programs are limited to a single thread,
to simulate a select-driven network server.  It is
not exposed via the standard runtime API.

R=r, r2
CC=golang-dev
https://golang.org/cl/4254041
2011-02-27 23:32:42 -05:00
Nigel Tao
fdbbb066ed compress/lzw: don't use a closure in NewReader, which avoids having
to move some variables from the stack to the heap.

Sorted benchmark runs on my 2007-era Mac Mini (GOARCH=amd64, GOOS=linux):

Before:
lzw.BenchmarkDecoder        2000        878176 ns/op
lzw.BenchmarkDecoder        2000        878415 ns/op
lzw.BenchmarkDecoder        2000        880352 ns/op
lzw.BenchmarkDecoder        2000        898445 ns/op
lzw.BenchmarkDecoder        2000        901728 ns/op

After:
lzw.BenchmarkDecoder        2000        859065 ns/op
lzw.BenchmarkDecoder        2000        859402 ns/op
lzw.BenchmarkDecoder        2000        860035 ns/op
lzw.BenchmarkDecoder        2000        860555 ns/op
lzw.BenchmarkDecoder        2000        861109 ns/op

The ratio of before/after median times is 1.024.

The runtime.MemStats.Mallocs delta per loop drops from 109 to 104.

R=r, r2, dfc
CC=golang-dev
https://golang.org/cl/4253043
2011-02-26 16:42:49 +11:00
Nigel Tao
5b1d47d105 compress/lzw: fix the stupidity of allocating and zeroing a new buffer
on each loop iteration, yielding a 20x performance improvement.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4240044
2011-02-26 09:25:29 +11:00
Rob Pike
54f0040723 crypto/openpgp: fix test prints
R=agl, agl1
CC=golang-dev
https://golang.org/cl/4255041
2011-02-25 13:44:37 -08:00
Russ Cox
d1cd829405 runtime: omit breakpoint during terminal panic
again.
CL 4222043 missed this case.

R=brainman, r, r2
CC=golang-dev
https://golang.org/cl/4235043
2011-02-25 15:17:34 -05:00
Russ Cox
c833d2fd94 sync/atomic: make BUG comment godoc-compatible
go/doc wants to see text after BUG(uid): on the same line
in order to treat it as an official bug comment.

R=gri
CC=golang-dev
https://golang.org/cl/4250043
2011-02-25 14:40:36 -05:00
Russ Cox
9ad9742157 runtime: use kernel-supplied cas on linux/arm
Using the kernel-supplied compare-and-swap code
on linux/arm means that runtime doesn't have to care
whether this is GOARM=5 or GOARM=6 anymore.

Fixes #1494.

R=r, r2
CC=golang-dev
https://golang.org/cl/4245043
2011-02-25 14:29:55 -05:00
Russ Cox
12b7875bf2 sync: use sync/atomic
Remove references to custom assembly routines.

R=r, r2
CC=golang-dev
https://golang.org/cl/4241043
2011-02-25 14:29:47 -05:00
Russ Cox
22eab1f5c7 sync/atomic: new package
Fixes #170.

R=gri, iant, r, r2
CC=golang-dev
https://golang.org/cl/4241041
2011-02-25 14:29:36 -05:00
Rob Pike
c54b5d032f gob: make recursive map and slice types work.
Before this fix, types such as
        type T map[string]T
caused infinite recursion in the gob implementation.
Now they just work.

Fixes #1518.

R=rsc
CC=golang-dev
https://golang.org/cl/4230045
2011-02-25 09:45:06 -08:00
Russ Cox
895631770a 8a, 8l: add CMPXCHG8B, XADDB, XADDL, XADDW
R=ken2
CC=golang-dev
https://golang.org/cl/4240041
2011-02-25 01:04:29 -05:00
Russ Cox
96c785de39 5a, 5l: add LDREXD, STREXD
R=ken2
CC=golang-dev
https://golang.org/cl/4239041
2011-02-25 01:03:54 -05:00
Adam Langley
6ca009f58d crypto/openpgp: add package
R=bradfitzgo
CC=golang-dev
https://golang.org/cl/3989052
2011-02-24 20:19:53 -05:00
Robert Griesemer
27ccb41c4a godoc: accept symbolic links as path names provided to -path
When providing addition file systems to godoc via -path, the
path names may be symbolic links. Follow them.

Also: better logging of error and special conditions.

R=r, dsymonds, r2
CC=golang-dev
https://golang.org/cl/4217045
2011-02-24 16:24:51 -08:00
Alex Brainman
176eb49d9c runtime: add empty windows/signals.h file to fix build
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4223049
2011-02-25 11:16:39 +11:00
Nigel Tao
741eab4eb6 compress/lzw: implement an encoder.
R=rsc, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4209043
2011-02-25 09:20:04 +11:00
Russ Cox
8d36a78440 reflect: add pointer word to CommonType
The pointer will eventually let us find *T given T.
This CL just makes room for it, always storing a zero.

R=r, r2
CC=golang-dev
https://golang.org/cl/4221046
2011-02-24 17:11:20 -05:00