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

1071 Commits

Author SHA1 Message Date
Kei Son
128974adfd bytes, strings: allow -1 in Map to mean "drop this character".
xml: drop invalid characters in attribute names
    when constructing struct field names.

R=rsc
CC=r
https://golang.org/cl/157104
2009-12-11 10:37:48 -08:00
Robert Griesemer
bda2074193 New flags for gofmt:
- oldparser            parse old syntax (required semicolons)
- oldprinter           print old syntax (required semicolons)

By default, these flags are enabled for now.
Setting -oldparser=false has no effect until go/parser is changed
to accept the new syntax.

Enabled exp/parser in Makefile; update dependent exp/eval.

R=rsc
https://golang.org/cl/174051
2009-12-10 19:03:28 -08:00
Robert Griesemer
02d41ec7df rename exp/parser package to oldParser
to allow simultaneous import with the
current go/parser

R=rsc
https://golang.org/cl/174053
2009-12-10 18:27:48 -08:00
Robert Griesemer
57909b54e9 implement NoSemis and NoStringConcat mode for go/printer
R=rsc
https://golang.org/cl/174050
2009-12-10 15:45:57 -08:00
Robert Griesemer
a70caf4463 implemented InsertSemis mode for go/scanner
R=rsc
https://golang.org/cl/175047
2009-12-10 15:31:02 -08:00
Robert Griesemer
2b3813d0e2 - unmodified copy of existing go/parser, not yet hooked up
R=rsc
CC=r
https://golang.org/cl/175045
2009-12-10 14:26:25 -08:00
Kai Backman
d08d33f389 fix calling convention and make memmove restore the g and m
registers.

R=rsc
https://golang.org/cl/166049
2009-12-10 11:42:01 -08:00
Kai Backman
76f7803a2a added SHUT_RD, SHOT_WR and xSHUT_RDWR to fix net compilation error
R=rsc
https://golang.org/cl/165044
2009-12-10 11:40:11 -08:00
Robert Griesemer
2e4334eb3a minor manual format corrections
R=rsc
https://golang.org/cl/172042
2009-12-09 16:54:24 -08:00
Robert Griesemer
295ceb4526 remove uses of string concatenation from src and misc directory
R=rsc
https://golang.org/cl/172041
2009-12-09 16:54:07 -08:00
Roger Peppe
a8ed75d27c added benchmarks to rand_test.go;
removed superfluous field name in lockedSource.

R=r, rsc
https://golang.org/cl/170043
2009-12-09 14:23:43 -08:00
Rob Pike
51f2932082 syscalls can return negative i/o counts. fix bugs in ReadAt and WriteAt not to include
negative counts in return values.

R=rsc
CC=golang-dev
https://golang.org/cl/170044
2009-12-09 14:18:32 -08:00
Roger Peppe
916533119e Make the operations on the global rng thread safe.
R=r, rsc
CC=golang-dev
https://golang.org/cl/168041
2009-12-09 12:55:19 -08:00
Ross Light
8a5b76ce5c json package: Fixed handling of nil values
Fixes #400.

R=golang-dev, rsc
https://golang.org/cl/167058
2009-12-09 10:36:03 -08:00
Adrian O'Grady
6ebfd1eff2 Added XTEA block cipher package to src/pkg/crypto
This is an adaption of the code from http://en.wikipedia.org/wiki/XTEA. The package also implements the block.Cipher
interface so that it can be used with the various block modes.

R=rsc
https://golang.org/cl/157152
2009-12-09 00:06:20 -08:00
Russ Cox
0400a7f8b1 runtime: start new darwin/amd64 threads on correct stack,
then enable stack check.

R=r
https://golang.org/cl/165100
2009-12-08 23:34:45 -08:00
Russ Cox
132c42ff73 bufio: use copy - significant speedup for writers
R=r
https://golang.org/cl/167047
2009-12-08 18:19:48 -08:00
Devon H. O'Dell
5a4a08fab8 Fix stack on FreeBSD / add stack check across the board
FreeBSD was passing stk as the new thread's stack base, while
stk is the top of the stack in go. The added check should cause
a trap if this ever comes up in any new ports, or regresses
in current ones.

R=rsc
CC=golang-dev
https://golang.org/cl/167055
2009-12-08 18:19:30 -08:00
Devon H. O'Dell
cdce7325c8 When SA_SIGINFO is set, we should use __sa_sigaction on FreeBSD
R=rsc
CC=golang-dev
https://golang.org/cl/165097
2009-12-08 18:18:04 -08:00
Russ Cox
0d3301a557 runtime: don't touch pages of memory unnecessarily.
cuts working size for hello world from 6 MB to 1.2 MB.
still some work to be done, but diminishing returns.

R=r
https://golang.org/cl/165080
2009-12-07 15:52:14 -08:00
Russ Cox
33649bd278 runtime: introduce unsafe.New and unsafe.NewArray
to provide functionality previously hacked in to
    reflect and gob.

R=r
https://golang.org/cl/165076
2009-12-07 15:51:58 -08:00
Robert Griesemer
a4a8224152 use a bootstrap array to avoid allocation for short vectors
R=r
https://golang.org/cl/165078
2009-12-07 12:46:20 -08:00
Christopher Wedgwood
8c22dd24e0 Remove copyBytes completely in favor of copy.
R=r, rsc
https://golang.org/cl/165068
2009-12-07 11:31:56 -08:00
Rob Pike
20c1ec263a pick off special one-byte case in copy. worth 2x in benchmarks (38ns->16ns).
the one-item case could be generalized easily with no cost. worth considering.

R=rsc
CC=golang-dev, cw
https://golang.org/cl/167044
2009-12-07 11:28:02 -08:00
Roger Peppe
80e17d6797 the AST walker currently provides no way to find out how the
nodes in the tree are nested with respect to one another.
a simple change to the Visitor interface makes it possible
to do this (for example to maintain a current node-depth, or a
knowledge of the name of the current function).

Visit(nil) is called at the end of a node's children;
this make possible the channel-based interface below,
amongst other possibilities.

It is still just as simple to get the original behaviour - just
return the same Visitor from Visit.

Here are a couple of possible Visitor types.

// closure-based
type FVisitor func(n interface{}) FVisitor
func (f FVisitor) Visit(n interface{}) Visitor {
	return f(n);
}

// channel-based
type CVisitor chan Visit;
type Visit struct {
	node interface{};
	reply chan CVisitor;
};
func (v CVisitor) Visit(n interface{}) Visitor
{
	if n == nil {
		close(v);
	} else {
		reply := make(chan CVisitor);
		v <- Visit{n, reply};
		r := <-reply;
		if r == nil {
			return nil;
		}
		return r;
	}
	return nil;
}

R=gri
CC=rsc
https://golang.org/cl/166047
2009-12-07 10:33:45 -08:00
Rob Pike
f91cd44736 save a few ns by inlining (which mostly simplifies things anyway).
a couple of cleanups.
don't keep big buffers in the free list.

R=rsc
CC=golang-dev
https://golang.org/cl/166078
2009-12-06 15:01:07 -08:00
Rob Pike
353ef80f65 unexport Fmt. it's not needed outside this package any more
cleans up godoc's output for package fmt substantially.

R=rsc
CC=golang-dev
https://golang.org/cl/165070
2009-12-06 12:58:16 -08:00
Rob Pike
4c0e51cd43 Make printing faster by avoiding mallocs and some other advances.
Roughly 33% faster for simple cases, probably more for complex ones.

Before:

mallocs per Sprintf(""): 4
mallocs per Sprintf("xxx"): 6
mallocs per Sprintf("%x"): 10
mallocs per Sprintf("%x %x"): 12

Now:

