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

3217 Commits

Author SHA1 Message Date
Russ Cox
6e928e411b net: fix windows build
TBR=r
CC=golang-dev
https://golang.org/cl/4425059
2011-04-20 17:11:25 -04:00
Rob Pike
220f83134a gob: use new Implements and AssignableTo methods in reflect
to improve the code and removea  TODO.

R=rsc
CC=golang-dev
https://golang.org/cl/4443054
2011-04-20 14:07:13 -07:00
Brad Fitzpatrick
8dad7fec1d http: don't proxy loopback addresses
Fixes #1589

R=rsc
CC=golang-dev
https://golang.org/cl/4443053
2011-04-20 13:53:34 -07:00
Russ Cox
e1ee3b5db6 reflect: add Type.Implements, Type.AssignableTo, Value.CallSlice; make Set match Go
This CL makes reflect require that values be assignable to the target type
in exactly the same places where that is the rule in Go.  It also adds
the Implements and AssignableTo methods so that callers can check
the types themselves so as to avoid a panic.

Before this CL, reflect required strict type identity.

This CL expands Call to accept and correctly marshal arbitrary
argument lists for variadic functions; it introduces CallSlice for use
in the case where the slice for the variadic argument is already known.

Fixes #327.
Fixes #1212.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4439058
2011-04-20 16:24:45 -04:00
Russ Cox
c9164a5d77 net: use C library resolver on FreeBSD, Linux, OS X / amd64, 386
This CL makes it possible to resolve DNS names on OS X
without offending the Application-Level Firewall.

It also means that cross-compiling from one operating
system to another is no longer possible when using
package net, because cgo needs to be able to sniff around
the local C libraries.  We could special-case this one use
and check in generated files, but it seems more trouble
than it's worth.  Cross compiling is dead anyway.

It is still possible to use either GOARCH=amd64 or GOARCH=386
on typical Linux and OS X x86 systems.

It is also still possible to build GOOS=linux GOARCH=arm on
any system, because arm is for now excluded from this change
(there is no cgo for arm yet).

R=iant, r, mikioh
CC=golang-dev
https://golang.org/cl/4437053
2011-04-20 15:21:59 -04:00
Russ Cox
64787e3123 reflect: update CanAddr, CanSet documentation
CanAddr was wrong, out of date; CanSet was incomplete.

R=r
CC=golang-dev
https://golang.org/cl/4442066
2011-04-20 15:04:04 -04:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Rob Pike
3cb973ff65 gob: fix trivial bug in map marshaling.
Forgot to send key/value types.

R=rsc
CC=golang-dev, hmc2you
https://golang.org/cl/4434058
2011-04-19 10:41:12 -07:00
Adam Langley
b8df1465cc crypto/openpgp: better handling of keyrings.
* Accept armored private key blocks
  * If an armored block is missing, return an InvalidArgumentError,
    rather than ignoring it.
  * If every key in a block is skipped due to being unsupported,
    return the last unsupported error.
  * Include the numeric type of unsupported public keys.
  * Don't assume that the self-signature comes immediately after the
    user id packet.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4434048
2011-04-19 11:00:35 -04:00
Adam Langley
90d3837193 crypto/x509: fix build
This pulls in changes that should have been in 3faf9d0c10c0, but
weren't because x509.go was part of another changelist.

TBR=bradfitzgo

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4433056
2011-04-19 10:11:37 -04:00
Adam Langley
c24c6d8340 crypto: move certificate verification into x509.
People have a need to verify certificates in situations other than TLS
client handshaking. Thus this CL moves certificate verification into
x509 and expands its abilities.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4407046
2011-04-19 09:57:58 -04:00
Nigel Tao
5500f027f7 image/jpeg: add an encoder.
It is based on changeset 4186064 by Raph Levien <raph@google.com>.

R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4435051
2011-04-19 11:00:47 +10:00
Russ Cox
3bac16a6bf reflect: allow Slice of arrays
R=r
CC=golang-dev
https://golang.org/cl/4444049
2011-04-18 20:00:42 -04:00
Russ Cox
857f17d346 http: fix IP confusion in TestServerTimeouts
Don't assume that localhost == 127.0.0.1.
It might be ::1.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4430055
2011-04-18 16:03:24 -04:00
Russ Cox
cded21a337 changes for more restricted reflect.SetValue
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4423043
2011-04-18 14:36:22 -04:00
Russ Cox
40fccbce6b reflect: more efficient; cannot Set result of NewValue anymore
* Reduces malloc counts during gob encoder/decoder test from 6/6 to 3/5.

The current reflect uses Set to mean two subtly different things.

(1) If you have a reflect.Value v, it might just represent
itself (as in v = reflect.NewValue(42)), in which case calling
v.Set only changed v, not any other data in the program.

(2) If you have a reflect Value v derived from a pointer
or a slice (as in x := []int{42}; v = reflect.NewValue(x).Index(0)),
v represents the value held there.  Changing x[0] affects the
value returned by v.Int(), and calling v.Set affects x[0].

This was not really by design; it just happened that way.

The motivation for the new reflect implementation was
to remove mallocs.  The use case (1) has an implicit malloc
inside it.  If you can do:

       v := reflect.NewValue(0)
       v.Set(42)
       i := v.Int()  // i = 42

then that implies that v is referring to some underlying
chunk of memory in order to remember the 42; that is,
NewValue must have allocated some memory.

Almost all the time you are using reflect the goal is to
inspect or to change other data, not to manipulate data
stored solely inside a reflect.Value.

This CL removes use case (1), so that an assignable
reflect.Value must always refer to some other piece of data
in the program.  Put another way, removing this case would
make

       v := reflect.NewValue(0)
       v.Set(42)

as illegal as

       0 = 42.

It would also make this illegal:

       x := 0
       v := reflect.NewValue(x)
       v.Set(42)

for the same reason.  (Note that right now, v.Set(42) "succeeds"
but does not change the value of x.)

If you really wanted to make v refer to x, you'd start with &x
and dereference it:

       x := 0
       v := reflect.NewValue(&x).Elem()  // v = *&x
       v.Set(42)

It's pretty rare, except in tests, to want to use NewValue and then
call Set to change the Value itself instead of some other piece of
data in the program.  I haven't seen it happen once yet while
making the tree build with this change.

For the same reasons, reflect.Zero (formerly reflect.MakeZero)
would also return an unassignable, unaddressable value.
This invalidates the (awkward) idiom:

       pv := ... some Ptr Value we have ...
       v := reflect.Zero(pv.Type().Elem())
       pv.PointTo(v)

which, when the API changed, turned into:

       pv := ... some Ptr Value we have ...
       v := reflect.Zero(pv.Type().Elem())
       pv.Set(v.Addr())