mallocs per Sprintf(""): 2
mallocs per Sprintf("xxx"): 3
mallocs per Sprintf("%x"): 5
mallocs per Sprintf("%x %x"): 7

Speed improves because of avoiding mallocs and also by sharing a bytes.Buffer
between print.go and format.go rather than copying the data back after each
printed item.

Before:

fmt_test.BenchmarkSprintfEmpty	1000000	      1346 ns/op
fmt_test.BenchmarkSprintfString	500000	      3461 ns/op
fmt_test.BenchmarkSprintfInt	500000	      3671 ns/op

Now:

fmt_test.BenchmarkSprintfEmpty	 2000000	       995 ns/op
fmt_test.BenchmarkSprintfString	 1000000	      2745 ns/op
fmt_test.BenchmarkSprintfInt	 1000000	      2391 ns/op
fmt_test.BenchmarkSprintfIntInt	  500000	      3751 ns/op

I believe there is more to get but this is a good milestone.

R=rsc
CC=golang-dev, hong
https://golang.org/cl/166076
2009-12-06 12:03:52 -08:00
Russ Cox
ed6fd1bcbe runtime: disable pointer scan optimization
* broken by reflect, gob

TBR=r
https://golang.org/cl/166077
2009-12-06 08:18:58 -08:00
Ian Lance Taylor
44c1eb6bed Fix syscall.Statfs and syscall.Fstatfs for 386 GNU/Linux.
For 386 we use the [f]statfs64 system call, which takes three
parameters: the filename, the size of the statfs64 structure,
and a pointer to the structure itself.

R=rsc
https://golang.org/cl/166073
2009-12-04 21:58:32 -08:00
Russ Cox
864c757a1c gc/runtime: pass type structure to makeslice.
* inform garbage collector about memory with no pointers in it

1.9s	gcc reverse-complement.c

reverse-complement.go
4.5s / 3.5s	original, with/without bounds checks
3.5s / 3.3s	bounds check reduction
3.3s / 2.8s	smarter garbage collector
2.6s / 2.3s		assembler bytes.IndexByte
2.5s / 2.1s	even smarter garbage collector (this CL)

R=r
https://golang.org/cl/165064
2009-12-04 21:44:05 -08:00
Russ Cox
2807621d01 net: more fiddling with the udp test.
i don't know why the timeout needs
  to be so big.

R=r
https://golang.org/cl/165063
2009-12-04 18:34:45 -08:00
Ian Lance Taylor
9e0b68d1ee Add syscall.Rename for NaCl. Fixes NaCl build.
R=rsc
https://golang.org/cl/165062
2009-12-04 13:49:58 -08:00
Adam Langley
e79bcf8bfd runtime: shift the index for the sort by one.
Makes the code look cleaner, even if it's a little harder to figure
out from the sort invariants.

R=rsc
CC=golang-dev
https://golang.org/cl/165061
2009-12-04 13:31:18 -08:00
Ian Lance Taylor
0b5cc31693 Add os.Rename.
R=rsc
https://golang.org/cl/166058
2009-12-04 11:46:56 -08:00
Adam Langley
d1740bb3a6 Remove global chanlock.
On a microbenchmark that ping-pongs on lots of channels, this makes
the multithreaded case about 20% faster and the uniprocessor case
about 1% slower. (Due to cache effects, I expect.)

R=rsc, agl
CC=golang-dev
https://golang.org/cl/166043
2009-12-04 10:57:01 -08:00
Russ Cox
d6b3f37e1e bytes: asm for bytes.IndexByte
PERFORMANCE DIFFERENCE

SUMMARY

                                                   amd64           386
2.2 GHz AMD Opteron 8214 HE (Linux)             3.0x faster    8.2x faster
3.60 GHz Intel Xeon (Linux)                     2.2x faster    6.2x faster
2.53 GHz Intel Core2 Duo E7200 (Linux)          1.5x faster    4.4x faster
2.66 Ghz Intel Xeon 5150 (Mac Pro, OS X)        1.5x SLOWER    3.0x faster
2.33 GHz Intel Xeon E5435 (Linux)               1.5x SLOWER    3.0x faster
2.33 GHz Intel Core2 T7600 (MacBook Pro, OS X)  1.4x SLOWER    3.0x faster
1.83 GHz Intel Core2 T5600 (Mac Mini, OS X)        none*       3.0x faster

* but yesterday I consistently saw 1.4x SLOWER.

DETAILS

2.2 GHz AMD Opteron 8214 HE (Linux)

amd64 (3x faster)

IndexByte4K            500000           3733 ns/op     1097.24 MB/s
IndexByte4M               500        4328042 ns/op      969.10 MB/s
IndexByte64M               50       67866160 ns/op      988.84 MB/s

IndexBytePortable4K    200000          11161 ns/op      366.99 MB/s
IndexBytePortable4M       100       11795880 ns/op      355.57 MB/s
IndexBytePortable64M       10      188675000 ns/op      355.68 MB/s

386 (8.2x faster)

IndexByte4K            500000           3734 ns/op     1096.95 MB/s
IndexByte4M               500        4209954 ns/op      996.28 MB/s
IndexByte64M               50       68031980 ns/op      986.43 MB/s

IndexBytePortable4K     50000          30670 ns/op      133.55 MB/s
IndexBytePortable4M        50       31868220 ns/op      131.61 MB/s
IndexBytePortable64M        2      508851500 ns/op      131.88 MB/s

3.60 GHz Intel Xeon (Linux)

amd64 (2.2x faster)

IndexByte4K            500000           4612 ns/op      888.12 MB/s
IndexByte4M               500        4835250 ns/op      867.44 MB/s
IndexByte64M               20       77388450 ns/op      867.17 MB/s

IndexBytePortable4K    200000          10306 ns/op      397.44 MB/s
IndexBytePortable4M       100       11201460 ns/op      374.44 MB/s
IndexBytePortable64M       10      179456800 ns/op      373.96 MB/s

386 (6.3x faster)

IndexByte4K            500000           4631 ns/op      884.47 MB/s
IndexByte4M               500        4846388 ns/op      865.45 MB/s
IndexByte64M               20       78691200 ns/op      852.81 MB/s

IndexBytePortable4K    100000          28989 ns/op      141.29 MB/s
IndexBytePortable4M        50       31183180 ns/op      134.51 MB/s
IndexBytePortable64M        5      498347200 ns/op      134.66 MB/s

2.53 GHz Intel Core2 Duo E7200  (Linux)

amd64 (1.5x faster)

IndexByte4K            500000           6502 ns/op      629.96 MB/s
IndexByte4M               500        6692208 ns/op      626.74 MB/s
IndexByte64M               10      107410400 ns/op      624.79 MB/s

IndexBytePortable4K    200000           9721 ns/op      421.36 MB/s
IndexBytePortable4M       100       10013680 ns/op      418.86 MB/s
IndexBytePortable64M       10      160460800 ns/op      418.23 MB/s

386 (4.4x faster)

IndexByte4K            500000           6505 ns/op      629.67 MB/s
IndexByte4M               500        6694078 ns/op      626.57 MB/s
IndexByte64M               10      107397600 ns/op      624.86 MB/s

IndexBytePortable4K    100000          28835 ns/op      142.05 MB/s
IndexBytePortable4M        50       29562680 ns/op      141.88 MB/s
IndexBytePortable64M        5      473221400 ns/op      141.81 MB/s

2.66 Ghz Intel Xeon 5150  (Mac Pro, OS X)

amd64 (1.5x SLOWER)

IndexByte4K            200000           9290 ns/op      440.90 MB/s
IndexByte4M               200        9568925 ns/op      438.33 MB/s
IndexByte64M               10      154473600 ns/op      434.44 MB/s

IndexBytePortable4K    500000           6202 ns/op      660.43 MB/s
IndexBytePortable4M       500        6583614 ns/op      637.08 MB/s
IndexBytePortable64M       20      107166250 ns/op      626.21 MB/s

386 (3x faster)

IndexByte4K            200000           9301 ns/op      440.38 MB/s
IndexByte4M               200        9568025 ns/op      438.37 MB/s
IndexByte64M               10      154391000 ns/op      434.67 MB/s

IndexBytePortable4K    100000          27526 ns/op      148.80 MB/s
IndexBytePortable4M       100       28302490 ns/op      148.20 MB/s
IndexBytePortable64M        5      454170200 ns/op      147.76 MB/s

2.33 GHz Intel Xeon E5435  (Linux)

amd64 (1.5x SLOWER)

IndexByte4K            200000          10601 ns/op      386.38 MB/s
IndexByte4M               100       10827240 ns/op      387.38 MB/s
IndexByte64M               10      173175500 ns/op      387.52 MB/s

IndexBytePortable4K    500000           7082 ns/op      578.37 MB/s
IndexBytePortable4M       500        7391792 ns/op      567.43 MB/s
IndexBytePortable64M       20      122618550 ns/op      547.30 MB/s

386 (3x faster)

IndexByte4K            200000          11074 ns/op      369.88 MB/s
IndexByte4M               100       10902620 ns/op      384.71 MB/s
IndexByte64M               10      181292800 ns/op      370.17 MB/s

IndexBytePortable4K     50000          31725 ns/op      129.11 MB/s
IndexBytePortable4M        50       32564880 ns/op      128.80 MB/s
IndexBytePortable64M        2      545926000 ns/op      122.93 MB/s

2.33 GHz Intel Core2 T7600 (MacBook Pro, OS X)

amd64 (1.4x SLOWER)

IndexByte4K            200000          11120 ns/op      368.35 MB/s
IndexByte4M               100       11531950 ns/op      363.71 MB/s
IndexByte64M               10      184819000 ns/op      363.11 MB/s

IndexBytePortable4K    500000           7419 ns/op      552.10 MB/s
IndexBytePortable4M       200        8018710 ns/op      523.06 MB/s
IndexBytePortable64M       10      127614900 ns/op      525.87 MB/s

386 (3x faster)

IndexByte4K            200000          11114 ns/op      368.54 MB/s
IndexByte4M               100       11443530 ns/op      366.52 MB/s
IndexByte64M               10      185212000 ns/op      362.34 MB/s

IndexBytePortable4K     50000          32891 ns/op      124.53 MB/s
IndexBytePortable4M        50       33930580 ns/op      123.61 MB/s
IndexBytePortable64M        2      545400500 ns/op      123.05 MB/s

1.83 GHz Intel Core2 T5600  (Mac Mini, OS X)

amd64 (no difference)

IndexByte4K            200000          13497 ns/op      303.47 MB/s
IndexByte4M               100       13890650 ns/op      301.95 MB/s
IndexByte64M                5      222358000 ns/op      301.81 MB/s

IndexBytePortable4K    200000          13584 ns/op      301.53 MB/s
IndexBytePortable4M       100       13913280 ns/op      301.46 MB/s
IndexBytePortable64M       10      222572600 ns/op      301.51 MB/s

386 (3x faster)

IndexByte4K            200000          13565 ns/op      301.95 MB/s
IndexByte4M               100       13882640 ns/op      302.13 MB/s
IndexByte64M                5      221411600 ns/op      303.10 MB/s

IndexBytePortable4K     50000          39978 ns/op      102.46 MB/s
IndexBytePortable4M        50       41038160 ns/op      102.20 MB/s
IndexBytePortable64M        2      656362500 ns/op      102.24 MB/s

R=r
CC=golang-dev
https://golang.org/cl/166055
2009-12-04 10:23:43 -08:00
Russ Cox
609eeee817 make Native Client support build again,
add README explaining how to try the
web demos.

Fixes #339.

R=r
CC=barry.d.silverman, bss, vadim
https://golang.org/cl/165057
2009-12-04 10:11:32 -08:00
Russ Cox
11384eecf8 testing: compute MB/s in benchmarks
R=r
https://golang.org/cl/166060
2009-12-04 09:56:31 -08:00
Rob Pike
4ed57173b4 avoid an allocation inside bytes.Buffer by providing a static array.
R=rsc
https://golang.org/cl/165058
2009-12-04 00:26:08 -08:00
Russ Cox
3b858fb808 net: turn off empty packet test by default
Fixes #374.

R=r
https://golang.org/cl/166053
2009-12-03 22:19:55 -08:00
Michael Elkins
f3d63bea42 Add Count, Cycle, ZipWith, GroupBy, Repeat, RepeatTimes, Unique to exp/iterable.
Modify iterFunc to take chan<- instead of just chan.

R=rsc, dsymonds1
CC=golang-dev, r
https://golang.org/cl/160064
2009-12-03 20:03:07 -08:00
Adam Langley
e93132c982 crypto/rsa: fix shadowing error.
Fixes bug 375.

R=rsc
https://golang.org/cl/165045
2009-12-03 19:33:23 -08:00
Russ Cox
cf37254b1c runtime: fix Caller crash on 386.
Fixes #176.

R=r
https://golang.org/cl/166044
2009-12-03 17:24:14 -08:00
Russ Cox
7e5055ceea runtime: malloc fixes
* throw away dead code
  * add mlookup counter
  * add malloc counter
  * set up for blocks with no pointers

Fixes #367.

R=r
https://golang.org/cl/165050
2009-12-03 17:22:23 -08:00
Rob Pike
10a349a7c1 The String() method requires global state that makes it not work outside of this package,
so make it a local method (_String()).

R=rsc
CC=golang-dev
https://golang.org/cl/165049
2009-12-03 17:14:32 -08:00
Rob Pike
fcc4dd6d64 error propagation in gob/encoder.
R=rsc
CC=golang-dev
https://golang.org/cl/165048
2009-12-03 17:12:57 -08:00
Rob Pike
bc3e34759c Add ReadFrom and WriteTo methods to bytes.Buffer, to enable i/o without buffer allocation.
Use them in Copy and Copyn.
Speed up ReadFile by using ReadFrom and avoiding Copy altogether (a minor win).

R=rsc, gri
CC=golang-dev
https://golang.org/cl/166041
2009-12-03 12:56:16 -08:00
Robert Griesemer
6db683fe4d - include type-associated consts and vars when filtering a PackageDoc
- fixes a godoc issue (for instance, "godoc os EOF" now shows an entry)

R=r
CC=rsc
https://golang.org/cl/165042
2009-12-03 11:25:20 -08:00
Rob Pike
d984f98996 minor improvement to formatting: don't allocate padding strings every time.
R=rsc
https://golang.org/cl/164090
2009-12-03 00:04:40 -08:00
Rob Pike
b0683bd77a move ReadFile, WriteFile, and ReadDir into a separate io/ioutil package.
this breaks the dependency of package io on package bytes.

R=rsc
CC=golang-dev
https://golang.org/cl/163085
2009-12-02 22:02:14 -08:00
Peter Froehlich
1eba218e44 Runes: turn string into []int
Split: fixed typo in documentation

R=rsc, r, r1
https://golang.org/cl/157170
2009-12-02 20:47:38 -08:00
Robert Griesemer
dc7355a974 Add flag -tabindent to gofmt: forces use of
tabs for indentation even if -spaces is set.

Changes to gofmt:
- added -tabindent flag
- don't recompute parser and printer mode repeatedly

Changes to go/printer:
- provide new printing mode TabIndent

Changes to tabwriter:
- implement new mode TabIndent to use tabs independent
  of the actual padding character for leading empty columns
- distinguish between minimal cell width and tab width
  (tabwidth is only used if the output contains tabs,
  minwidth and padding are always considered)