In both, it is far from clear what the code is trying to do.  Now that
it is possible, this CL adds reflect.New(Type) Value that does the
obvious thing (same as Go's new), so this code would be replaced by:

       pv := ... some Ptr Value we have ...
       pv.Set(reflect.New(pv.Type().Elem()))

The changes just described can be confusing to think about,
but I believe it is because the old API was confusing - it was
conflating two different kinds of Values - and that the new API
by itself is pretty simple: you can only Set (or call Addr on)
a Value if it actually addresses some real piece of data; that is,
only if it is the result of dereferencing a Ptr or indexing a Slice.

If you really want the old behavior, you'd get it by translating:

       v := reflect.NewValue(x)

into

       v := reflect.New(reflect.Typeof(x)).Elem()
       v.Set(reflect.NewValue(x))

Gofix will not be able to help with this, because whether
and how to change the code depends on whether the original
code meant use (1) or use (2), so the developer has to read
and think about the code.

You can see the effect on packages in the tree in
https://golang.org/cl/4423043/.

R=r
CC=golang-dev
https://golang.org/cl/4435042
2011-04-18 14:35:33 -04:00
Brad Fitzpatrick
6211b596d6 mime: add a TODO, fix the format of an error
R=r, rsc1
CC=golang-dev
https://golang.org/cl/4440054
2011-04-18 11:21:16 -07:00
Brad Fitzpatrick
98176b7760 mime: RFC 2231 continuation / non-ASCII support
Fixes #1119.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4437052
2011-04-18 10:59:39 -07:00
Quan Yong Zhai
f80f97a351 net: fix dialgoogle_test.go
~$ nslookup www.google.com
Server: 8.8.8.8
cannonical name = www-g-com-chn.l.google.com.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4445045
2011-04-18 11:19:47 -04:00
Russ Cox
90d8c8a09f runtime: fix arm5 softfloat
R=dfc, ken2, rsc
CC=golang-dev
https://golang.org/cl/4446043
2011-04-17 14:16:26 -04:00
Dave Cheney
a58fe3bd23 websocket: fix socket leak in test
Possibly fixes issue 1694.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4427049
2011-04-17 09:43:27 -07:00
Brad Fitzpatrick
90e4ece365 mime: bunch more tests, few minor parsing fixes
Working towards issue 1119

Using test data from http://greenbytes.de/tech/tc2231/

R=r
CC=golang-dev
https://golang.org/cl/4430049
2011-04-15 16:33:52 -07:00
Ross Light
bfb486875a compress/zlib: add FDICT flag in Reader/Writer
R=bradfitzgo, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406046
2011-04-15 15:32:03 -07:00
Brad Fitzpatrick
4787e70b7b http: handler timeout support
Fixes #213

R=r, rsc
CC=golang-dev
https://golang.org/cl/4432043
2011-04-15 12:53:32 -07:00
Russ Cox
b7065c5da4 net: disable one more external network test
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4442042
2011-04-15 11:21:29 -04:00
Brad Fitzpatrick
9b8d4e0977 json: keep track of error offset in SyntaxError
R=rsc
CC=golang-dev
https://golang.org/cl/4430043
2011-04-15 08:14:34 -07:00
Brad Fitzpatrick
e806565626 http: reverse proxy handler
R=rsc, petar-m
CC=golang-dev
https://golang.org/cl/4428041
2011-04-15 08:13:52 -07:00
Ian Lance Taylor
a696da10e0 gob: when decoding a string, allocate a string, not a []byte.
R=r, r2
CC=golang-dev
https://golang.org/cl/4430042
2011-04-15 06:49:39 -07:00
Russ Cox
4c9634fc5b build: remove DISABLE_NET_TESTS
Don't use external network during all.bash.

R=r, r2, rh, ality
CC=golang-dev
https://golang.org/cl/4429041
2011-04-15 08:20:42 -04:00
David Symonds
57d0c26c01 expvar: add Func for functions that return values that are JSON marshalable.
Remove {Float,Int,String}Func, which are now redundant.

Fixes #1684.

R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/4410041
2011-04-15 01:21:18 -07:00
Russ Cox
6ca71fb897 os: turn EPIPE exit into panic
R=iant, r2
CC=golang-dev
https://golang.org/cl/4427042
2011-04-15 00:01:29 -04:00
Quan Yong Zhai
c09af6631f net: fix ParseIP
Fixes #1695.

R=golang-dev, rsc
CC=golang-dev, r
https://golang.org/cl/4418042
2011-04-14 23:49:51 -04:00
Brad Fitzpatrick
71f9dc2cea http: add NewRequest helper
NewRequest will save a lot of boilerplate code.

This also updates some docs on Request.Write and
adds some tests.

R=rsc, petar-m, r
CC=golang-dev
https://golang.org/cl/4406047
2011-04-14 20:36:52 -07:00
Rob Pike
c94f5fb0ba gob: fix handling of indirect receivers for GobDecoders.
The previous code was just wrong. Let's not talk about it.
Passes iant's new test.

R=rsc, iant, iant2
CC=golang-dev
https://golang.org/cl/4396053
2011-04-14 17:26:12 -07:00
Ian Lance Taylor
17bd39e7d9 gob: test case for indirection to large field.
R=r
CC=golang-dev
https://golang.org/cl/4404048
2011-04-14 17:16:26 -07:00
Petar Maymounkov
8b35293070 http: don't quote Set-Cookie Domain and Path
Fixes #1659

R=rsc, bradfitzgo, bradfitzwork
CC=bradfitz, golang-dev
https://golang.org/cl/4368052
2011-04-14 15:05:02 -07:00
Brad Fitzpatrick
881b1b4a02 http: be clear when failing to connect to a proxy
Ubuntu and/or GNOME have some bug that likes
to set the "http_proxy" environment variable
and forgets to unset it.  This is annoying
to debug.  Be clear in the error message that
a proxy was in use.

R=rsc
CC=golang-dev
https://golang.org/cl/4409045
2011-04-14 13:49:19 -07:00
Lucio De Re
ceef10c222 pkg/runtime/plan9: Warning remediation, for Plan 9 native.
. Missing declaration of runtime.brk_();
. Argument v in runtime.SysReserve() is not used;
  (I'd prefer a Plan 9-type solution...)

R=golang-dev, r, r2
CC=golang-dev
https://golang.org/cl/4368076
2011-04-14 11:54:36 -07:00
Adam Langley
6f921f22ae crypto/tls: add server-side OCSP stapling support.
We already had support on the client side. I also changed the name of
the flag in the ServerHello structure to match the name of the same
flag in the ClientHello (ocspStapling).

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4408044
2011-04-14 14:47:28 -04:00
Brad Fitzpatrick
e27702545a http: consume request bodies before replying
This fixes our http behavior (even if Handlers forget to
consume a request body, we do it for them before we send
their response header), fixes the racy TestServerExpect,
and adds TestServerConsumesRequestBody.

With GOMAXPROCS>1, the http tests now seem race-free.

R=rsc
CC=golang-dev
https://golang.org/cl/4419042
2011-04-14 10:40:23 -07:00
Brad Fitzpatrick
e0533b044d http: fix race in transport_test
R=rsc
CC=golang-dev
https://golang.org/cl/4414044
2011-04-14 09:07:20 -07:00
Russ Cox
36713a2a53 compress/flate: dictionary support
R=bradfitzwork
CC=golang-dev
https://golang.org/cl/4397043
2011-04-14 10:41:55 -04:00
Luuk van Dijk
dd93df35b9 runtime: fix gdb support for channels.
R=rsc
CC=golang-dev
https://golang.org/cl/4418043
2011-04-14 15:32:20 +02:00
Dave Cheney
9c3ecb3617 runtime: fix set and not used in chan.c
R=rsc
CC=golang-dev
https://golang.org/cl/4416042
2011-04-14 08:16:40 -04:00
Russ Cox
507df959e4 runtime: drop chan circular linked list in favor of circular buffer
The list elements are already being allocated out of a
single memory buffer.  We can drop the Link* pointer
following and the memory it requires, replacing it with
index operations.

The change also keeps a channel from containing a pointer
back into its own allocation block, which would create a
cycle.  Blocks involved in cycles are not guaranteed to be
finalized properly, and channels depend on finalizers to
free OS-level locks on some systems.  The self-reference
was keeping channels from being garbage collected.

runtime-gdb.py will need to be updated in order to dump
the content of buffered channels with the new data structure.

Fixes #1676.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4411045
2011-04-13 23:42:06 -04:00
Russ Cox
4c006182dc pkg: manual cleanup of some gofixed code
R=golang-dev, niemeyer, r
CC=golang-dev
https://golang.org/cl/4372052
2011-04-13 23:36:00 -04:00
Corey Thomasson
785fbd94fd net: sort records returned by LookupMX
R=rog, adg, rsc
CC=golang-dev
https://golang.org/cl/4388048
2011-04-14 10:30:56 +10:00
Nigel Tao
4c60569e7c image: allow "?" wildcards when registering image formats.
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4404041
2011-04-14 09:56:42 +10:00
Robert Griesemer
a2e286828b gofmt: gofmt -s -w src misc
R=r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406044
2011-04-13 15:13:59 -07:00
Robert Griesemer
5666ec8735 fix build: disable gofmt test script, enable gotest testing instead
R=rsc
CC=golang-dev
https://golang.org/cl/4403045
2011-04-13 14:24:38 -07:00
Brad Fitzpatrick
c7d16cc411 http: flesh out server Expect handling + tests
This mostly adds Expect 100-continue tests (from
the perspective of server correctness) that were
missing before.

It also fixes a few missing cases that will
probably never come up in practice, but it's nice
to have handled correctly.

Proper 100-continue client support remains a TODO.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4399044
2011-04-13 14:09:04 -07:00
Russ Cox
7b6ee1a5d4 reflect: inline method implementations
This CL is only cut-and-paste, moving code around.
Moving it in a separate CL should simplify the diffs in later CLs.

There are three patterns here.

1. A function like
        func (v Value) M() (...) {
                return v.panicIfNot(K).(*kValue).M()
        }
becomes
        func (v Value) M() (...) {
                vv := v.panicIfNot(K).(*kValue)

                // body of (*kValue).M, s/v./vv./g
        }

2. A function like
        func (v Value) M() (...) {
                return v.panicIfNots(kList).(mer).M()
        }
becomes
        func (v Value) M() (...) {
                switch vv := v.panicIfNots(kList).(type) {
                case *k1Value:
                        // body of (*k1Value).M, s/v./vv./g
                case *k2Value:
                        // body of (*k2Value).M, s/v./vv./g
                ...
                }
                panic("not reached")
        }

3. The rewrite of Value.Set follows 2, but each case
is built from the bodies of (*kValue).SetValue and (*kValue).Set.
        func (v *kValue) SetValue(x Value) {
                v.Set(x.panicIfNot(K).(*kValue)
        }
        func (v *kValue) Set(x *kValue) {
                ... body
        }
becomes, in the switch from 2,
                case *kValue:
                        xx := x.panicIfNot(K).(*kValue)
                        ... body, s/v./vv./g; s/x./xx./g

R=r
CC=golang-dev
https://golang.org/cl/4398044
2011-04-13 16:55:20 -04:00
Russ Cox
1499c78281 build: tidy intermediate files during build
This CL changes the behavior of 'make install' and 'make test'
in the src/cmd directory and the src/pkg directory to have
each recursive make clean up after itself immediately.

It does the same in test/run, removing $F.$A and $A.out
(the common byproducts) between runs.

On machines with slow disks and aggressive kernel caching,
cleaning up immediately can mean that the intermediate
objects never get written to disk.

This change eliminates almost all the disk waiting during
all.bash on my laptop (a Thinkpad X201s with an SSD running Linux).

147.50u 19.95s 277.34r	before
148.53u 21.64s 179.59r	after

R=golang-dev, r, iant2
CC=golang-dev
https://golang.org/cl/4413042
2011-04-13 16:24:57 -04:00
Russ Cox
da8c5e7239 os/inotify: use _test for test files, not _obj
R=golang-dev, r, iant2
CC=golang-dev
https://golang.org/cl/4408043
2011-04-13 16:17:49 -04:00
Adam Langley
6392fc75cf bufio: add ReadLine
It matches encoding/line exactly and the tests are copied from there.
If we land this, then encoding/line will get marked as deprecated then
deleted in time.

R=rsc, rog, peterGo
CC=golang-dev
https://golang.org/cl/4389046
2011-04-13 15:12:28 -04:00
Brad Fitzpatrick
0be2ef3fc4 io: clarify that ReadAt shouldn't move the seek offset
R=r, mkrautz, r2, rsc
CC=golang-dev
https://golang.org/cl/4415041
2011-04-13 11:18:38 -07:00
Robert Griesemer
7c270aef08 go/ast: fixed bug in NotNilFilter, added test
- fixed a couple of comments
- cleanups after reflect change

R=rsc
CC=golang-dev
https://golang.org/cl/4389041
2011-04-13 09:37:13 -07:00
David Symonds
1de71a07e0 archive/tar: fix example's handling of os.EOF.
Fixes #1677.

R=r
CC=golang-dev
https://golang.org/cl/4402042
2011-04-13 10:56:33 +10:00
Fazlul Shahriar
08b0927771 os: fix Readdir in Plan 9
'TestReaddir.*' tests now passes.

R=golang-dev, lucio, r
CC=golang-dev
https://golang.org/cl/4381048
2011-04-12 16:58:56 -07:00
Rob Pike
4fe9f57413 fmt: allow %U for unsigned integers.
Suggested by jan.mercl@nic.cz.

R=rsc, jnml
CC=golang-dev
https://golang.org/cl/4376054
2011-04-12 11:03:05 -07:00
Brad Fitzpatrick
92210eefb2 http: client gzip support
R=adg, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4389048
2011-04-12 09:35:07 -07:00
Gustavo Niemeyer
c34aadf063 openpgp: Fix improper := shadowing
R=golang-dev, agl1, jnml
CC=golang-dev
https://golang.org/cl/4381058
2011-04-12 11:48:05 -03:00
Nigel Tao
ce89a233a2 image/ycbcr: new package.
R=r, rsc, nigeltao_gnome
CC=golang-dev, raph
https://golang.org/cl/4374043
2011-04-12 22:32:03 +10:00
Nigel Tao
420a17e371 net: fix laddr typo in test code.
R=rsc
CC=golang-dev
https://golang.org/cl/4381050
2011-04-12 10:36:41 +10:00
Robert Hencke
d36271a3e5 http: fix incorrect prints found by govet
R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4370053
2011-04-11 13:05:08 -07:00
Fazlul Shahriar
8c1a703560 syscall: fix StartProcess in Plan 9
This makes os_test.TestStartProcess test from os package pass.

R=paulzhol, r2, r
CC=golang-dev
https://golang.org/cl/4385052
2011-04-11 12:39:53 -07:00
Mikkel Krautz
e2348deeec crypto/x509: expose complete DER data
R=agl1
CC=golang-dev
https://golang.org/cl/4376049
2011-04-11 11:20:12 -04:00
Luit van Drongelen
fe3dcfee27 asn1: Implement correct marshalling of length octets
Fixes #1683

R=agl1
CC=golang-dev, rsc
https://golang.org/cl/4367049
2011-04-11 10:28:34 -04:00
Dave Cheney
8b8b54ad5c net: disable multicast tests by default.
Fixes #1649.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4343056
2011-04-11 10:39:21 +10:00
Dmitry Chestnykh
1b7142d157 archive/zip: add new type ReadCloser, make OpenReader return it.
Fixes #1678.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4372047
2011-04-10 11:23:23 +10:00
Robert Griesemer
ebaf01f052 go/printer, gofmt: use blank to separate import rename from import path
Note that declarations.golden is not using spaces for alignment (so
that the alignment tabs are visible) which is why this change affects
the test cases significantly. gofmt uses spaces for alignment (by default)
and only tabs for indentation.

gofmt -w src misc (no changes)

Fixes #1673.

R=iant
CC=golang-dev
https://golang.org/cl/4388044
2011-04-08 15:47:21 -07:00
Adam Langley
8fc6703391 big: don't crash when printing nil ints
"%#v" of a structure with *big.Int's tends to crash a lot otherwise.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4382044
2011-04-08 15:43:19 -04:00
Robert Hencke
8dc0ba7ae5 io: fixes for Read with n > 0, os.EOF
R=rsc
CC=golang-dev
https://golang.org/cl/4271080
2011-04-08 13:45:56 -04:00
Russ Cox
e6e2eb5807 http: do not listen on 0.0.0.0 during test
Quiets the pop-up boxes on OS X.

R=bradfitzgo, r2
CC=golang-dev
https://golang.org/cl/4387042
2011-04-08 13:04:29 -04:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Russ Cox
fb175cf77e reflect: new Type and Value definitions
Type is now an interface that implements all the possible type methods.
Instead of a type switch on a reflect.Type t, switch on t.Kind().
If a method is invoked on the wrong kind of type (for example,
calling t.Field(0) when t.Kind() != Struct), the call panics.

There is one method renaming: t.(*ChanType).Dir() is now t.ChanDir().

Value is now a struct value that implements all the possible value methods.
Instead of a type switch on a reflect.Value v, switch on v.Kind().
If a method is invoked on the wrong kind of value (for example,
calling t.Recv() when t.Kind() != Chan), the call panics.

Since Value is now a struct, not an interface, its zero value
cannot be compared to nil.  Instead of v != nil, use v.IsValid().
Instead of other uses of nil as a Value, use Value{}, the zero value.

Many methods have been renamed, most due to signature conflicts:

           OLD                          NEW

    v.(*ArrayValue).Elem             v.Index
    v.(*BoolValue).Get               v.Bool
    v.(*BoolValue).Set               v.SetBool
    v.(*ChanType).Dir                v.ChanDir
    v.(*ChanValue).Get               v.Pointer
    v.(*ComplexValue).Get            v.Complex
    v.(*ComplexValue).Overflow       v.OverflowComplex
    v.(*ComplexValue).Set            v.SetComplex
    v.(*FloatValue).Get              v.Float
    v.(*FloatValue).Overflow         v.OverflowFloat
    v.(*FloatValue).Set              v.SetFloat
    v.(*FuncValue).Get               v.Pointer
    v.(*InterfaceValue).Get          v.InterfaceData
    v.(*IntValue).Get                v.Int
    v.(*IntValue).Overflow           v.OverflowInt
    v.(*IntValue).Set                v.SetInt
    v.(*MapValue).Elem               v.MapIndex
    v.(*MapValue).Get                v.Pointer
    v.(*MapValue).Keys               v.MapKeys
    v.(*MapValue).SetElem            v.SetMapIndex
    v.(*PtrValue).Get                v.Pointer
    v.(*SliceValue).Elem             v.Index
    v.(*SliceValue).Get              v.Pointer
    v.(*StringValue).Get             v.String
    v.(*StringValue).Set             v.SetString
    v.(*UintValue).Get               v.Uint
    v.(*UintValue).Overflow          v.OverflowUint
    v.(*UintValue).Set               v.SetUint
    v.(*UnsafePointerValue).Get      v.Pointer
    v.(*UnsafePointerValue).Set      v.SetPointer

Part of the motivation for this change is to enable a more
efficient implementation of Value, one that does not allocate
memory during most operations.  To reduce the size of the CL,
this CL's implementation is a wrapper around the old API.
Later CLs will make the implementation more efficient without
changing the API.

Other CLs to be submitted at the same time as this one
add support for this change to gofix (4343047) and update
the Go source tree (4353043).

R=gri, iant, niemeyer, r, rog, gustavo, r2
CC=golang-dev
https://golang.org/cl/4281055
2011-04-08 12:26:51 -04:00
Robert Griesemer
0ada4a2d62 go/types: fix build: use the right compiler to compile test case
R=rsc
CC=golang-dev
https://golang.org/cl/4369050
2011-04-07 22:10:39 -07:00
Robert Griesemer
a87382e7b3 go/types: New Go type hierarchy implementation for AST.
This CL defines a new, more Go-like representation of
Go types (different structs for different types as
opposed to a single Type node). It also implements
an ast.Importer for object/archive files generated
by the gc compiler tool chain. Besides the individual
type structs, the main difference is the handling of
named types: In the old world, a named type had a
non-nil *Object pointer but otherwise looked no
different from other types. In this new model, named
types have their own representation types.Name. As
a result, resolving cycles is a bit simpler during
construction, at the cost of having to deal with
types.Name nodes explicitly later. It remains to be
seen if this is a good approach. Nevertheless, code
involving types reads more nicely and benefits from
full type checking. Also, the representation seems
to more closely match the spec wording.

Credits: The original version of the gc importer was
written by Evan Shaw (chickencha@gmail.com). The new
version in this CL is based largely on Evan's original
code but contains bug fixes, a few simplifications,
some restructuring, and was adjusted to use the
new type hierarchy. I have added a comprehensive test
that imports all packages found under $GOROOT/pkg (with
a 3s time-out to limit the run-time of the test). Run
gotest -v for details.

The original version of ExportData (exportdata.go) was
written by Russ Cox (rsc@golang.org). The current version
is returning the internal buffer positioned at the beginning
of the export data instead of printing the export data to
stdout.

With the new types package, the existing in-progress
typechecker package is deprecated. I will delete it
once all functionality has been brought over.

R=eds, rog, rsc
CC=golang-dev
https://golang.org/cl/4314054
2011-04-07 21:40:37 -07:00
Robert Griesemer
70bf4215e9 scanner: better TokenString output
R=rsc
CC=golang-dev
https://golang.org/cl/4373048
2011-04-07 19:41:55 -07:00
Alex Brainman
d3cd0c0752 syscall: fix Windows Signalled
Thanks to fhs.

R=golang-dev, r2
CC=ality, fhs, golang-dev
https://golang.org/cl/4375044
2011-04-08 10:27:47 +10:00
Russ Cox
62c24811e7 syscall: fix freebsd/386 again
TBR=r
CC=golang-dev
https://golang.org/cl/4380042
2011-04-07 15:44:10 -04:00
Russ Cox
62049366e7 syscall: freebsd/386 Syscall9 (fix build)
R=r
CC=golang-dev
https://golang.org/cl/4386042
2011-04-07 15:35:04 -04:00
Mikio Hara
c54ed66c75 syscall: fix build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4368050
2011-04-07 12:03:45 -07:00
Dave Cheney
b3a4d58ba8 syscall: fix typo in mmap comment
R=rsc
CC=golang-dev
https://golang.org/cl/4377043
2011-04-06 23:07:32 -04:00
Russ Cox
48ae1f2d9b syscall: add Mmap, Munmap on Linux, FreeBSD, OS X
* tweak mksyscall*.pl to be more gofmt-compatible.
* add mkall.sh -syscalls option.
* add sys/mman.h constants on OS X

R=r, eds, niemeyer
CC=golang-dev
https://golang.org/cl/4369044
2011-04-06 17:52:02 -04:00
Albert Strasheim
c45a08e5ba syscall: Add DT_* and MADV_* constants on Linux.
R=rsc, agl1
CC=golang-dev
https://golang.org/cl/4370041
2011-04-06 16:19:22 -04:00
Russ Cox
cf56f06ab6 os, syscall: refactor Unix directory parsing
Moved the details of how to read a directory
and how to parse the results behind the new
syscall functions ReadDirent and ParseDirent.

Now os needs just one copy of Readdirnames
for the three Unix variants, and it no longer
imports "unsafe".

R=r, r2
CC=golang-dev
https://golang.org/cl/4368048
2011-04-06 15:44:40 -04:00
Rob Pike
1e1e2f0971 exec: add a little package commentary explaining its
relationship to os.Process.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4384041
2011-04-06 12:37:17 -07:00
Russ Cox
2671ddd10b fix build (sorry)
TBR=r
CC=golang-dev
https://golang.org/cl/4378042
2011-04-06 15:13:18 -04:00
Russ Cox
0ea7bf4867 src/pkg/Makefile: trim per-directory make output except on failure
Not committed to this but it sure makes
the output easier to skim.  With this CL:

$ make
install runtime
install sync/atomic
install sync
install unicode
install utf16
install syscall
install os
...
install ../cmd/govet
install ../cmd/goyacc
install ../cmd/hgpatch
$ make test
test archive/tar
test archive/zip
test asn1
test big
test bufio
...
test path
test path/filepath
TEST FAIL reflect
gotest
rm -f _test/reflect.a
6g -o _gotest_.6 deepequal.go type.go value.go
rm -f _test/reflect.a
gopack grc _test/reflect.a _gotest_.6
all_test.go:210: invalid type assertion: reflect.NewValue(tt.i).(*StructValue) (non-interface type reflect.Value on left)
all_test.go:217: cannot type switch on non-interface value v (type reflect.Value)
all_test.go:218: undefined: IntValue
all_test.go:221: cannot use 132 (type int) as type reflect.Value in function argument
all_test.go:223: cannot use 8 (type int) as type reflect.Value in function argument
all_test.go:225: cannot use 16 (type int) as type reflect.Value in function argument
all_test.go:227: cannot use 32 (type int) as type reflect.Value in function argument
all_test.go:229: cannot use 64 (type int) as type reflect.Value in function argument
all_test.go:231: undefined: UintValue
all_test.go:234: cannot use 132 (type int) as type reflect.Value in function argument
all_test.go:234: too many errors
gotest: "/Users/rsc/g/go/bin/6g -I _test -o _xtest_.6 all_test.go tostring_test.go" failed: exit status 1
make[1]: *** [test] Error 2
make: *** [reflect.test] Error 1

R=r, r2
CC=golang-dev
https://golang.org/cl/4343046
2011-04-06 15:06:28 -04:00
Rob Pike
5ee13c0d59 log: generalize getting and setting flags and prefix.
- used to be only for standard log, not for user-built.
- there were no getters.
Also rearrange the code a little so we can avoid allocating
a buffer on every call.  Logging is expensive but we should
avoid unnecessary cost.

This should have no effect on existing code.

R=rsc
CC=golang-dev
https://golang.org/cl/4363045
2011-04-06 11:48:03 -07:00
Adam Langley
41971434d1 crypto/rsa: add 3-prime support.
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4365041
2011-04-06 14:11:56 -04:00
Adam Langley
057bdfe39d crypto/rsa: flip the CRT code over so that it matches PKCS#1
The CRT is symmetrical in the case of two variables and I picked a
different form from PKCS#1.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4381041
2011-04-06 10:22:04 -04:00
Alex Brainman
7f7371e95b pkg/path: enable tests on Windows
Fixes #1107.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4374041
2011-04-06 16:45:20 +10:00
Andrew Gerrand
b44dbff8c8 http: allow override of Content-Type for ServeFile
R=bradfitz, bradfitzwork
CC=golang-dev
https://golang.org/cl/4368041
2011-04-06 14:52:42 +10:00
Adam Langley
360ab50a9b crypto/rsa: add support for precomputing CRT values.
This speeds up private key operations by 3.5x (for a 2048-bit
modulus).

R=golang-dev, r, rsc1
CC=golang-dev
https://golang.org/cl/4348053
2011-04-05 18:07:01 -04:00
Dmitry Chestnykh
9f1394d270 crypto/ecdsa, crypto/rsa: use io.ReadFull to read from random source.
R=golang-dev, agl1
CC=golang-dev
https://golang.org/cl/4316057
2011-04-05 17:11:31 -04:00
Adam Langley
906b2e7679 crypto/des: cleanups
R=rsc
CC=golang-dev
https://golang.org/cl/4315050
2011-04-05 15:40:48 -04:00
Adam Langley
2db1769d7b crypto/block: remove deprecated package.
R=rsc
CC=golang-dev
https://golang.org/cl/4315051
2011-04-05 15:23:40 -04:00
Russ Cox
de3aac609c gofix: don't rewrite O_APPEND opens
R=r, rog
CC=golang-dev
https://golang.org/cl/4364041
2011-04-05 11:12:02 -04:00
Yasuhiro Matsumoto
7098f3d442 crypto/des: new package providing implementations of DES and TDEA
Original code by Chris Lennert <cale...@gmail.com>

R=rsc, agl1
CC=golang-dev
https://golang.org/cl/4331054
2011-04-05 10:59:10 -04:00
Rob Pike
80c5ef9f31 os: fix windows build
R=brainman
CC=golang-dev
https://golang.org/cl/4308047
2011-04-04 23:57:08 -07:00
Rob Pike
8a90fd3c72 os: New Open API.
We replace the current Open with:
OpenFile(name, flag, perm) // same as old Open
Open(name) // same as old Open(name, O_RDONLY, 0)
Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666)

This CL includes a gofix module and full code updates: all.bash passes.
(There may be a few comments I missed.)

The interesting packages are:
        gofix
        os
Everything else is automatically generated except for hand tweaks to:
        src/pkg/io/ioutil/ioutil.go
        src/pkg/io/ioutil/tempfile.go
        src/pkg/crypto/tls/generate_cert.go
        src/cmd/goyacc/goyacc.go
        src/cmd/goyacc/units.y

R=golang-dev, bradfitzwork, rsc, r2
CC=golang-dev
https://golang.org/cl/4357052
2011-04-04 23:42:14 -07:00
Brad Fitzpatrick
6e4966eb7f http: ignore Transfer-Encoding on HEAD responses
Amazon S3 sends Transfer-Encoding "chunked"
on its 404 responses to HEAD requests for
missing objects.

We weren't ignoring the Transfer-Encoding
and were thus interpretting the subsequent
response headers as a chunk header from the
previous responses body (but a HEAD response
can't have a body)

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4346050
2011-04-04 19:43:36 -07:00
Brad Fitzpatrick
243266f62e http: fix Transport connection re-use race
A connection shouldn't be made available
for re-use until its body has been consumed.

(except in the case of pipelining, which isn't
implemented yet)

This CL fixes some issues seen with heavy load
against Amazon S3.

Subtle implementation detail: to prevent a race
with the client requesting a new connection
before previous one is returned, we actually
have to call putIdleConnection _before_ we
return from the final Read/Close call on the
http.Response.Body.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4351048
2011-04-04 19:22:47 -07:00
Mikio Hara
f3ad899a2d net: fix typo
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4315049
2011-04-05 11:35:16 +10:00
Gustavo Niemeyer
94e60061eb filepath: new Abs function
R=golang-dev, rsc1, peterGo, bsiegert, r, mattn
CC=golang-dev
https://golang.org/cl/4271057
2011-04-04 18:29:24 -07:00
Brad Fitzpatrick
7c9c4fc3a1 http: fix hanging bug with HEAD responses
The transport readLoop was waiting forever for the client to
read the non-existent body before proceeding to read the next
request.

R=rsc
CC=golang-dev
https://golang.org/cl/4357051
2011-04-04 16:58:11 -07:00
Brad Fitzpatrick
2be13a80c7 os: add Seek whence constants
R=r, r2, rsc1, rsc, jacek.masiulaniec
CC=golang-dev
https://golang.org/cl/4344062
2011-04-04 13:53:52 -07:00
Rob Pike
60c4c3464b path/filepath.Glob: add an error return.
The error will only occur for invalid patterns, but without this
error path there is no way to know that Glob has failed due to
an invalid pattern.

R=rsc
CC=golang-dev
https://golang.org/cl/4346044
2011-04-04 13:09:34 -07:00
Evan Shaw
06ee80d6eb bufio: Write and WriteString cleanup
Write never writes less than the buffer size and WriteString takes advantage
of the copy built-in to improve write efficiency.

R=rsc, ality, rog
CC=golang-dev
https://golang.org/cl/4344060
2011-04-04 15:57:10 -04:00
Matt Jones
5fd0a74987 http: use upper case hex in URL escaping
According to RFC 3986: "For consistency, URI producers
and normalizers should use uppercase hexadecimal digits
for all percent-encodings."  Using lower case characters
makes it incompatible with Google APIs when signing OAuth requests.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4352044
2011-04-04 15:49:49 -04:00
Albert Strasheim
492039ae7f os: Fix MkdirAll("/thisdoesnotexist").
Fixes #1637.

R=rsc, rh, msolo
CC=golang-dev
https://golang.org/cl/4317049
2011-04-04 15:45:03 -04:00
Mikio Hara
5a59b9eba3 syscall: add BPF support for freebsd/386, freebsd/amd64
R=rsc
CC=golang-dev
https://golang.org/cl/4331050
2011-04-04 15:40:40 -04:00
Brad Fitzpatrick
cc40870f4b httptest: add NewTLSServer
Enables the use of https servers in tests.

R=agl, rsc, agl1
CC=golang-dev
https://golang.org/cl/4284063
2011-04-04 08:32:59 -07:00
Brad Fitzpatrick
a2bcd3814d http: make triv.go example compile again
Ideally we'd compile all example files during
the build, though.

Fixes #1660

R=r
CC=golang-dev
https://golang.org/cl/4358049
2011-04-04 08:10:26 -07:00
Andrey Mirtchovski
fbeaa869f6 path/filepath: add support for plan9
R=paulzhol, ality, r, fhs
CC=golang-dev
https://golang.org/cl/4316054
2011-04-03 09:11:41 -07:00
Andrey Mirtchovski
69819c2ea3 os: add a few missing plan9 errors
these were needed by packages in crypto/ and by io/ioutil

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4350047
2011-04-03 08:52:43 -07:00
Yuval Pavel Zholkover
c256f0a4b3 os: Plan 9 support.
R=rsc, ality, r, r2
CC=golang-dev
https://golang.org/cl/4149046
2011-04-02 14:28:58 -07:00
Yuval Pavel Zholkover
1cc4a5cd94 R=rsc, brainman, ality, r2, r
CC=golang-dev
https://golang.org/cl/3816043
2011-04-02 14:24:03 -07:00
Robert Griesemer
c42b3e21c3 go/parser: package name must not be the blank identifier
R=r, r2, rsc1
CC=golang-dev
https://golang.org/cl/4343045
2011-04-01 20:51:55 -07:00
Evan Shaw
7b40095e8c syscall: make Rawsyscall6 pass 6th arg on linux/386
Forgot this one in the previous CL

R=rsc, r
CC=golang-dev
https://golang.org/cl/4345043
2011-04-01 22:26:57 -04:00
Evan Shaw
46137557c4 syscall: make Syscall6 pass 6th arg on linux/386
R=rsc
CC=golang-dev
https://golang.org/cl/4350043
2011-04-01 20:46:01 -04:00
Rob Pike
a78a25a16b path/filepath.Glob: don't drop known matches on error.
Fixes #1610.

R=rsc
CC=golang-dev
https://golang.org/cl/4355042
2011-04-01 09:58:05 -07:00
Ian Lance Taylor
554082d6b1 testing: add -test.timeout option.
Since Go code can deadlock, this lets a testsuite driver set a
time limit for the test to run.  This is simple but imperfect,
in that it only catches deadlocks in Go code, not in the
runtime scheduler.

R=r, rsc, iant2
CC=golang-dev
https://golang.org/cl/4326048
2011-03-31 15:27:51 -07:00
Rob Pike
3907031358 fmt: implement precs for %q.
Also fix a bug: precision was in terms of bytes; should be runes.
Fixes #1652.

R=rsc, bradfitzgo, r2, bradfitzwork
CC=golang-dev
https://golang.org/cl/4280086
2011-03-31 14:56:01 -07:00
Brad Fitzpatrick
883048daab http: add Transport.MaxIdleConnsPerHost
R=rsc
CC=golang-dev
https://golang.org/cl/4280079
2011-03-31 12:58:50 -07:00
Alexey Borzenkov
10694c81b0 net, syscall: fix windows build
Fix resolv_windows.go to support recent DNS-lookup changes

R=brainman, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4300045
2011-03-31 15:16:18 +11:00
Russ Cox
b66b22cdd4 fmt: remove uintptrGetter type checks
This will make the fmt code easier to gofix
when the new reflect interface is ready.

R=r
CC=golang-dev
https://golang.org/cl/4324043
2011-03-30 22:12:30 -04:00
Robert Griesemer
7a5bbfd47f gotype: support for more tests, added one new test
also: minor fix to parser

Note: gotest won't run the gotype test yet until
it permits TestXXX functions where XXX is empty.

R=r
CC=golang-dev
https://golang.org/cl/4300053
2011-03-30 15:27:23 -07:00
Robert Griesemer
e64d337726 scanner: treat line comments like in Go
- don't consume '\n' as part of line comment
(otherwise grammars where '\n' are tokens won't
see them after a line comment)

- permit line comments to end in EOF

R=r
CC=golang-dev
https://golang.org/cl/4277089
2011-03-30 15:26:53 -07:00
Roger Peppe
dba96cf411 go/parser: fix scoping for local type declarations
R=gri
CC=golang-dev
https://golang.org/cl/4332045
2011-03-30 09:45:51 -07:00
Robert Griesemer
1afc37fa7e go/printer/gofmt: remove special case for multi-line raw strings
As a special case, multi-line raw strings (i.e., strings in `` quotes)
were not indented if they were the only token on a line. This heuristic
was meant to improve formatting for multi-line raw strings where sub-
sequent lines are not indented at the level of the surrounding code.
Multiple people have complained about this. Removing the heuristic
again because it makes the formatting more regular, easier to under-
stand, and simplifies the implementation.

- manual changes to ebnf/ebnf_test.go for readability
- gofmt -w src misc

Fixes #1643.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4307045
2011-03-29 18:30:59 -07:00
Andrew Gerrand
d54c4ecc32 time: make TestAfterQueuing retry 3 times before declaring failure.
I'm in two minds as to whether this should be a function of gotest.
Tests that can flake out like this should be rare enough that we
needn't add more mechanism.

R=r
CC=golang-dev
https://golang.org/cl/4335042
2011-03-30 11:40:00 +11:00
Adam Langley
974d2c98e0 crypto/tls: extend NPN support to the client.
R=bradfitzgo, rsc1, bradfitzwork
CC=golang-dev
https://golang.org/cl/4277085
2011-03-29 17:53:09 -04:00
Rob Pike
d844aae690 prints: fix a couple of formatting errors caught by govet
R=rsc, agl, agl1
CC=golang-dev
https://golang.org/cl/4337041
2011-03-29 14:03:08 -07:00
Rob Pike
fb80f63cf7 gotest: replace the shell script with the compiled program written in go.
Update the make sequence: gotest must now be installed after the packages.

R=rsc
CC=golang-dev
https://golang.org/cl/4323044
2011-03-29 13:29:20 -07:00
Adam Langley
9225bbfc0c crypto/cipher: bad CTR IV length now triggers panic
R=rsc
CC=golang-dev
https://golang.org/cl/4326042
2011-03-29 15:47:35 -04:00
Albert Strasheim
d41d6fec10 syscall: StartProcess Chroot and Credential.
R=rsc, iant, agl1
CC=golang-dev
https://golang.org/cl/4280065
2011-03-29 14:29:22 -04:00
Alexey Borzenkov
0793176451 net: move bind back to sock.go
It was left in netFD.connect() by an oversight (as the name
implies, bind has no business being in connect). As a result
of this change and by only calling netFD.connect() when ra
isn't nil it becomes simpler with less code duplication.

Additionally, if netFD.connect() fails, set sysfd to -1 to
avoid finalizers (e.g. on windows) calling shutdown on a
closed and possibly reopened socket that just happened to
share the same descriptor.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4328043
2011-03-29 14:23:42 -04:00
David Forsythe
85c79ef7cb os: fix FileInfo.Name returned by Stat
Fixes #1645.

R=rsc
CC=golang-dev
https://golang.org/cl/4321045
2011-03-29 14:23:36 -04:00
Rob Pike
d74ff67cc8 debug/gosym: remove need for gotest to run preparatory commands.
Put them into the Makefile instead. One dependency mechanism is enough.

R=rsc
CC=golang-dev
https://golang.org/cl/4331043
2011-03-29 10:41:23 -07:00
Robert Griesemer
536531769b CL 4291070: incorporating rsc's feedback
R=rsc
CC=golang-dev
https://golang.org/cl/4313054
2011-03-29 09:08:23 -07:00
Mikkel Krautz
a7bb288f99 crypto/x509: Parse Extended Key Usage extension
This changeset makes it possible for crypto/x509 to parse
certificates that include the 'Extended Key Usage' extension
with the critical bit set.

R=agl1
CC=golang-dev
https://golang.org/cl/4277075
2011-03-29 10:35:34 -04:00
Adam Langley
054516338a asn1: extensions needed for parsing Kerberos
* Adds support for GENERAL STRING
* Adds support for APPLICATION tagged values.
* Add UnmarshalWithParams to set parameters for the top-level
  structure

R=golang-dev, rsc1, r
CC=golang-dev
https://golang.org/cl/4291075
2011-03-29 10:33:47 -04:00
Evan Shaw
47f4ae1a78 bytes, strings: simplify Join
R=gri, rsc
CC=golang-dev
https://golang.org/cl/4300044
2011-03-29 01:27:38 -04:00
Alexey Borzenkov
2f45f72dce net: implement non-blocking connect
Refactored bind/connect from sock.go into netFD.connect(), as
a consequence newFD() doesn't accept laddr/raddr anymore, and
expects an (optional) call to netFD.connect() followed by a
call to netFD.setAddr().
Windows code is updated, but still uses blocking connect,
since otherwise it needs support for ConnectEx syscall.

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/4303060
2011-03-28 23:40:01 -04:00
Russ Cox
98828f033a fix build
TBR=adg
CC=golang-dev
https://golang.org/cl/4322041
2011-03-28 23:39:39 -04:00
Russ Cox
5546cc7eab update tree for package net changes
Converted with gofix.

R=adg
CC=golang-dev
https://golang.org/cl/4284049
2011-03-28 23:28:53 -04:00
Russ Cox
41f93a430f net: drop laddr from Dial, cname from LookupHost; new functions
Drop laddr argument from Dial.

Drop cname return from LookupHost.

Add LookupIP, LookupCNAME, ParseCIDR, IP.Equal.
Export SplitHostPort, JoinHostPort.
Add AAAA (IPv6) support to host lookups.

Preparations for implementing some of the
lookups using cgo.

ParseCIDR and IP.Equal are logically new in this CL
but accidentally snuck into an earlier CL about unused
labels that was in the same client.

In crypto/tls, drop laddr from Dial to match net.

R=golang-dev, dsymonds, adg, rh
CC=golang-dev
https://golang.org/cl/4244055
2011-03-28 23:28:42 -04:00
Robert Griesemer
5a3aae4bf7 go/printer, gofmt: rely on existing line breaks when formatting expression lists
No impact on existing sources.

Fixes #1632.

R=rsc
CC=golang-dev
https://golang.org/cl/4271083
2011-03-28 18:48:52 -07:00
Robert Griesemer
b2658452a6 go/scanner: return literal as string instead of []byte
Removed many string conversions in dependent code.
Runs all tests. No change to gofmt output.

R=r
CC=golang-dev
https://golang.org/cl/4291070
2011-03-28 16:44:28 -07:00
Robert Griesemer
2796ac1466 go/token: use array instead of map for token->string table
R=rsc
CC=golang-dev
https://golang.org/cl/4284070
2011-03-28 13:38:24 -07:00
Ian Lance Taylor
0caa0c0923 net: let OS-specific AddFD routine wake up polling thread.
With gccgo some operating systems require using select rather
than epoll or kevent.  Using select means that we have to wake
up the polling thread each time we add a new file descriptor.
This implements that in the generic code rather than adding
another wakeup channel, even though nothing in the current net
package uses the capability.

R=rsc, iant2
CC=golang-dev
https://golang.org/cl/4284069
2011-03-28 12:39:09 -07:00
Robert Griesemer
5be77a204b go/ast: implemented NewPackage
NewPackage creates an ast.Package node from
a set of package files and resolves unresolved
identifiers.

Also:
- Changed semantics of Scope.Insert: If an
  object is inserted w/o errors, the result
  is nil (before it was obj).
- Fixed an identifier resolution bug in the
  parser: map keys must not be resolved.

gotype runs through several go/* packages
and successfully resolves all (non-field/method)
identifiers.

R=rog, rsc
CC=golang-dev
https://golang.org/cl/4298044
2011-03-28 10:46:26 -07:00
Brad Fitzpatrick
a7a854b82f strings: Map: avoid allocation when string is unchanged
This speeds up strings.ToLower, etc.

before/after:
strings_test.BenchmarkMapNoChanges 1000000 1013 ns/op
strings_test.BenchmarkMapNoChanges 5000000  442 ns/op

R=r, rog, eh, rsc
CC=golang-dev
https://golang.org/cl/4306056
2011-03-28 09:41:57 -07:00
Luuk van Dijk
43512e6c70 runtime: fix gdb support for goroutines.
in gdb, 'info goroutines' and 'goroutine <n> <cmd> were crashing
because the 'g' and 'm' structures had changed a bit.

R=rsc
CC=golang-dev
https://golang.org/cl/4289077
2011-03-28 17:34:22 +02:00
Russ Cox
6b3357129a build: add all-qemu.bash, handful of arm fixes
R=r
CC=golang-dev
https://golang.org/cl/4313051
2011-03-27 23:39:42 -04:00
Russ Cox
732f2fa2c1 http: avoid crash when asked for multiple file ranges
R=adg
CC=golang-dev
https://golang.org/cl/4289076
2011-03-27 23:35:31 -04:00
Alexey Borzenkov
59a8926829 runtime: fix darwin/amd64 thread VM footprint
On darwin amd64 it was impossible to create more that ~132 threads. While
investigating I noticed that go consumes almost 1TB of virtual memory per
OS thread and the reason for such a small limit of OS thread was because
process was running out of virtual memory. While looking at bsdthread_create
I noticed that on amd64 it wasn't using PTHREAD_START_CUSTOM.
If you look at http://fxr.watson.org/fxr/source/bsd/kern/pthread_synch.c?v=xnu-1228
you will see that in that case darwin will use stack pointer as stack size,
allocating huge amounts of memory for stack. This change fixes the issue
and allows for creation of up to 2560 OS threads (which appears to be some
Mac OS X limit) with relatively small virtual memory consumption.

R=rsc
CC=golang-dev
https://golang.org/cl/4289075
2011-03-27 17:15:48 -04:00
Rob Pike
7f9acb53cb testing: shorten some more tests
R=rsc
CC=golang-dev
https://golang.org/cl/4314044
2011-03-26 11:25:22 -07:00
Robert Hencke
a4df525a79 gob: trivial cleanup
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279074
2011-03-25 20:45:21 -07:00
Rob Pike
f0cf7d296c testing: shorten some tests.
These are the top runners.  More to come.
Also print two digits of timing info under -test.v.

R=rsc
CC=golang-dev
https://golang.org/cl/4317044
2011-03-25 16:31:10 -07:00
Rob Pike
d406f8f650 testing: set up structure for faster testing using the new -test.short flag.
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

Use -test.short to make one package (crypto ecdsa) run much faster.
More changes to come.

Once this is in, I will update the long-running tests to use the new flag.

R=rsc
CC=golang-dev
https://golang.org/cl/4317043
2011-03-25 14:50:44 -07:00
Peter Mundy
91bcdb620b net: fix Windows build
R=rsc
CC=golang-dev
https://golang.org/cl/4314042
2011-03-25 16:11:19 -04:00
Albert Strasheim
e83d69647f syscall: GetsockoptInt for darwin, freebsd.
R=rsc
CC=golang-dev
https://golang.org/cl/4298060
2011-03-25 14:43:59 -04:00
Albert Strasheim
e480b81971 net: add FileConn, FilePacketConn, FileListener
R=iant, rsc, brainman
CC=golang-dev
https://golang.org/cl/4306042
2011-03-25 14:42:25 -04:00
Rob Pike
9db2bc741e flag: fix error in documentation example.
Fixes #1615.
This time for sure.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4275079
2011-03-25 11:28:31 -07:00
Russ Cox
071d212a22 runtime/pprof: disable test on darwin
Fixes #1641.

Actually it side steps the real issue, which is that the
setitimer(2) implementation on OS X is not useful for
profiling of multi-threaded programs.  I filed the below
using the Apple Bug Reporter.

/*
Filed as Apple Bug Report #9177434.

This program creates a new pthread that loops, wasting cpu time.
In the main pthread, it sleeps on a condition that will never come true.
Before doing so it sets up an interval timer using ITIMER_PROF.
The handler prints a message saying which thread it is running on.

POSIX does not specify which thread should receive the signal, but
in order to be useful in a user-mode self-profiler like pprof or gprof
   http://code.google.com/p/google-perftools
   http://www.delorie.com/gnu/docs/binutils/gprof_25.html
it is important that the thread that receives the signal is the one
whose execution caused the timer to expire.

Linux and FreeBSD handle this by sending the signal to the process's
queue but delivering it to the current thread if possible:

   http://lxr.linux.no/linux+v2.6.38/kernel/signal.c#L802
     807        /*
     808         * Now find a thread we can wake up to take the signal off the queue.
     809         *
     810         * If the main thread wants the signal, it gets first crack.
     811         * Probably the least surprising to the average bear.
     812         * /

   http://fxr.watson.org/fxr/source/kern/kern_sig.c?v=FREEBSD8;im=bigexcerpts#L1907
     1914         /*
     1915          * Check if current thread can handle the signal without
     1916          * switching context to another thread.
     1917          * /

On those operating systems, this program prints:

    $ ./a.out
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    signal on cpu-chewing looper thread
    $

The OS X kernel does not have any such preference.  Its get_signalthread
does not prefer current_thread(), in contrast to the other two systems,
so the signal gets delivered to the first thread in the list that is able to
handle it, which ends up being the main thread in this experiment.
http://fxr.watson.org/fxr/source/bsd/kern/kern_sig.c?v=xnu-1456.1.26;im=excerpts#L1666

    $ ./a.out
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    signal on sleeping main thread
    $

The fix is to make get_signalthread use the same heuristic as
Linux and FreeBSD, namely to use current_thread() if possible
before scanning the process thread list.

*/

#include <sys/time.h>
#include <sys/signal.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static void handler(int);
static void* looper(void*);

static pthread_t pmain, ploop;

int
main(void)
{
        struct itimerval it;
        struct sigaction sa;
        pthread_cond_t cond;
        pthread_mutex_t mu;

        memset(&sa, 0, sizeof sa);
        sa.sa_handler = handler;
        sa.sa_flags = SA_RESTART;
        memset(&sa.sa_mask, 0xff, sizeof sa.sa_mask);
        sigaction(SIGPROF, &sa, 0);

        pmain = pthread_self();
        pthread_create(&ploop, 0, looper, 0);

        memset(&it, 0, sizeof it);
        it.it_interval.tv_usec = 10000;
        it.it_value = it.it_interval;
        setitimer(ITIMER_PROF, &it, 0);

        pthread_mutex_init(&mu, 0);
        pthread_mutex_lock(&mu);

        pthread_cond_init(&cond, 0);
        for(;;)
                pthread_cond_wait(&cond, &mu);

        return 0;
}

static void
handler(int sig)
{
        static int nsig;
        pthread_t p;

        p = pthread_self();
        if(p == pmain)
                printf("signal on sleeping main thread\n");
        else if(p == ploop)
                printf("signal on cpu-chewing looper thread\n");
        else
                printf("signal on %p\n", (void*)p);
        if(++nsig >= 10)
                exit(0);
}

static void*
looper(void *v)
{
        for(;;);
}

R=r
CC=golang-dev
https://golang.org/cl/4273113
2011-03-25 13:47:07 -04:00
Ian Lance Taylor
7c616b3809 runtime: always set *received in chanrecv.
Also fix comment.

The only caller of chanrecv initializes the value to false, so
this patch makes no difference at present.  But it seems like
the right thing to do.

R=rsc
CC=golang-dev
https://golang.org/cl/4312053
2011-03-25 10:36:22 -07:00
Ian Lance Taylor
f6d0e81179 runtime/darwin: remove unused local variables.
R=rsc
CC=golang-dev
https://golang.org/cl/4309049
2011-03-25 10:35:46 -07:00
Russ Cox
e857dd5d3f http/pprof: cpu profiling support
R=r
CC=golang-dev
https://golang.org/cl/4280060
2011-03-25 12:50:12 -04:00
Roger Pau Monné
500effe79e http: modified perl cgi test to remove newline from env variables
Fixes #1639

R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4291069
2011-03-25 09:33:45 -07:00
Russ Cox
1f2234633f runtime: fix arm build
R=adg, dfc, r
CC=golang-dev
https://golang.org/cl/4296042
2011-03-25 12:30:49 -04:00
Devon H. O'Dell
e37892c36c freebsd-386: update defs
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4273102
2011-03-25 10:18:04 +11:00
Robert Griesemer
1b2c3e664b go/parser: resolve identifiers properly
Correctly distinguish between lhs and rhs identifiers
and resolve/declare them accordingly.

Collect field and method names in respective scopes
(will be available after some minor AST API changes).

Also collect imports since it's useful to have that
list directly w/o having to re-traverse the AST
(will also be available after some minor AST API changes).

No external API changes in this CL.

R=rsc, rog
CC=golang-dev
https://golang.org/cl/4271061
2011-03-24 11:45:52 -07:00
Rob Pike
d1b75bbc46 gob: remove another allocation.
The top level bytes.Buffer is always there and can be re-used.
Rpc goes from 83 to 79 mallocs per round trip.

R=rsc
CC=golang-dev
https://golang.org/cl/4271062
2011-03-23 21:49:19 -07:00
Andrew Gerrand
1c05a90ae2 runtime: fix freebsd-amd64 (and part of 386)
R=rsc
CC=golang-dev
https://golang.org/cl/4285063
2011-03-24 11:45:12 +11:00
Alex Brainman
913c8d7397 syscall: StartProcess fixes for windows
- StartProcess will work with relative (to attr.Dir, not
  current directory) executable filenames
- StartProcess will only work if executable filename points
  to the real file, it will not search for executable in the
  $PATH list and others (see CreateProcess manual for details)
- StartProcess argv strings can contain any characters

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4306041
2011-03-24 11:20:28 +11:00
Russ Cox
543acc97f9 testing: add -test.cpuprofile flag
R=r
CC=golang-dev
https://golang.org/cl/4272066
2011-03-23 18:17:14 -04:00
Brad Fitzpatrick
9d3b39986c http: don't chunk 304 responses
rsc's earlier fix, plus tests.

R=rsc
CC=golang-dev
https://golang.org/cl/4285062
2011-03-23 14:29:26 -07:00
Albert Strasheim
c6810e76ed syscall: GetsockoptInt.
R=rsc, iant
CC=golang-dev
https://golang.org/cl/4271060
2011-03-23 14:33:48 -04:00
Russ Cox
b47ec598b7 runtime/pprof: cpu profiling support
R=r, bradfitzgo, r2
CC=golang-dev
https://golang.org/cl/4313041
2011-03-23 13:54:31 -04:00
Brad Fitzpatrick
059c07cab0 http: export Transport, add keep-alive support
This patch adds a connection cache and keep-alive
support to Transport, which is used by the
HTTP client.

It's also structured such that it's easy to add
HTTP pipelining in the future.

R=rsc, petar-m, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4272045
2011-03-23 10:38:18 -07:00
Russ Cox
c19b373c8a runtime: cpu profiling support
R=r
CC=golang-dev
https://golang.org/cl/4306043
2011-03-23 11:43:37 -04:00
Russ Cox
f9fc1ddf75 runtime: fix print - no %v in C
R=r
CC=golang-dev
https://golang.org/cl/4280061
2011-03-23 11:34:03 -04:00
Russ Cox
8dee872963 runtime: os-specific types and code for setitimer
R=r
CC=golang-dev
https://golang.org/cl/4273097
2011-03-23 11:31:42 -04:00
Russ Cox
ccdbb8a6c2 runtime: more stack split fixes
Found by stkcheck after 6l, 8l bug fixes Luuk is about to submit.

R=lvd
CC=golang-dev
https://golang.org/cl/4306047
2011-03-23 11:28:24 -04:00
Andrew Gerrand
39ffd546bd sync: fix example code
Fixes #1631.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4303046
2011-03-23 14:24:30 +11:00
Ken Thompson
a73817716a chan: allocate a new chan with one
malloc rather than nelements + 1.

R=rob
CC=golang-dev
https://golang.org/cl/4291064
2011-03-22 18:41:17 -07:00
Robert Griesemer
76061f7240 go/printer: Revert API change of CL 4274075.
Revert changes to printer.Config. Pass in the
nodeSizes map trough an internal helper function.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4309042
2011-03-22 14:14:26 -07:00
Rob Pike
f492bd7012 gob: fix up ugly formatting introduced by buggy (now fixed) gofmt.
R=rsc
CC=golang-dev
https://golang.org/cl/4281065
2011-03-22 11:52:41 -07:00
Rob Pike
544cf75904 gob: use pointers in bootstrapType so interfaces behave properly
and don't lead to a nil reflect.Type.
Fixes #1626.

R=rsc
CC=golang-dev
https://golang.org/cl/4289062
2011-03-22 11:43:00 -07:00
Robert Griesemer
6684d5503a go/printer, gofmt: simplify struct formatting and respect line breaks
Also: gofmt src misc

Fixes #1627.

R=rsc
CC=golang-dev
https://golang.org/cl/4303042
2011-03-22 11:05:26 -07:00
Robert Griesemer
4a33d440b8 go/printer, gofmt: avoid exponential layout algorithm
Use memoization to avoid repeated recomputation of nested
node sizes. Speeds up testdata/slow.input by several orders
of magnitude.

- added respective test case
- added timeout to test code
- deleted some unrelated unused code

Fixes #1628.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4274075
2011-03-21 17:15:59 -07:00
Brad Fitzpatrick
708013064f cgi: extra failure debugging in host_test
Trying to track down why this fails on some
people's machines.

R=rsc, adg, dsymonds
CC=golang-dev
https://golang.org/cl/4304041
2011-03-21 14:43:38 -07:00
Rob Pike
45aeca4727 time: give a helpful message when we can't set the time zone for testing.
Fixes #1625.

R=bradfitzgo, bradfitzwork, r2
CC=golang-dev
https://golang.org/cl/4295060
2011-03-21 13:48:31 -07:00
Rob Pike
319a8c45ac syscall: rename from .sh to .pl, because these files are in Perl.
Also delete references to nacl.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4275060
2011-03-21 13:02:10 -07:00
Gustavo Niemeyer
2187f43e63 exec: document dir option for Run
R=golang-dev, bradfitzwork, rsc1, peterGo
CC=golang-dev
https://golang.org/cl/4271056
2011-03-21 11:25:00 -03:00
Gustavo Niemeyer
126911dcd2 rpc: increase server_test timeout
These timeouts are breaking tests in very slow
systems every once in a while.  I've noticed
problems when compiling the Ubuntu packages for
arm, specifically.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4291058
2011-03-21 00:07:22 -03:00
Andrew Gerrand
338185dabb path/filepath: fix TestEvalSymlinks when run under symlinked GOROOT
Fixes #1622.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4287063
2011-03-21 11:24:48 +11:00
Fazlul Shahriar
19aecba1d5 flag: document Nflag function
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279065
2011-03-20 11:45:43 -07:00
Ian Lance Taylor
000d60ac6f net: Use preallocated buffer for kqueue/kevent.
R=rsc
CC=golang-dev
https://golang.org/cl/4293056
2011-03-18 12:48:12 -07:00
Rob Pike
3a6c0990a4 rpc: keep free lists of Request and Response structures.
Also in the common case avoid unnecessary buffering in
the channel.
Removes 13 allocations per round trip. Now at 86, down from
144 a week ago.

R=rsc, bradfitzgo, r2, rsc1
CC=golang-dev
https://golang.org/cl/4277060
2011-03-18 11:54:36 -07:00
Ian Lance Taylor
add8c8db60 net: Use preallocated buffer for epoll.
Reduces rpc test "mallocs per rpc round trip" by 4.

Gains ~8% on a localhost client/server RPC test.

R=rsc
CC=golang-dev
https://golang.org/cl/4284056
2011-03-18 11:50:19 -07:00
Alex Brainman
bf91e827ac filepath: do not run TestEvalSymlinks on Windows
R=golang-dev, rsc1
CC=adg, golang-dev
https://golang.org/cl/4274069
2011-03-18 10:19:19 +11:00
Robert Griesemer
39a1465d11 go/parser: fix memory leak by making a copy of token literals
The scanner returns slices into the original source
for token values. If those slices are making it into
the AST and from there into other long-living data
structures (e.g. godoc search), references to the
original source are kept around involuntarily.

For the current godoc and source tree, this change reduces
memory consumption after indexing and before GC by ~92MB
or almost 30%, and by ~10MB after GC (or about 6%).

R=rsc
CC=golang-dev
https://golang.org/cl/4273072
2011-03-17 15:32:29 -07:00
Rob Pike
52b95970ca flag: fix example in doc comment.
Fixes #1615.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4277058
2011-03-17 15:29:52 -07:00
Ian Lance Taylor
42bc7fc8ca net: Don't force epoll/kqueue to wake up in order to add new events.
In conjunction with the non-blocking system call CL, this
gives about an 8% performance improvement on a client/server
test running on my local machine.

R=rsc, iant2
CC=golang-dev
https://golang.org/cl/4272057
2011-03-17 13:42:40 -07:00
Alex Brainman
c0f3b6c8a8 go/scanner: to interpret line comments with Windows filenames
Fixes #1614.

R=gri
CC=golang-dev
https://golang.org/cl/4290054
2011-03-17 11:49:56 -07:00
Caine Tighe
b3166bcb8e os: remove fstat TODO
R=rsc
CC=golang-dev
https://golang.org/cl/3559041
2011-03-17 13:57:36 -04:00
Rob Pike
9ad091e178 gob: eliminate two more allocations in decode.
- just an oversight; we were reallocating a buffer.
- use unsafe to avoid allocating storage for a string twice.

R=rsc
CC=golang-dev
https://golang.org/cl/4290056
2011-03-17 10:47:42 -07:00
Russ Cox
2ca46a789b time: isolate syscall reference in sys.go
R=dsymonds
CC=golang-dev
https://golang.org/cl/4291052
2011-03-17 13:46:05 -04:00
Andrew Gerrand
75d4cb6a02 path/filepath: add EvalSymlinks function
R=rsc, niemeyer, r2, rog, iant2, r
CC=golang-dev
https://golang.org/cl/4235060
2011-03-17 16:36:37 +11:00
Ian Lance Taylor
4fd41e494a syscall: Permit non-blocking syscalls.
Permit system calls to be designated as non-blocking, meaning
that we simply call them without involving the scheduler.

This change by itself is mostly performance neutral.  In
combination with a following change to the net package there
is a performance advantage.

R=rsc, dfc, r2, iant2, rsc1
CC=golang-dev
https://golang.org/cl/4278055
2011-03-16 19:03:01 -07:00
Rob Pike
90f3f91786 gob: remove a few more allocations.
- use enc.err and dec.err instead of return values in deferred error catcher
- replace io.WriteString with buffer.WriteString

now at:
mallocs per encode of type Bench: 7
mallocs per decode of type Bench: 8

R=rsc
CC=golang-dev
https://golang.org/cl/4277057
2011-03-16 18:03:13 -07:00
Yasuhiro Matsumoto
3d1afb7680 path: work for windows.
R=brainman, rsc, rsc1
CC=golang-dev
https://golang.org/cl/4249064
2011-03-17 10:41:23 +11:00
Brad Fitzpatrick
a93f70c21a http: add NewProxyClientConn
This just returns a ClientConn suitable for writing
proxy requests.  To be used in Transport.

R=rsc, petar-m
CC=golang-dev
https://golang.org/cl/4290052
2011-03-16 14:32:35 -07:00
Robert Griesemer
7ea8cdaabd go/ast: merge CaseClause and TypeCaseClause
(per rsc's suggestion)

R=rsc
CC=golang-dev
https://golang.org/cl/4276057
2011-03-16 14:25:59 -07:00
Alex Brainman
de811cc04c go/scanner: use filepath
R=gri
CC=golang-dev
https://golang.org/cl/4280048
2011-03-16 10:38:03 -07:00
Rob Pike
d3c61fc214 testing: fix build
Dependency on bufio crept in during last CL; this breaks the cycle.
Also add a missing '-' to the documentation.

R=rsc
CC=golang-dev
https://golang.org/cl/4274061
2011-03-16 10:12:25 -07:00
Rob Pike
afaa30694c testing: add -test.memprofile and -test.memprofilerate flags.
These allow a test to generate memory profiles automatically.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4273064
2011-03-16 09:53:58 -07:00
Adam Langley
df184ff2f0 crypto/openpgp: add DSA signature support.
R=bradfitzgo, nsz
CC=golang-dev
https://golang.org/cl/4280041
2011-03-16 10:50:06 -04:00
Adam Langley
7b094182e4 crypto/ecdsa: truncate hash values.
There is some disagreement about how to deal with hash values larger
than the curve order size. We choose to follow OpenSSL's lead here.

R=bradfitzgo, r
CC=golang-dev
https://golang.org/cl/4273059
2011-03-16 10:42:41 -04:00
Rob Pike
eb864e92db gob: keep free lists of encoder and decoder states.
Avoids 3 mallocs in a round trip encoding/decoding a struct.

R=rsc, rsc1
CC=golang-dev
https://golang.org/cl/4278052
2011-03-15 21:30:07 -07:00
Robert Griesemer
bcd6c733b2 go/printer: output tuning for gofix
If braces don't have position information for a composite
literal, don't assume alignment of key:value pairs under
the (wrong) assumption that there may be multiple lines.

R=rsc
CC=golang-dev
https://golang.org/cl/4297043
2011-03-15 17:45:16 -07:00
Rob Pike
0463bd6cd7 gob: move benchmarks to a new timing_test.go file.
Add malloc counts for encode and decode.

R=rsc
CC=golang-dev
https://golang.org/cl/4290048
2011-03-15 17:14:02 -07:00
Russ Cox
b04209ca97 debug/proc: fix build
R=r
CC=golang-dev
https://golang.org/cl/4273060
2011-03-15 19:39:50 -04:00
Rob Pike
bc34cda742 rpc: add the ability to write out a memory profile during testing.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4290047
2011-03-15 14:20:30 -07:00
Rob Pike
f11f032486 rpc: add benchmarks
On my mac:
mallocs per rpc round trip: 144
rpc.BenchmarkEndToEnd	   10000	    228244 ns/op

Room for improvement.

R=rsc
CC=golang-dev
https://golang.org/cl/4274058
2011-03-15 13:09:11 -07:00
Roger Peppe
aa55c05213 os, syscall: add ProcAttr type. Change StartProcess etc. to use it.
The Windows code is untested.

R=rsc, gri, brainman, rsc1
CC=golang-dev
https://golang.org/cl/4253052
2011-03-15 14:41:19 -04:00
Russ Cox
a34f1bbb22 gofix: new command for updating code to new release
R=bradfitzgo, dsymonds, r, gri, adg
CC=golang-dev
https://golang.org/cl/4282044
2011-03-15 14:15:41 -04:00
Russ Cox
e72156b316 remove unused labels
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4274052
2011-03-15 14:05:07 -04:00
Brad Fitzpatrick
f192891786 httptest: default the Recorder status code to 200 on a Write
This matches the real ResponseWriter behavior.

R=rsc
CC=golang-dev
https://golang.org/cl/4291048
2011-03-15 10:13:25 -07:00
Brad Fitzpatrick
5245b27ed8 openpgp: add PublicKey KeyId string accessors
R=agl, agl1
CC=golang-dev
https://golang.org/cl/4297041
2011-03-15 10:06:17 -07:00
Rob Pike
a569725141 rpc: add buffering to the encode path.
This reduces the number of writes by 2 (1 client, 1 server) on each round trip.
A simple test shows 24% higher throughput.

R=rsc
CC=golang-dev
https://golang.org/cl/4279057
2011-03-15 10:02:44 -07:00
Dave Cheney
43ae7da190 crypto/tls: fix compile error
Fixes #1555.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4284047
2011-03-12 19:35:41 -08:00
Brad Fitzpatrick
3479bb6c12 ioutil: add NopCloser
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4278044
2011-03-12 16:05:07 -08:00
Brad Fitzpatrick
1c96562f36 http: use Header.Del not empty Set(k, "")
Also don't serialize empty headers.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4275045
2011-03-12 09:58:53 -08:00
Rob Pike
a7528f1b81 runtime/proc.c: which to that
R=iant, dho
CC=golang-dev
https://golang.org/cl/4286044
2011-03-11 18:18:59 -08:00
Ian Lance Taylor
5e963a826c runtime: reduce lock contention via wakeup on scheduler unlock.
R=rsc
CC=golang-dev
https://golang.org/cl/4275043
2011-03-11 18:14:45 -08:00
Ian Lance Taylor
c01238a571 net: don't loop to drain wakeup pipe.
The loop always makes an extra system call.  It only makes a
difference if more than 100 goroutines started waiting for
something to happen on a network file descriptor since the
last time the pipe was drained, which is unlikely since we
will be woken up the first time a goroutine starts waiting.
If we don't drain the pipe this time, we'll be woken up again
right away and can drain again.

R=rsc
CC=golang-dev
https://golang.org/cl/4275042
2011-03-11 18:01:28 -08:00
Rob Pike
5df1cf0475 gob: use bufio on the decode to avoid a system call on each read.
Add a benchmark.
BenchmarkEndToEndPipe gives 14.3microseconds/op before,
13.1microseconds/op after, or about 76e3 round trips per second
through the kernel.
With a bytes buffer, and therefore no system calls for I/O, the
numbers go to 7.3microseconds/op, or about 137e3 round trips
per second.

R=rsc
CC=golang-dev
https://golang.org/cl/4279045
2011-03-11 16:24:09 -08:00
Robert Griesemer
c734b50b11 gotype: clean handling of stdin, added tests
- removed uses of global variables
- minor cleanups

R=r
CC=golang-dev
https://golang.org/cl/4277044
2011-03-11 16:15:33 -08:00
Robert Griesemer
86e35a96a7 go/typechecker: fix build
R=rsc
CC=golang-dev
https://golang.org/cl/4278043
2011-03-11 14:46:36 -08:00
Robert Griesemer
7664ec39b8 go/parser: first constant in a constant declaration must have a value
R=r, rsc1
CC=golang-dev
https://golang.org/cl/4291042
2011-03-11 14:33:31 -08:00
Russ Cox
591c74ad20 runtime: split non-debugging malloc interface out of debug.go into mem.go
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4273045
2011-03-11 15:09:21 -05:00
Russ Cox
3f915f51a8 go code: replace closed(c) with x, ok := <-c
R=golang-dev, rog, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4243072
2011-03-11 14:47:44 -05:00
Russ Cox
8bf34e3356 gc, runtime: replace closed(c) with x, ok := <-c
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/4259064
2011-03-11 14:47:26 -05:00
Brad Fitzpatrick
d3d672998f http: rename interface Transport to RoundTripper
Transport.Do -> RoundTripper.RoundTrip

This makes way for a subsequent CL to export the
currently private RoundTripper implementation
as struct Transport.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4286043
2011-03-11 11:32:33 -08:00