- fixed and added more comments
- some additional factoring

By default, -tabindent is disabled and the default gofmt
behavior is unchanged. By setting -spaces and -tabindent,
gofmt will use tabs for indentation but do any other
alignment with spaces. This permits a user to change the
visible indentation by simply changing the editor's tab
width and the code will remain properly aligned without
the need to rerun gofmt.

R=rsc
https://golang.org/cl/163068
2009-12-02 16:57:15 -08:00
Russ Cox
e89441ba8f net: test and fix support for 0-length datagram packets.
Fixes #274.

R=r
CC=jonathan.r.hudson
https://golang.org/cl/163072
2009-12-02 15:17:49 -08:00
Robert Griesemer
d8bc797ed5 apply gofmt to json files
R=rsc
https://golang.org/cl/164071
2009-12-02 11:40:54 -08:00
Rob Pike
114f73f822 fix segfault printing errors. add test case and improve messages.
Fixes #338.

R=rsc
CC=golang-dev
https://golang.org/cl/163083
2009-12-02 10:41:28 -08:00
Rob Pike
f6c0eba741 test that arrays work properly.
can't mix slices and arrays now; perhaps that should be a TODO

R=rsc
https://golang.org/cl/164079
2009-12-02 10:25:14 -08:00
Russ Cox
9e55d0d018 time: another bug in SecondsToUTC.
added random test to look for more.

Fixes #363.

R=r, cw
https://golang.org/cl/163071
2009-12-02 08:27:57 -08:00
Ian Lance Taylor
952b91e4ad Add Shutdown to 32-bit GNU/Linux build.
Submitting as a TBR to fix the build.

R=dho, rsc
https://golang.org/cl/164078
2009-12-02 08:24:14 -08:00
Russ Cox
8d652ee8ce time: fix handling of Jan 1 1601, 1201, 801, ...
R=r
CC=hurtonm
https://golang.org/cl/164074
2009-12-01 23:38:06 -08:00
Devon H. O'Dell
eb16346dac net: fix netFD.Close races
Fixes #271.
Fixes #321.

R=rsc, agl, cw
CC=golang-dev
https://golang.org/cl/163052
2009-12-01 23:28:57 -08:00
Rob Pike
ff3ea68e52 explicitly catch attempt to decode into a value - must be a pointer to see the result.
R=rsc
https://golang.org/cl/163070
2009-12-01 21:47:00 -08:00
Rob Pike
f9810f1b12 make io.ReadFile use Stat.Size as a hint for preallocation
R=rsc
CC=golang-dev
https://golang.org/cl/163069
2009-12-01 21:44:24 -08:00
Devon H. O'Dell
49ebcfbb83 Add syscall.Shutdown to FreeBSD i386/amd64
Necessary for 163052

R=rsc
CC=golang-dev
https://golang.org/cl/164068
2009-12-01 21:43:39 -08:00
Russ Cox
0b126c1be4 syscall: add Shutdown on OS X, add more constants in mkerror.sh
R=dho
CC=golang-dev
https://golang.org/cl/163061
2009-12-01 16:53:43 -08:00
Rob Pike
ceb1fe2863 update package unicode to Unicode 5.2
R=rsc
CC=golang-dev
https://golang.org/cl/163062
2009-12-01 16:22:21 -08:00
Russ Cox
2a54997baa gob: fix build
TBR=r
https://golang.org/cl/163064
2009-12-01 16:18:27 -08:00
Christopher Wedgwood
4f6dbc6901 Explicitly return values where it's shadowing the parameter.
Bad returns noticed by "Devon H. O'Dell" <devon.odell@gmail.com>.

Resolves Issue 360.

R=rsc, dho, agl, agl1
CC=ukai
https://golang.org/cl/163055
2009-12-01 15:54:49 -08:00
Rob Pike
a0f742d343 more gob bugs
1) need to send slice and array types (was only sending element types)
2) compatibleType needs to use decoder's type map

R=rsc
CC=golang-dev
https://golang.org/cl/164062
2009-12-01 15:31:28 -08:00
Tor Andersson
598f3e284e A first stab at porting the XCB X11 protocol bindings to go.
The python script needs a checkout of xcb/proto to generate
an xproto.go file, which together with xgb.go provide functions
to access all of the core X11 protocol requests. I have included the
generated file.

Extensions and authentication methods are not implemented.

R=r, rsc, nigeltao_golang
https://golang.org/cl/162053
2009-11-30 14:25:50 -08:00
Sergey 'SnakE' Gromov
9d50b468a1 json: Decode into native Go data structures
This patch adds an ability to convert JSON-encoded data into
a hierarchy of Go's native data types.

R=rsc
CC=golang-dev
https://golang.org/cl/161060
2009-11-30 13:55:09 -08:00
Robert Griesemer
c1767dbdda Typo in comment.
Fixes #358.

R=rsc
CC=r
https://golang.org/cl/164043
2009-11-30 12:50:02 -08:00
Péter Szabó
12206f64dd sync.RWMutex: rewritten to add support for concurrent readers.
Also made sync.xadd public to help testing sync.RWMutex.

Also added unit tests for sync.RWMutex.

R=rsc
https://golang.org/cl/162044
2009-11-30 12:10:56 -08:00
Jonathan Wills
229807c8c3 Added a method on UDPConn so they can actually send broadcast packets.
R=rsc
https://golang.org/cl/162046
2009-11-30 12:03:55 -08:00
Christopher Wedgwood
a85c258e67 a[b:len(a)] -> a[b:]
R=r, rsc
CC=agl1
https://golang.org/cl/161070
2009-11-30 12:03:43 -08:00
Andrew Skiba
68d3b6e51a Handle \r as a whitespace when parsing JSON string.
Fixes #272.

R=rsc
https://golang.org/cl/161061
2009-11-30 12:03:26 -08:00
Christopher Wedgwood
c78710f53e Add trivial whitespace to CorruptInputError strings.
R=r, rsc
https://golang.org/cl/161058
2009-11-30 12:03:10 -08:00
Christopher Wedgwood
f0c9719540 Minimise bitrot: bytes.Copy -> copy
(compile tested only)

R=r, rsc
https://golang.org/cl/161069
2009-11-30 11:57:21 -08:00
Russ Cox
ed62d27a52 template: two bug fixes / nits
* diagnose template not created with New
    (current code just crashes)
  * write []byte uninterpreted
    (current code writes fmt format: "[65 65 65 65]")

R=r
CC=golang-dev
https://golang.org/cl/161075
2009-11-30 10:29:14 -08:00
Russ Cox
be98bc488e websocket: avoid $GOROOT in case it has spaces
Fixes #115.

R=r, ukai, sergio
https://golang.org/cl/162057
2009-11-29 20:30:02 -08:00
Sergio Luis O. B. Correia
46892656c7 crypto/md4, exp/draw/x11: fix makefile to build when GOROOT has whitespaces
this is the exact same thing issue #115 is about. fix makefiles to use relative
path to work in the case we have whitespaces as part of GOROOT.

R=rsc
https://golang.org/cl/162055
2009-11-29 18:14:49 -08:00
Fumitoshi Ukai
f9f0184e13 Add WebSocket server framework hooked into http.
R=r, rsc
https://golang.org/cl/156071
2009-11-29 14:22:44 -08:00
Robert Griesemer
f3e0f214f8 Correct expression level for argument lists.
Fixes #352.

R=rsc
https://golang.org/cl/161073
2009-11-29 14:11:52 -08:00
Rob Pike
b5358e0630 a few utf8 benchmarks. on my mac:
utf8_test.BenchmarkRuneCountTenASCIIChars	20000000	       108 ns/op
utf8_test.BenchmarkRuneCountTenJapaneseChars	10000000	       199 ns/op
utf8_test.BenchmarkEncodeASCIIRune	500000000	         6 ns/op
utf8_test.BenchmarkEncodeJapaneseRune	100000000	        10 ns/op
utf8_test.BenchmarkDecodeASCIIRune	100000000	        13 ns/op
utf8_test.BenchmarkDecodeJapaneseRune	100000000	        21 ns/op

R=gri
CC=golang-dev
https://golang.org/cl/161049
2009-11-25 13:30:30 -08:00
Rob Pike
773e77981d rewrite RuneCountInString to use range.
R=gri
CC=golang-dev
https://golang.org/cl/160069
2009-11-25 11:39:34 -08:00
Nigel Tao
f65427a8be Initial exp/draw/x11 implementation.
This provides an experimental X11 backend for the exp/draw interface.
It does not aim to provide a complete implementation of the X11 client protocol.

This works for me (Ubuntu Hardy 8.04, GOARCH=386). Your mileage my vary.

R=r, rsc, r1
CC=golang-dev
https://golang.org/cl/156109
2009-11-25 18:31:34 +11:00
Rob Pike
a0c55432f3 fix weird all.bash failures by running deps.bash before make clean runs in pkg directory.
before this change, if pkg/Make.deps is missing or broken, clean.bash fails and the build dies
but not until much later.

add freebsd to error message about valid values of $GOOS

TODO: would be nice if this process exited when an error occurred. subshells make it hard

R=rsc
CC=golang-dev
https://golang.org/cl/160065
2009-11-24 21:07:05 -08:00
Robert Griesemer
28f1914023 Handle presence of illegal semicolon after package clause better.
R=r, r1
https://golang.org/cl/157167
2009-11-24 17:34:08 -08:00
Robert Griesemer
a38ec58df0 Replace sort.Sort call with heapify algorithm in Init.
Fixed package comment.
Renamed some variables for symmetry, added more internal comments and more tests.
Fixes #304.

R=rsc
https://golang.org/cl/157166
2009-11-24 17:20:13 -08:00
Ken Thompson
bd80b5a835 test case for large angles in trig functions
R=rsc
https://golang.org/cl/157160
2009-11-24 15:42:46 -08:00
Ken Thompson
b2bc1db9ac bad sin/cos for large angles.
fixes #326.

R=rsc
https://golang.org/cl/160059
2009-11-24 15:01:44 -08:00
Robert Griesemer
c6f8df0827 fix for broken build (built-in new was invisible due to a parameter called 'new')
R=iant
https://golang.org/cl/160057
2009-11-24 14:11:53 -08:00
Robert Griesemer
001a8b11ff Change to container/vector interface:
- removed New(len int) in favor of new(Vector).Resize(len, cap)
- removed Init(len int) in favor of Resize(len, cap)
- runs all.bash

Fixes #294.

R=rsc, r, r1
https://golang.org/cl/157143
2009-11-24 13:43:18 -08:00
Michael Hoisie
9da8d88499 A quick fix to ensure that json.Marshal returns errors correctly, as well as some error-related tests
R=rsc
https://golang.org/cl/157151
2009-11-24 13:18:44 -08:00
Russ Cox
5f484ec118 http: redirect to correct URL
R=r, r1
https://golang.org/cl/157154
2009-11-24 11:47:53 -08:00
Michael Elkins
b320cf5bf4 add Take, TakeWhile, Drop, DropWhile to exp/iterable
R=dsymonds1, rsc
https://golang.org/cl/156079
2009-11-24 11:31:11 -08:00
Rob Pike
c14e265c59 print error's string when panicking.
R=rsc
https://golang.org/cl/157156
2009-11-24 10:55:50 -08:00
Trevor Strohman
f586870ec2 Add benchmarks for commonly used routines.
R=rsc, r, r1
https://golang.org/cl/160046
2009-11-24 00:21:50 -08:00
Russ Cox
c95c27a91f json: expose map in generic representation
R=r, r1
https://golang.org/cl/157146
2009-11-23 18:11:00 -08:00
Chris Lennert
8ebd7f7167 Provides implementation of MD4 hashing algorithm.
See IETF RFC 1320, http://tools.ietf.org/html/rfc1320.
Fixes #279.

R=rsc
https://golang.org/cl/159051
2009-11-23 17:44:44 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
edf7485a6e gofmt -r: documentation and minor fixes
fix a few paren insertion bugs in the printer too.

R=gri, r
CC=golang-dev
https://golang.org/cl/157119
2009-11-23 15:44:27 -08:00
Vish Subramanian
9e95d970cc Fix crash in xml.Unmarshal. Occasionally while running a scrape of some xml with many goroutines
I see a crash with the following stack trace:

	SIGSEGV: segmentation violation
	Faulting address: 0x44
	PC=0x44e510

	runtime·mapaccess2+0x18 /home/vish/go/src/pkg/runtime/hashmap.c:790
       	 runtime·mapaccess2(0x0, 0x0)
	xml·*Parser·text+0x922 /home/vish/go/src/pkg/xml/xml.go:765
       	 xml·*Parser·text(0xe44c9870, 0x7fa3, 0xffffffff, 0x7f00, 0x44b5c4, ...)
	xml·*Parser·RawToken+0x174 /home/vish/go/src/pkg/xml/xml.go:405
         xml·*Parser·RawToken(0xe44c9870, 0x7fa3, 0x0, 0x0)
	xml·*Parser·Token+0x625 /home/vish/go/src/pkg/xml/xml.go:205
       	 xml·*Parser·Token(0xe44c9870, 0x7fa3, 0x0, 0x0, 0x0, ...)
	xml·*Parser·Skip+0x27 /home/vish/go/src/pkg/xml/read.go:371
       	 xml·*Parser·Skip(0xe44c9870, 0x7fa3, 0x8, 0x0)
	xml·*Parser·unmarshal+0xae6 /home/vish/go/src/pkg/xml/read.go:328
       	 xml·*Parser·unmarshal(0xe44c9870, 0x7fa3, 0xe8127120, 0x7fa3, 0xdc94bc40, ...)
	xml·Unmarshal+0xda /home/vish/go/src/pkg/xml/read.go:121
       	 xml·Unmarshal(0xe65724b0, 0x7fa3, 0xdc94bc00, 0x7fa3, 0x4bcfc0, ...)
	scraper·DoSearch+0x3d1 /home/vish/my-go-src/google3/experimental/users/vish/go_http/scraper.go:95
       	 scraper·DoSearch(0xe7dc28c0, 0x7fa3, 0x33, 0x3, 0x6d2510, ...)
	main·scrapeQueries+0x202 /home/vish/my-go-src/google3/experimental/users/vish/go_http/scrape.go:251
       	 main·scrapeQueries(0xe7da2600, 0x7fa3, 0x64, 0x1db0, 0xe7e10000, ...)
	goexit /home/vish/go/src/pkg/runtime/proc.c:135
       	 goexit()
	0x7fa3e7da2600 unknown pc

	Clearly xml.Parser is accessing an uninitialized map. Add a check for a nil map before accessing it.

R=r, rsc
https://golang.org/cl/159050
2009-11-23 14:26:30 -08:00
Russ Cox
b90f673290 io.ReadWriter: fix doc comment (ReadWrite -> ReadWriter)
R=r
CC=eds
https://golang.org/cl/160045
2009-11-23 14:22:56 -08:00
Rob Pike
3b7f552fbb fix bug in prefix code: must stop one character before any potential match of an empty string
Fixes #308.

R=rsc
CC=golang-dev
https://golang.org/cl/157142
2009-11-23 14:06:21 -08:00
Rob Pike
b050a1b223 Fix doc striing for NewReadLogger.
Fixes #315.

R=rsc
https://golang.org/cl/157140
2009-11-23 13:51:10 -08:00
Adam Langley
6e0842db8b crypto/tls: add initial client implementation.
R=rsc, agl
CC=golang-dev
https://golang.org/cl/157076
2009-11-21 15:53:03 -08:00
Russ Cox
28e392d4bd gofmt: add -r flag to rewrite source code according to pattern
a little slow, but usable (speed unchanged when not using -r)

tweak go/printer to handle nodes without line numbers
more gracefully in a couple cases.

R=gri
https://golang.org/cl/156103
2009-11-20 15:09:54 -08:00
William Josephson
1444f1bb1d Missed a reference to sc instead of mc in 157065.
R=rsc, dho
https://golang.org/cl/157116
2009-11-20 13:46:47 -08:00
Devon H. O'Dell
7ada6018a7 FreeBSD's mcontext isn't exactly the same as sigcontext, so
we can't use them interchangably.

R=rsc, wjosephson
CC=golang-dev
https://golang.org/cl/156113
2009-11-20 13:08:16 -08:00
Robert Griesemer
7763345379 Support for basic try-catch style exception handling.
Meant as illustration of the Go pattern that is using
goroutines and channels to handle exceptional situations.

Note: There is no need for "Finally" since the
"try block" (the function f supplied to Try)
cannot do a Smalltalk-style non-local return
and terminate the function surrounding Try.

Replaces CL 157083.

R=r, rsc
https://golang.org/cl/157087
2009-11-20 11:50:11 -08:00
Russ Cox
9ac4449cb2 gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri
CC=golang-dev
https://golang.org/cl/156115
2009-11-20 11:45:05 -08:00
Russ Cox
aa4c638b7b x[y:] for strings
R=ken2
https://golang.org/cl/157114
2009-11-20 11:42:28 -08:00
Rob Pike
3e8bb54c2f fix build
R=rsc
https://golang.org/cl/159044
2009-11-20 11:26:40 -08:00
Rob Pike
d324a851c4 slight simplification made possible by the code now processing match states
in order of discovery.

R=rsc
https://golang.org/cl/157112
2009-11-20 11:16:57 -08:00
Rob Pike
542e5b8ade add unimplemented %+ and % (space) flags to floating-point print.
fix %E: was same as %e.
add tests.

Fixes #278.

R=rsc
CC=golang-dev
https://golang.org/cl/157111
2009-11-20 11:04:51 -08:00
Russ Cox
652f55672d x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
  * remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
  * port cgen_inline into 8g, 5g.
  * use native memmove in maps

R=ken2
https://golang.org/cl/157106
2009-11-20 09:11:46 -08:00
Rob Pike
c62069cc1f add a match arena to regexp to avoid generating garbage.
simple regexps run 20x faster.
the regex-dna benchmark goes 3x faster.

R=rsc
CC=golang-dev
https://golang.org/cl/156108
2009-11-19 23:12:01 -08:00
Russ Cox
6e0767bb04 reflect fixes
R=r
https://golang.org/cl/156104
2009-11-19 22:06:32 -08:00
James Meneghello
bfbb31595b Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.

-Psuedocode-

mp map[string]string = {
	"header" : "A fantastic header!",
	"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)

...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:

type s struct {
	mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)

...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.

Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.

Fixes #259.

R=r, rsc
https://golang.org/cl/157088
2009-11-19 21:08:05 -08:00
Michael Hoisie
ce88bfa585 Add json.Marshal to json package
R=rsc
CC=golang-dev
https://golang.org/cl/157068
2009-11-19 20:45:03 -08:00
Evan Shaw
4db3a166b2 archive/tar: Make Reader and Writer more closely follow io.Reader and io.Writer interfaces
There's no functional change here. io gives the Read and Write methods byte slice arguments, but tar called them uint8. It's the same thing, but I think this is clearer and it matches what other packages do.

R=rsc
CC=golang-dev
https://golang.org/cl/157099
2009-11-19 20:43:30 -08:00
Russ Cox
ec30932124 big: fix arm build - forgot how to spell JMP
Fixes #269.

TBR=kaib
https://golang.org/cl/156107
2009-11-19 20:32:09 -08:00
Rob Pike
a6e1ad2733 two easy optimizations for regexp:
1) if char class contains a single character, make it a single character.
		(this is used to quote, e.g. [.] rather than \.
	2) if regexp begins with ordinary text substring, use plain string match to start engine

R=rsc
CC=golang-dev
https://golang.org/cl/157095
2009-11-19 16:45:50 -08:00
Robert Griesemer
b48f71213a Permit omission of hi bound in slices.
R=r, rsc
https://golang.org/cl/157082
2009-11-19 16:42:05 -08:00
Trevor Strohman
61660adc63 Adds benchmark support to gotest.
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line.  This change includes
sample benchmarks for regexp.

% gotest --benchmarks=.*
(standard test output redacted)
testing.BenchmarkSimpleMatch	200000	      7799 ns/op
testing.BenchmarkUngroupedMatch	20000	     76898 ns/op
testing.BenchmarkGroupedMatch	50000	     38148 ns/op

R=r, rsc
https://golang.org/cl/154173
2009-11-19 16:35:34 -08:00
Russ Cox
69039e5a5a build Make.deps during make.bash instead
of keeping a checked-in copy.  doesn't
slow down make.bash appreciably.

R=r
https://golang.org/cl/156099
2009-11-19 16:27:13 -08:00
Rob Pike
4e201c7f20 os.ReadAt doesn't return EOF at EOF.
thanks to lionkov for the fix.

Fixes #262.

R=rsc
CC=golang-dev
https://golang.org/cl/156097
2009-11-19 11:51:23 -08:00
Russ Cox
4aaf948f90 runtime: mask signals during signal handler on OS X
Fixes #265.

R=r
CC=golang-dev
https://golang.org/cl/157084
2009-11-19 11:01:16 -08:00
Rob Pike
02df7db868 replace custom findByte with bytes.IndexByte
R=rsc
https://golang.org/cl/156093
2009-11-18 19:58:32 -08:00
Adam Langley
bf1f63a273 big: fix large division.
I missed a case.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/156092
2009-11-18 19:26:12 -08:00
Rob Pike
8c1a627e5c add bytes.IndexByte; common case we can make fast later.
also pick off the special case in strings.Index.   don't want strings.IndexByte
because the call site will very rarely need to allocate and we can handle the
test in the code itself.   bytes.IndexByte can avoid a common allocation.

R=rsc
CC=golang-dev
https://golang.org/cl/156091
2009-11-18 19:23:08 -08:00
Russ Cox
e1c5c3df77 runtime: fix bug on darwin/amd64 - bad g in bsdthread_start
R=r
https://golang.org/cl/157077
2009-11-18 18:17:11 -08:00
Devon H. O'Dell
60b1a17b9e More FreeBSD-touchups. Thundercats are GOOOOO!
R=rsc
CC=golang-dev
https://golang.org/cl/157074
2009-11-18 16:51:59 -08:00
Adam Langley
eac41e7eba crypto/x509: RawContents -> RawContent
TBR=rsc

R=rsc
https://golang.org/cl/157075
2009-11-18 16:38:30 -08:00
Adam Langley
3ab331ed29 asn1: add support for RawContent
R=rsc
CC=golang-dev
https://golang.org/cl/157056
2009-11-18 16:32:44 -08:00
Adam Langley
cc56fc3860 crypto/x509: add certificate support.
R=rsc
CC=golang-dev
https://golang.org/cl/156054
2009-11-18 16:08:24 -08:00
Rob Pike
e70cedfaec remove bytes.Copy
replace all calls with calls to copy
use copy in regexp and bytes.Buffer

R=rsc
CC=golang-dev
https://golang.org/cl/157073
2009-11-18 15:24:24 -08:00
Rob Pike
093493c6a5 bugs in memmove:
- has arguments (no stack split)
	- MOVL does not set condition

R=ken2, rsc
https://golang.org/cl/156086
2009-11-18 15:00:02 -08:00
Adam Langley
ef8f483c60 net: remove race condition on Close.
Previously a netFd could be queued for reading/writing in the channel,
but close(2)'ed before pollServer got to it. In this case, the kernel
would consider the descriptor closed and the attempt to add it to the
epoll set would fail and panic.

This patch makes Close a roundtrip to the pollServer, although the
actual close(2) still occurs elsewhere to avoid blocking the
pollServer.

Fixes #143.

R=rsc
CC=golang-dev
https://golang.org/cl/152130
2009-11-18 13:18:34 -08:00
Russ Cox
a274099340 big: implement 386 assembly routines
7x speedup on big and crypto/rsa unit tests.
also dropped useAsm in favor of making the
asm stubs jump to the Go versions.

R=agl1
CC=golang-dev, gri
https://golang.org/cl/157062
2009-11-18 09:54:51 -08:00
William Josephson
4c0f262a2d Remove unnecessary execute bits.
R=rsc
https://golang.org/cl/156077
2009-11-18 09:19:29 -08:00
Devon H. O'Dell
659780b643 Add an intptr type to runtime; needed in FreeBSD
In thread.c, we need to cast to whatever the native
size of intptr is on the system, but we only have
uintptr available. They're the same size, but can't
do signed casts without this one :).

R=rsc
CC=golang-dev
https://golang.org/cl/156073
2009-11-18 09:11:39 -08:00
Devon H. O'Dell
b3f538a4fd FreeBSD/i386 work
This patchset gets Go to pretty much the same state that
FreeBSD/amd64 is in.

R=rsc
https://golang.org/cl/157055
2009-11-17 23:58:51 -08:00
Russ Cox
744d5ae48a runtime: add ARM memmove
R=ken2
https://golang.org/cl/156063
2009-11-17 22:54:20 -08:00
Russ Cox
ed0beea27b copy tweaks
* move memmove to arch-specific subdirectories
  * add memmove for arm
  * add copyright notices marking them as copied from Inferno

R=ken2
https://golang.org/cl/156061
2009-11-17 22:16:55 -08:00
Rob Pike
ea5cc6c021 add a test for %+v in nested structures.
threw in an embedded one for good measure.

R=rsc
CC=golang-dev
https://golang.org/cl/157058
2009-11-17 22:14:34 -08:00
Russ Cox
41554e2528 runtime: two trivial but important bug fixes
R=r
https://golang.org/cl/156059
2009-11-17 22:00:30 -08:00
Ken Thompson
948f3e77e1 bug in copy
R=rsc
https://golang.org/cl/156056
2009-11-17 20:44:35 -08:00
Ken Thompson
c4606d05da install copy predefined
did not test 386, but should work
shouldnt matter if copy is not used

R=rsc
https://golang.org/cl/156055
2009-11-17 20:41:44 -08:00
Adam Langley
a8ba40823c crypto/rsa: add PKCS#1 v1.5 signature support.
R=rsc
CC=golang-dev
https://golang.org/cl/156051
2009-11-17 18:21:47 -08:00
Adam Langley
80b7f6a8d4 asn1:
* add Marshal
  * add BitString.RightAlign
  * change to using a *time.Time (from time.Time) since that's what
    the time package uses.
  * return the unparsed data from Unmarshal.

R=rsc
CC=golang-dev
https://golang.org/cl/156047
2009-11-17 18:09:41 -08:00
Russ Cox
1dbd3c8d3d reflect: document that PkgPath and Name return
empty string for unnamed types.

Fixes #249.

R=r
https://golang.org/cl/156052
2009-11-17 16:03:14 -08:00
Russ Cox
849e6f99b8 http: do not crash accessing r.Form if ParseForm fails
Fixes #233.

R=dsymonds1
https://golang.org/cl/154179
2009-11-17 14:45:10 -08:00
Russ Cox
4dfd7fdde5 runtime: do not create new threads during malloc.
the signal handling stack is a different size than
	the normal stack, so it cannot be allocated using
	the backup stack allocator.

Fixes #250.

R=agl1
CC=golang-dev
https://golang.org/cl/157044
2009-11-17 14:42:08 -08:00
Rob Pike
6240b0110a improve documentation of runtime. there was no mention of types.
R=rsc
CC=golang-dev
https://golang.org/cl/157042
2009-11-17 11:44:15 -08:00
Aron Nopanen
c51ee432d1 Make non-errored RPC calls return 'nil' error to caller.
Error information is carried from RPC server to client in the string
'Error' field of rpc.Response. An empty string is sent in the success
case. This empty string was being returned to the caller (of Client.Call
or Client.Go), resulting in a non-nil error response.

This change detects an empty-string Response.Error at the client, and
translates it into a nil value in Call.Error.

Tests updated to check error return in success cases.

R=r, rsc
https://golang.org/cl/154159
2009-11-17 11:29:02 -08:00
Russ Cox
b4586a7429 math: fix argument names in Atan2
(error introduced converting from arg1, arg2)

Fixes #220.

R=r
https://golang.org/cl/156041
2009-11-17 08:39:56 -08:00
Russ Cox
6e788e0f0f net: enforce timeouts for ReadFrom/WriteTo
Fixes #153.

R=r
https://golang.org/cl/154177
2009-11-17 08:39:17 -08:00
Russ Cox
a65bf95dd8 syscall: use correct pointer in recvfrom/sendto.
linux/386 stack trace: use 32-bit hex.

Fixes #159.

R=r
https://golang.org/cl/154178
2009-11-17 08:39:04 -08:00
Devon H. O'Dell
0489a260da FreeBSD-specific porting work.
cgo/libmach remain unimplemented. However, compilers, runtime,
and packages are 100%. I still need to go through and implement
missing syscalls (at least make sure they're all listed), but
for all shipped functionality, this is done. Ship! ;)

R=rsc, VenkateshSrinivas
https://golang.org/cl/152142
2009-11-17 08:20:58 -08:00
Rob Pike
30b1b9a36a Rework gobs to fix bad bug related to sharing of id's between encoder and decoder side.
Fix is to move all decoder state into the decoder object.

Fixes #215.

R=rsc
CC=golang-dev
https://golang.org/cl/155077
2009-11-16 23:32:30 -08:00
Rob Pike
50c04132ac fix bug causing empty strings to be become non-nil errors on client side of rpc connection.
R=rsc
CC=golang-dev
https://golang.org/cl/155078
2009-11-16 23:32:16 -08:00
Russ Cox
597b2a91a6 runtime: make signal handler work on 386
R=r
https://golang.org/cl/154171
2009-11-16 17:51:47 -08:00
Adam Langley
1cdfe9fa28 unsafe: documentation typo.
Fixes #236.

R=r
CC=golang-dev
https://golang.org/cl/155072
2009-11-16 15:39:04 -08:00
David Symonds
affcfe5a75 Add some primitive type aliases to exp/iterable and define Iter on them.
R=rsc
https://golang.org/cl/155065
2009-11-16 13:39:59 -08:00
David G. Andersen
37f71e8ad6 An asked-for-in #go-nuts extension to quickly create a repeated
copy of a string or a byte array.
        strings.Repeat("-", 50)
	bytes.Repeat(b, 99)

R=rsc
https://golang.org/cl/155063
2009-11-16 12:40:01 -08:00
Adam Langley
391e082ca9 crypto/md5: fix comment typo.
Fixes #210.

R=rsc
CC=golang-dev
https://golang.org/cl/155057
2009-11-15 14:00:46 -08:00
Russ Cox
091191336a runtime: avoid crash in Caller
Fixes #176.

R=r
https://golang.org/cl/154146
2009-11-15 12:57:15 -08:00
Russ Cox
a338231526 gc: five bug fixes, one better error.
* check for struct literal assignment to private fields.
* record, fix crash involving parallel map assignment.
* avoid infinite recursion in exportassignok.
* make floating point bounds check precise.
* avoid crash on invalid receiver.

* add context to error about implicit assignment.

Fixes #86.
Fixes #88.
Fixes #158.
Fixes #174.
Fixes #201.
Fixes #204.

R=ken2
https://golang.org/cl/154144
2009-11-15 12:57:09 -08:00
Russ Cox
a967f57d19 http.URLEscape: escape all bytes required by RFC 2396
Fixes #125.

R=r
https://golang.org/cl/154143
2009-11-15 12:56:50 -08:00
Rob Pike
27779dd6cb fix bug in bytes.Map and add test cases for Map in both strings and bytes packages.
thanks to ulrik.sverdrup for the test case.

Fixes #191.

R=rsc
CC=golang-dev
https://golang.org/cl/155056
2009-11-15 12:07:27 -08:00
Adam Langley
ad05d29103 crypto/rsa: handle the case of non-coprime blinds.
We are dealing with the multiplicative group ℤ/pqℤ. Multiples of
either p or q are not members of the group since they cannot have an
inverse. (Such numbers are 0 in the subgroup ℤ/pℤ.)

With p and q of typical size (> 512 bits), the probability of a random
blind [1..pq-1] being a multiple of p or q is negligible. However, in
the unit tests, much smaller sizes are used and the event could occur.

This change checks the result of the ext GCD and deals with this case.

It also increases the size of p and q in the unit test as a large
number of the keys selected were p, q = 227,169.

R=rsc
CC=golang-dev
https://golang.org/cl/154141
2009-11-14 20:38:00 -08:00
Devon H. O'Dell
553be8427e Build changes to support work on the BSDs.
This does still contain some FreeBSD-specific bits, but
it's a pain to do partial diffs.

R=rsc
https://golang.org/cl/152138
2009-11-14 15:29:09 -08:00
Môshe van der Sterre
a54684f8da encoding/binary: implemented the Write function
The ByteOrder.Put* methods are already available, this change uses
them to implement the Write function.

R=golang-dev, agl1, rsc, r
https://golang.org/cl/152141
2009-11-14 14:42:22 -08:00
Rob Pike
0263103a05 move evaluation of null-matching instructions one iteration earlier.
performance hit of about 20% but more intuitive results for submatches.
we need a good regexp package at some point.

Fixes #110.

R=rsc
CC=golang-dev
https://golang.org/cl/152131
2009-11-14 12:23:24 -08:00
Abhinav Gupta
bad9738be6 xml: Fixed CDATA parsing.
Fixes #128.

R=r, rsc
https://golang.org/cl/154126
2009-11-14 11:46:09 -08:00
Russ Cox
933d1850ce typos
Fixes #171.
Fixes #172.

R=agl1
https://golang.org/cl/154136
2009-11-14 10:28:53 -08:00
David Titarenco
aebae2577a Created new Conn.Flush() public method so the fd pipeline can be drained arbitrarily by the user.
Commented both flush methods so people know what they are looking at.

This is a necessary fix for streaming and long polling HTTP services.
Fixes #93.

R=r, rsc, david.titarenco
https://golang.org/cl/154099
2009-11-13 18:06:47 -08:00
Nigel Tao
75829b3c51 Remove unnecessary int(h) casts in image.go.
R=rsc
https://golang.org/cl/154125
2009-11-13 17:40:20 -08:00
Adam Langley
a070722340 json: minor comment fix.
I screwed up and didn't write one of the code review changes to disk
before submitting.

TBR=rsc

R=rsc
https://golang.org/cl/154122
2009-11-13 14:59:04 -08:00
Rob Pike
f9919ba323 Explain why
-flag true
does not work although
	-flag=true
does.

Fixes #139.

R=iant
CC=golang-dev
https://golang.org/cl/154118
2009-11-13 13:15:18 -08:00
Adam Langley
bccc337084 json: allow one to unmarshal a top-level JSON array.
Fixies issue 114.

R=rsc
CC=golang-dev
https://golang.org/cl/154121
2009-11-13 13:00:45 -08:00
Russ Cox
e7b8f5faca path.TestWalk: disable error case if root
(chmod 0 doesn't cause errors for root)

Fixes #22.

R=gri
https://golang.org/cl/152120
2009-11-13 11:34:33 -08:00
Adam Langley
87bc9b53fd json: fix addressing of slice indexes that are multiples of 8.
Fixes #147.

R=rsc
CC=golang-dev
https://golang.org/cl/152123
2009-11-13 11:29:13 -08:00
Adam Langley
3f7a32405d runtime: warn about SELinux based mmap failures on Linux.
SELinux will cause mmap to fail when we request w+x memory unless the
user has configured their policies. We have a warning in make.bash,
but it's quite likely that the policy will be reset at some point and
then all their binaries start failing.

This patch prints a warning on Linux when mmap fails with EACCES.

R=rsc
CC=golang-dev
https://golang.org/cl/152086
2009-11-13 10:08:51 -08:00
Rob Pike
845276ae68 remove dead code from test
R=rsc
CC=golang-dev
https://golang.org/cl/152118
2009-11-12 23:35:45 -08:00
Kai Backman
a23746ea65 fix style nit ignored in previous cl
R=rsc
https://golang.org/cl/152110
2009-11-12 16:12:28 -08:00
Kai Backman
6a48aab747 add support for pre arm v6 cas. set GOARM=5 to enable.
R=rsc
https://golang.org/cl/154101
2009-11-12 15:23:23 -08:00
Russ Cox
b0c7d68052 os.TestSeek: use a smaller but still 64-bit seek offset.
Might fix issue 91.

R=r
https://golang.org/cl/152108
2009-11-12 14:55:04 -08:00
Adam Langley
454c621d91 exp/draw: correct Makefile.
Thanks to Allister Macleod

Fixes #112.

R=rsc
CC=golang-dev
https://golang.org/cl/152102
2009-11-12 13:55:20 -08:00
Kai Backman
6dbd142951 add cache flushing call after generating closure.
go/test: passes 88% (306/347)

R=rsc
https://golang.org/cl/152089
2009-11-11 23:23:11 -08:00
David Symonds
9e829c42d6 Fix capitalisation of "Git".
R=rsc
https://golang.org/cl/154071
2009-11-11 17:31:28 -08:00
Robert Griesemer
23843fa49e vector: s/Element/interface{}/
Fixes #74.

R=rsc
https://golang.org/cl/154073
2009-11-11 17:25:51 -08:00
Adam Langley
3b092fec36 json: support \u escaping in strings
Fixes #73.

R=rsc
CC=golang-dev
https://golang.org/cl/154072
2009-11-11 17:13:14 -08:00
Russ Cox
2cda46dc82 fix TestRemoveAll again (tested as root this time).
Fixes #22.

R=r
https://golang.org/cl/154069
2009-11-11 15:48:38 -08:00
Russ Cox
f07a9e43e8 os test: do not use symlink > 255 bytes.
Fixes #62.

R=r
https://golang.org/cl/152080
2009-11-11 14:52:29 -08:00
Adam Langley
1941855730 Reland a112249da741, this time with missing file. 2009-11-11 13:21:37 -08:00
Russ Cox
8515a9f4e2 log test: don't assume a fixed set of letters for $GOROOT
Fixes #27.

R=r
https://golang.org/cl/152075
2009-11-11 13:07:46 -08:00
Russ Cox
ed86d0e70a roll back 3985: build is broken
TBR=agl1
CC=golang-dev
https://golang.org/cl/154065
2009-11-11 12:54:52 -08:00