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

6699 Commits

Author SHA1 Message Date
Rob Pike
7bc8e90e36 exp/template: lexical scanner for new template package.
An unusual design using slice and a goroutine makes for a
compact scanner with very little allocation.

R=rsc, r
CC=golang-dev, kevlar
https://golang.org/cl/4610041
2011-06-13 16:08:35 +10:00
Alex Brainman
9ded954a3b net: rearrange source files so we could run more tests on windows
R=rsc
CC=golang-dev
https://golang.org/cl/4603043
2011-06-13 10:22:31 +10:00
Alex Brainman
27cbf06d50 mime/multipart: allow for temp files to be removed after tests are finished on Windows
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4605044
2011-06-11 16:23:44 +10:00
Yasuhiro Matsumoto
1374097381 net: Sendfile for win32.
implement using TransmitFile().

R=bsiegert, bradfitz, alex.brainman, rsc, go.peter.90
CC=golang-dev
https://golang.org/cl/4536076
2011-06-11 13:24:48 +10:00
Robert Griesemer
968afa0e8c go/scanner: partially revert CL4538096 now that we have %#U for runes
R=r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4572049
2011-06-10 17:19:01 -07:00
Robert Griesemer
c8ee1b8ebc io/ioutil: fix typo in comment
R=r, r
CC=golang-dev
https://golang.org/cl/4592052
2011-06-10 17:07:22 -07:00
Rob Pike
d152fe74e1 fmt: debugging formats for characters: %+q %#U
%+q uses strconv.Quote[Rune]ToASCII, guaranteeing ASCII-only output.
%#U a quoted character if the rune is printable: 'x'=U+0078; otherwise
it's as before: U+000A.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4589047
2011-06-11 00:03:02 +00:00
Rob Pike
4b1170d2b1 sort: change IntArray etc. to IntSlice for better name hygiene.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4602054
2011-06-11 09:25:18 +10:00
Adam Langley
531c01d990 crypto/openpgp: build fix (unreviewed)
R=agl
CC=golang-dev
https://golang.org/cl/4572057
2011-06-10 13:32:20 -04:00
Adam Langley
f0d21a773f crypto/openpgp: add ability to encrypt messages.
R=bradfitz, r
CC=golang-dev
https://golang.org/cl/4581051
2011-06-10 12:58:14 -04:00
David Symonds
b5071e92b4 bike/shed: new package.
It comes up often enough that it's time to provide
the utility of a standard package.

R=r, mirtchovski, adg, rsc, n13m3y3r, ality, go.peter.90, lstoakes, iant, jan.mercl, bsiegert, robert.hencke, rogpeppe, befelemepeseveze, kevlar
CC=golang-dev
https://golang.org/cl/4557047
2011-06-10 22:32:45 +10:00
Yuval Pavel Zholkover
0924185840 runtime: fix Plan 9 "lingering goroutines bug".
R=rsc, r
CC=golang-dev
https://golang.org/cl/4589042
2011-06-10 17:23:54 +10:00
Nigel Tao
c0c824cd7b image: add Paletted.Set, and a basic test of the concrete image types.
R=r
CC=golang-dev
https://golang.org/cl/4589045
2011-06-10 14:07:29 +10:00
Andrew Gerrand
d44c4c351d sync/atomic: fix arm check64 bug
R=r, rsc
CC=golang-dev
https://golang.org/cl/4571059
2011-06-10 13:50:19 +10:00
Dave Cheney
86183e43c9 gopack: make unused page function a fatal error
R=iant, rsc
CC=golang-dev
https://golang.org/cl/4601051
2011-06-09 22:41:19 -04:00
Brad Fitzpatrick
5e8b9c614b http: fix regression permitting io.Copy on HEAD response
With the ReadFrom change in the sendfile CL, it became
possible to illegally send a response to a HEAD request if you
did it via io.Copy.

Fixes #1939

R=rsc
CC=golang-dev
https://golang.org/cl/4584049
2011-06-09 18:10:21 -07:00
Dave Cheney
aac6afbb11 gopack: remove warning from the use of mktemp
gcc-4.6 considers mktemp to be racey

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/4602050
2011-06-09 18:04:26 -07:00
David Symonds
63639dd237 mail: decode RFC 2047-encoded words, not phrases.
R=rsc, r, bradfitz
CC=golang-dev
https://golang.org/cl/4590047
2011-06-10 08:47:27 +10:00
Russ Cox
1fddbab736 5l: fix softfloat nits
Need to load math.a so that sqrtGoC is available.
Also was missing prototype.

R=ken2
CC=golang-dev
https://golang.org/cl/4517148
2011-06-09 18:38:25 -04:00
Russ Cox
900c5fa98e gc: compactframe breaks arm - fix build
R=lvd
CC=golang-dev
https://golang.org/cl/4591063
2011-06-09 18:28:27 -04:00
Luuk van Dijk
fd2e24727e gc: nit
R=rsc
CC=golang-dev
https://golang.org/cl/4604041
2011-06-10 00:08:57 +02:00
Russ Cox
3e57d7f7bf 5l: delete dead code
Thumb code and ARM pre-V4 code is unused,
unmaintained, and almost certainly wrong by now.
Every time I try to change 5l I have to sort out
what's dead code and what's not.

30% of lines of code in this directory deleted.

R=ken2
CC=golang-dev
https://golang.org/cl/4601049
2011-06-09 18:07:56 -04:00
Luuk van Dijk
2ac375b2df gc: compact stackframe
After allocparams and walk, remove unused auto variables
and re-layout the remaining in reverse alignment order.

R=rsc
CC=golang-dev
https://golang.org/cl/4568068
2011-06-10 00:02:34 +02:00
Fan Hongjian
fc41e621e8 math: add sqrt_arm.s and sqrtGoC.go as fallback to soft fp emulation
5a: add SQRTF and SQRTD
5l: add ASQRTF and ASQRTD

Use ARMv7 VFP VSQRT instruction to speed up math.Sqrt

R=rsc, dave, m
CC=golang-dev
https://golang.org/cl/4551082
2011-06-09 17:19:08 -04:00
Quan Yong Zhai
439694125f runtime: improve memmove
check memory overlap

R=rsc, r, ken, edsrzf
CC=golang-dev
https://golang.org/cl/4602047
2011-06-09 16:49:47 -04:00
Russ Cox
17ca32e9db gc: nits
R=ken2
CC=golang-dev
https://golang.org/cl/4572052
2011-06-09 11:44:28 -04:00
Alex Brainman
c3be760889 runtime: increase maximum number of windows callbacks
Fixes #1912.

R=rsc
CC=golang-dev
https://golang.org/cl/4591047
2011-06-09 10:29:25 +10:00
David Symonds
ffd01f2a47 mail: decode "Q"-encoded mail addresses.
Supports ISO-8859-1 and UTF-8.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4568064
2011-06-09 10:18:36 +10:00
Nigel Tao
833529fd6f compress/lzw: reduce decoder buffer size from 3*4096 to 2*4096.
This happens to speed up the decoder benchmarks by 50% on my computer
(GOARCH=amd64 GOOS=linux), but I don't have a good intuition as to why.
For example, just adding an unused [4096]byte field to the decoder
struct doesn't significantly change the numbers.

Before:

lzw.BenchmarkDecoder1e4	    5000	    488057 ns/op	  20.49 MB/s
lzw.BenchmarkDecoder1e5	     500	   4613638 ns/op	  21.67 MB/s
lzw.BenchmarkDecoder1e6	      50	  45672260 ns/op	  21.90 MB/s
lzw.BenchmarkEncoder1e4	    5000	    353563 ns/op	  28.28 MB/s
lzw.BenchmarkEncoder1e5	     500	   3431618 ns/op	  29.14 MB/s
lzw.BenchmarkEncoder1e6	      50	  34009640 ns/op	  29.40 MB/s

After:

lzw.BenchmarkDecoder1e4	    5000	    339725 ns/op	  29.44 MB/s
lzw.BenchmarkDecoder1e5	     500	   3166894 ns/op	  31.58 MB/s
lzw.BenchmarkDecoder1e6	      50	  31317260 ns/op	  31.93 MB/s
lzw.BenchmarkEncoder1e4	    5000	    354909 ns/op	  28.18 MB/s
lzw.BenchmarkEncoder1e5	     500	   3432710 ns/op	  29.13 MB/s
lzw.BenchmarkEncoder1e6	      50	  34010500 ns/op	  29.40 MB/s

R=rsc, r
CC=golang-dev
https://golang.org/cl/4535123
2011-06-09 09:50:38 +10:00
Brad Fitzpatrick
9c436ab7dc http: fix handling of 0-lengthed http requests
Via Russ Ross' bug report on golang-nuts, it was not possible
to send an HTTP request with a zero length body with either a
Content-Length (it was stripped) or chunking (it wasn't set).

This means Go couldn't upload 0-length objects to Amazon S3.
(which aren't as silly as they might sound, as S3 objects can
have key/values associated with them, set in the headers)

Amazon further doesn't supported chunked uploads. (not Go's
problem, but we should be able to let users set an explicit
Content-Length, even if it's zero.)

To fix the ambiguity of an explicit zero Content-Length and
the Request struct's default zero value, users need to
explicit set TransferEncoding to []string{"identity"} to force
the Request.Write to include a Content-Length: 0.  identity is
in RFC 2616 but is ignored pretty much everywhere.  We don't
even then serialize it on the wire, since it's kinda useless,
except as an internal sentinel value.

The "identity" value is then documented, but most users can
ignore that because NewRequest now sets that.

And adds more tests.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4603041
2011-06-08 15:59:23 -07:00
Brad Fitzpatrick
6a876283c8 http: change most map[string][]string types to new Values type
This replaces most the map[string][]string usage with
a new Values type name, with the usual methods.

It also changes client.PostForm to take a Values, rather
than a map[string]string, closing a TODO in the code.

R=rsc
CC=golang-dev
https://golang.org/cl/4532123
2011-06-08 13:38:20 -07:00
Robert Griesemer
013cfea362 gofmt: update test script so that it passes again
(TODO: should replace this with a Go program, eventually)

R=bradfitz
CC=golang-dev
https://golang.org/cl/4584047
2011-06-08 12:05:40 -07:00
Robert Griesemer
2de06655f1 big: removed some gratuitous +/-1's
R=mtj, bradfitz
CC=golang-dev
https://golang.org/cl/4584046
2011-06-08 11:24:24 -07:00
Robert Griesemer
a609a6bb63 ebnf: follow EBNF for EBNF faithfully
Apply analogous changes in godoc/spec.go.

Fixes #1829.

R=nmessenger, r
CC=golang-dev
https://golang.org/cl/4528127
2011-06-08 09:10:30 -07:00
Robert Griesemer
21032ebebd big: gobs for big rats
Fixes #1926.

R=r
CC=golang-dev
https://golang.org/cl/4550122
2011-06-08 09:10:01 -07:00
Yuval Pavel Zholkover
6c746328f7 os: fix Getenv for Plan 9. Truncate the rightmost char if it is '\0'.
R=mirtchovski, ality, taruti, rsc
CC=golang-dev
https://golang.org/cl/4386046
2011-06-08 09:44:03 -04:00
Jonathan Mark
ddde52ae56 runtime: SysMap uses MAP_FIXED if needed on 64-bit Linux
This change was adapted from gccgo's libgo/runtime/mem.c at
Ian Taylor's suggestion.  It fixes all.bash failing with
"address space conflict: map() =" on amd64 Linux with kernel
version 2.6.32.8-grsec-2.1.14-modsign-xeon-64.
With this change, SysMap will use MAP_FIXED to allocate its desired
address space, after first calling mincore to check that there is
nothing else mapped there.

R=iant, dave, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/4438091
2011-06-07 21:50:10 -07:00
David Symonds
5c32c96f5c mail: format addresseses correctly.
Also remove an obsolete TODO while I'm here.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4588041
2011-06-08 13:32:47 +10:00
Dave Cheney
6998ea2982 gc: alternative clang compatible abort.
Tested on clang 2.9/amd64

R=rsc, jeff, r
CC=golang-dev
https://golang.org/cl/4517143
2011-06-08 10:46:15 +10:00
Michael T. Jones
d5c45c541d big.nat: Improved speed of nat-to-string conversion
Three optimizations: First, special-case power of two bases
that partion a Word(), bases 2, 4, 16, and 256. These can
be moved directly from internal Word() storage to the output
without multiprecision operations. Next, same approach for
the other power-of-two bases, 8, 32, 64, and 128. These
don't fill a Word() evenly, so special handling is needed
for those cases where input spans the high-bits of one Word
and the low bis of the next one.  Finally, implement the
general case for others bases in 2 <= base <= 256 using
superbases, the largest power of base representable in a
Word(). For base ten, this is 9 digits and a superbase of
10^9 for 32-bit Words and 19 digits and 10^19 for 64-bit
compiles. This way we do just 1/9th or 1/19th of the expensive
multiprecision divisions, unpacking superdigits using fast
native machine arithmetic. The resulting code runs 7x to
800x the speed of the previous approach, depending on the
length of the number to be converted--longer is relatively
faster.

Also, extended the tests and benchmarks for string to nat
(scan()) and nat to string (string()) functions. A further
enhancement awaits the next CL to make general cases about
7x faster for long cases.

R=gri
CC=golang-dev
https://golang.org/cl/4595041
2011-06-07 16:02:34 -07:00
Brad Fitzpatrick
29e4775cd5 exec: export the underlying *os.Process in Cmd
R=rsc
CC=golang-dev
https://golang.org/cl/4579044
2011-06-07 13:17:34 -07:00
Mikio Hara
a8fd374187 net: fix bug in net.Interfaces: handle elastic sdl_data size correctly
Fixes #1921.

R=golang-dev, jeff
CC=golang-dev
https://golang.org/cl/4535120
2011-06-07 16:06:36 -04:00
Brad Fitzpatrick
be48115f48 gofix: fix diff regression from exec change
Also pass -u to diff to be consistent with gofmt.

Fixes #1619

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4591041
2011-06-07 11:53:47 -07:00
Russ Cox
63dae3c3be compress/lzw: do not use background goroutines
Programs expect that Read and Write are synchronous.
The background goroutines make the implementation
a little easier, but they introduce asynchrony that
trips up calling code.  Remove them.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/4548080
2011-06-07 14:37:06 -04:00
Robert Hencke
8cd7aac223 godefs: do not assume forward type references are enums
Fixes #1466.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/4564043
2011-06-07 14:28:10 -04:00
Anthony Martin
c5030e5f4b ld: fix and simplify ELF symbol generation
I started looking at this code because the nm in GNU
binutils was ignoring the first symbol in the .symtab
section.  Apparently, the System V ABI reserves the
first entry and requires all fields inside to be set
to zero.

The list of changes is as follows:

  · reserve the first symbol entry (as noted above)
  · fix the section indices for .data and .bss symbols
  · factor out common code for Elf32 and Elf64
  · remove the special case for elfsymo in [568]l/asm.c:/^asmb
  · add the "etext" symbol in 6l
  · add static symbols

R=rsc
CC=golang-dev
https://golang.org/cl/4524075
2011-06-07 14:26:16 -04:00
Caine Tighe
7c19d88b0f gc/lex.c: fix formatting of #include statement
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4564048
2011-06-07 09:57:26 -07:00
Brad Fitzpatrick
687102ed4f gofmt: fix -d regression from exec change
Fixes #1916

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4590041
2011-06-07 09:38:04 -07:00
Rob Pike
f2f3b8fa99 strconv: change Quote to be Unicode-friendly,
add QuoteToASCII.
The Quote and QuoteRune functions now let printable
runes (as defined by unicode.IsPrint) through.  When
true 7-bit clean stuff is necessary, there are now two
new functions: QuoteToASCII and QuoteRuneToASCII.

Printf("%q") uses Quote. To get the old behavior, it
will now be necessary to say
        Printf("%s", strconv.QuoteToASCII(s))
but that should rarely be necessary.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/4561061
2011-06-07 12:23:08 +00:00
Rob Pike
05348ab0c8 image/gif: fix buglet in graphics extension.
need to ReadFull, not Read, to get extension data.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4576043
2011-06-07 12:19:36 +00:00
Dave Cheney
4881e7744a cgo: support non intel gcc machine flags
R=adg
CC=golang-dev
https://golang.org/cl/4528124
2011-06-07 16:59:35 +10:00
Brad Fitzpatrick
5e03143c1a html: improve attribute parsing, note package status
Fixes #1890

R=nigeltao
CC=golang-dev
https://golang.org/cl/4528102
2011-06-06 15:56:15 -07:00
Rob Pike
9e857dbdcc template: rearrange the code into separate files.
The single file was getting unwieldy.
Also remove use of vector; a slice works fine - although
it's an unusual one.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/4576042
2011-06-06 21:33:02 +00:00
Graham Miller
f35a3df80c big: Rat always outputs the requested precision from FloatString
Fixes #1922.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4551098
2011-06-06 12:59:58 -07:00
Adam Langley
c281ddf1eb crypto: reorg, cleanup and add function for generating CRLs.
This change moves a number of common PKIX structures into
crypto/x509/pkix, from where x509, and ocsp can reference
them, saving duplication. It also removes x509/crl and merges it into
x509 and x509/pkix.

x509 is changed to take advantage of the big.Int support that now
exists in asn1. Because of this, the public/private key pair in
http/httptest/server.go had to be updated because it was serialised
with an old version of the code that didn't zero pad ASN.1 INTEGERs.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4532115
2011-06-06 10:35:46 -04:00
Dave Cheney
60a4b5e4db gc: enable building under clang/2.9
To build under clang, pass the path to clang in CC when
calling ./make.bash

CC=/opt/llvm/llvm-2.9/bin/clang ./make.bash

Credit goes to jmhodges for suggestions.

R=jeff, r, ality
CC=golang-dev
https://golang.org/cl/4527098
2011-06-06 19:53:44 +10:00
Evan Shaw
94b974a22d os: add Process.Kill and Process.Signal
R=alex.brainman, r, rsc, krasin, iant, rsc, r
CC=golang-dev
https://golang.org/cl/4437091
2011-06-06 19:53:30 +10:00
Jeffrey M Hodges
7dd47326e5 libmach: use the standardized format for designated initializers.
The brace style in these files are a little inconsistent so I rolled with
it on a per-file basis.

R=dave, r
CC=golang-dev
https://golang.org/cl/4515194
2011-06-06 06:56:09 +00:00
David Jakob Fritz
ce877acf31 netchan: added drain method to importer.
Fixes #1868.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4550093
2011-06-06 06:55:32 +00:00
David Symonds
ff0198b72f mail: address list parsing.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4547084
2011-06-06 16:46:14 +10:00
Andrew Gerrand
a028a02395 crypto/twofish: fix Reset index overflow bug.
Fixes #1919.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4530110
2011-06-06 14:30:48 +10:00
Benny Siegert
d01b260e78 image/tiff: support for bit depths other than 8.
At the moment, 16-bit samples are reduced to 8 bits, this will
be changed in a separate CL.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4552057
2011-06-06 14:11:29 +10:00
Alex Brainman
4c2123e534 go/build: fix windows build by commenting out references to stdout and stderr in cgotest
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/4561062
2011-06-06 10:11:41 +10:00
Andrew Gerrand
eb72403bb6 go/build: exclude cgo test from arm
go/build: include command output in error values
go/build: add syslist.go to .hgignore

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4550118
2011-06-06 09:25:30 +10:00
Nigel Tao
b47a38dedb image/draw: move exp/draw to image/draw and exp/gui.
R=r
CC=golang-dev
https://golang.org/cl/4515191
2011-06-05 14:27:38 +10:00
Andrew Gerrand
c2cea4418a go/build: new package for building go programs
R=rsc
CC=golang-dev
https://golang.org/cl/4433047
2011-06-04 12:45:09 +10:00
Rob Pike
7a92287a48 unicode: for consistency with MaxRune, s/Latin1Max/MaxLatin1/ and
s/ASCIIMax/MaxASCII/

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/4539109
2011-06-04 09:28:27 +10:00
Rob Pike
8d64e73f94 unicode: add the first few property tests for printing.
The long-term goal is that %q will use IsPrint to decide
what to show natively vs. as hexadecimal.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4526095
2011-06-04 07:46:22 +10:00
Robert Griesemer
86b3577a59 ebnf: update comment
(pointed out by jan.mercl@nic.cz)

R=iant, jan.mercl, rsc
CC=golang-dev
https://golang.org/cl/4515189
2011-06-03 13:02:35 -07:00
Brad Fitzpatrick
2655757900 http: don't fail on accept hitting EMFILE
Fixes #1891

R=rsc
CC=golang-dev
https://golang.org/cl/4550112
2011-06-03 12:23:50 -07:00
Mikio Hara
0015e8eb5e net: fix windows build
R=rsc
CC=golang-dev
https://golang.org/cl/4539108
2011-06-03 15:16:05 -04:00
Mikio Hara
518331dfea net: add network interface identification API
This CL introduces new API into package net to identify the network
interface.  A functionality of new API is very similar to RFC3493 -
"Interface Identification".

R=r, gri, bradfitz, robert.hencke, fullung, rsc
CC=golang-dev
https://golang.org/cl/4437087
2011-06-03 14:35:42 -04:00
Russ Cox
84f291b1bd 8g: compute register liveness during regopt
Input code like

0000 (x.go:2) TEXT    main+0(SB),$36-0
0001 (x.go:3) MOVL    $5,i+-8(SP)
0002 (x.go:3) MOVL    $0,i+-4(SP)
0003 (x.go:4) MOVL    $1,BX
0004 (x.go:4) MOVL    i+-8(SP),AX
0005 (x.go:4) MOVL    i+-4(SP),DX
0006 (x.go:4) MOVL    AX,autotmp_0000+-20(SP)
0007 (x.go:4) MOVL    DX,autotmp_0000+-16(SP)
0008 (x.go:4) MOVL    autotmp_0000+-20(SP),CX
0009 (x.go:4) CMPL    autotmp_0000+-16(SP),$0
0010 (x.go:4) JNE     ,13
0011 (x.go:4) CMPL    CX,$32
0012 (x.go:4) JCS     ,14
0013 (x.go:4) MOVL    $0,BX
0014 (x.go:4) SHLL    CX,BX
0015 (x.go:4) MOVL    BX,x+-12(SP)
0016 (x.go:5) MOVL    x+-12(SP),AX
0017 (x.go:5) CDQ     ,
0018 (x.go:5) MOVL    AX,autotmp_0001+-28(SP)
0019 (x.go:5) MOVL    DX,autotmp_0001+-24(SP)
0020 (x.go:5) MOVL    autotmp_0001+-28(SP),AX
0021 (x.go:5) MOVL    autotmp_0001+-24(SP),DX
0022 (x.go:5) MOVL    AX,(SP)
0023 (x.go:5) MOVL    DX,4(SP)
0024 (x.go:5) CALL    ,runtime.printint+0(SB)
0025 (x.go:5) CALL    ,runtime.printnl+0(SB)
0026 (x.go:6) RET     ,

is problematic because the liveness range for
autotmp_0000 (0006-0009) is nested completely
inside a span where BX holds a live value (0003-0015).
Because the register allocator only looks at 0006-0009
to see which registers are used, it misses the fact that
BX is unavailable and uses it anyway.

The n->pun = anyregalloc() check in tempname is
a workaround for this bug, but I hit it again because
I did the tempname call before allocating BX, even
though I then used the temporary after storing in BX.
This should fix the real bug, and then we can remove
the workaround in tempname.

The code creates pseudo-variables for each register
and includes that information in the liveness propagation.
Then the regu fields can be populated using that more
complete information.  With that approach, BX is marked
as in use on every line in the whole span 0003-0015,
so that the decision about autotmp_0000
(using only 0006-0009) still has all the information
it needs.

This is not specific to the 386, but it only happens in
generated code of the form

        load R1
        ...
        load var into R2
        ...
        store R2 back into var
        ...
        use R1

and for the most part the other compilers generate
the loads for a given compiled line before any of
the stores.  Even so, this may not be the case everywhere,
so the change is worth making in all three.

R=ken2, ken, ken
CC=golang-dev
https://golang.org/cl/4529106
2011-06-03 14:10:39 -04:00
Dmitriy Vyukov
79b397b27e testing: check that tests and benchmarks do not affect GOMAXPROCS
Plus fix spoiling of GOMAXPROCS in 2 existing rwmutex tests.
Plus fix benchmark output to stdout (now it outputs to stderr like all other output).

R=rsc
CC=golang-dev
https://golang.org/cl/4529111
2011-06-03 13:50:44 -04:00
Lucio De Re
9baaa6f742 8l, ld: Initial adjustments for Plan 9 native compilation of 8l
These changes are not particularly invasive and have been tested
as broadly as possible.

8l/l.h:
  -	#pragma varargck: added some, removed duplicates.

ld/dwarf.c:
  -	As Plan 9 has no NULL, changed all occurrences to nil.
  -	Added USED(size); where necessary.
  -	Added (void) argument in definition of finddebugruntimepath().
  -	Plan 9 compiler was complaining about multiple
        assignments, repeaired by breaking up the commands.
  -	Correction: havedynamic = 1; restored.

ld/go.c:
  -	Needed USED(file); in two functions.
  -	Removed unused assignments flagged by the Plan 9 compiler.

ld/lib.c:
  -	Replaced unlink() with remove() which seems available everywhere.
  -	Removed USED(c4); and USED(magic) no longer required.
  -	Removed code flagged as unused by the Plan 9 compiler.
  -	Added attributes to a number of format strings.

R=rsc
CC=golang-dev
https://golang.org/cl/4435047
2011-06-03 13:20:31 -04:00
Luuk van Dijk
ab8ed7f8dd gc: renamed walkdef to typecheckdef and moved from walk to typedef.
also inlined a typechecking function in dcl away.

R=rsc
CC=golang-dev
https://golang.org/cl/4550115
2011-06-03 17:44:02 +02:00
Nigel Tao
f531ef3279 image: rename Contains and ContainsRectangle to In.
R=r
CC=golang-dev
https://golang.org/cl/4539104
2011-06-03 13:18:15 +10:00
Luuk van Dijk
56668283f1 gc: allow tags on parameters in export section of object files.
This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.

tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.

R=rsc
CC=golang-dev
https://golang.org/cl/4524092
2011-06-03 03:54:56 +02:00
Nigel Tao
ae5a972d9e exp/draw: fix clipping bug where sp/mp were not shifted when r.Min was.
image: add Rectangle.ContainsRectangle method.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4517130
2011-06-03 11:43:54 +10:00
Rob Pike
ce5c1cf036 fmt: fix bug in UnreadRune: must clear memory of previous
rune if input implements UnreadRune; otherwise the lookahead
will lie.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4548082
2011-06-03 07:53:50 +10:00
Rob Pike
4e9e925002 exec: change exec.PathError to exec.Error
There were two issues:
1) It might not be a path error, it might be 'permission denied'.
2) The concept of $PATH is Unix-specific.

R=alex.brainman, rsc, r, mattn.jp
CC=golang-dev
https://golang.org/cl/4530096
2011-06-03 07:48:06 +10:00
Brad Fitzpatrick
31c79c4eff http: ServeFile shouldn't send Content-Length when Content-Encoding is set
Fixes #1905

R=rsc
CC=golang-dev
https://golang.org/cl/4538111
2011-06-02 13:36:52 -07:00
Robert Griesemer
5bf57c1b41 big: remove some unnecessary conversions
R=rsc
CC=golang-dev
https://golang.org/cl/4529110
2011-06-02 12:58:26 -07:00
Brad Fitzpatrick
2a8ea0d1b5 http: catch panics
R=rsc
CC=golang-dev
https://golang.org/cl/4559067
2011-06-02 12:00:26 -07:00
Robert Griesemer
191a6bfc5e big: do not modify divisor
Fixes #1907.

R=rsc
CC=golang-dev
https://golang.org/cl/4527096
2011-06-02 11:07:41 -07:00
Brad Fitzpatrick
4d15577783 exec: add Cmd methods StdinPipe, StdoutPipe, StderrPipe
It gets annoying to do this in caller code otherwise,
especially having to remember to Close one side.

R=rsc
CC=golang-dev
https://golang.org/cl/4517134
2011-06-02 10:26:09 -07:00
Russ Cox
69cb8fef43 sync/atomic: fix check64
The LDREXD and STREXD instructions require
aligned addresses, and the ARM stack is not
guaranteed to be aligned during the check.
This may cause other problems later (on the ARM
not all 64-bit pointers may be 64-bit aligned)
but at least the check is correct now.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4564053
2011-06-02 13:13:51 -04:00
Brad Fitzpatrick
f3c351982f exec: missing docs, errors
R=rsc
CC=golang-dev
https://golang.org/cl/4550111
2011-06-02 09:57:24 -07:00
Luuk van Dijk
e59aa8ea4a gc: typecheck the whole tree before walking. preparation for some escape-analysis related changes.
R=rsc
CC=golang-dev
https://golang.org/cl/4528116
2011-06-02 18:48:17 +02:00
Russ Cox
ef2d5f68d0 path/filepath: skip permission test in all.bash
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4517132
2011-06-02 12:26:43 -04:00
Dmitriy Vyukov
2653b4fbcc testing: fix MB/s computation, documentation
R=rsc
CC=golang-dev
https://golang.org/cl/4529100
2011-06-02 10:52:46 -04:00
Mikio Hara
d1bdff5448 net, syscall: update IP multicast socket options for darwin, freebsd, linux
Add IPv6Mreq and Inet6Pktinfo for specifying the network interface.
Rename IpMreq to IPMreq, SetsockoptIpMreq to SetsockoptIPMreq.

R=rsc, dave, robert.hencke
CC=golang-dev
https://golang.org/cl/4532098
2011-06-02 10:10:17 -04:00
Rob Pike
9995d216eb template: explain that fields must be exported.
Fixes #1792.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4548083
2011-06-03 00:09:42 +10:00
Russ Cox
07acc02a29 compress/flate: do not use background goroutines
Programs expect that Read and Write are synchronous.
The background goroutines make the implementation
a little easier, but they introduce asynchrony that
trips up calling code.  Remove them.

R=golang-dev, krasin
CC=golang-dev
https://golang.org/cl/4548079
2011-06-02 09:32:38 -04:00
Nigel Tao
422abf3b8e image: add a SubImage method.
R=r
CC=golang-dev
https://golang.org/cl/4515179
2011-06-02 18:51:41 +10:00
Alex Brainman
b873701dbd runtime: do not garbage collect windows callbacks
Fixes #1883.
Fixes #1702.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4532103
2011-06-02 17:08:56 +10:00
Rob Pike
60dddc6db1 fmt: return EOF when out of input in Scan*.
Fixes #1840.

R=rsc
CC=golang-dev
https://golang.org/cl/4548077
2011-06-02 10:51:31 +10:00
William Chan
bc3a72fa28 http/spdy: reorganize package.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4524087
2011-06-01 17:30:49 -07:00
Gustavo Niemeyer
17bfa32fde sync: always wake up previously sleeping goroutines on Cond.Signal
This changes the internal implementation of Cond so that
it uses two generations of waiters.  This enables Signal
to guarantee that it will only wake up waiters that are
currently sleeping at the call time.

Fixes #1648.

R=dvyukov, gustavo, rsc
CC=golang-dev
https://golang.org/cl/4524083
2011-06-01 20:30:42 -03:00
Robert Griesemer
158b427ea5 big: fix broken overflow test
- tested with GOARCH=386
- tested with GOARCH=amd64

R=iant
CC=golang-dev
https://golang.org/cl/4526100
2011-06-01 16:28:17 -07:00
Brad Fitzpatrick
f259f6ba0a exec: new API, replace Run with Command
This removes exec.Run and replaces exec.Cmd with a
new implementation. The new exec.Cmd represents
both a currently-running command and also a command
being prepared. It has a good zero value.

You can Start + Wait on a Cmd, or simply Run it.
Start (and Run) deal with copying stdout, stdin,
and stderr between the Cmd's io.Readers and
io.Writers.

There are convenience methods to capture a command's
stdout and/or stderr.

R=r, n13m3y3r, rsc, gustavo, alex.brainman, dsymonds, r, adg, duzy.chan, mike.rosset, kevlar
CC=golang-dev
https://golang.org/cl/4552052
2011-06-01 15:26:53 -07:00
Robert Griesemer
2132a7f575 fix build: remove non-portable test case
On a 32bit machine, the big.Words are only 32bit.

R=rsc
CC=golang-dev
https://golang.org/cl/4561055
2011-06-01 15:19:34 -07:00
Robert Griesemer
ce2701b2b0 big: ~8x faster number scanning
- better number scanning algorithm
- fixed a couple of bugs related to base interpretation
- added scan benchmark
- added more test cases and made tests more precise
- introduced Int.scan method matching nat.scan
- refactored Int.Scan; now uses int.scan
- refactored Int.SetString; now uses int.scan

There is more potential, this was a fairly simple change.

gotest -test.bench="ScanPi" before/after (best of 3 runs):
big.BenchmarkScanPi	   1000	    2024900 ns/op
big.BenchmarkScanPi       10000      257540 ns/op

R=chickencha
CC=golang-dev, rsc
https://golang.org/cl/4527089
2011-06-01 14:17:00 -07:00
Russ Cox
16dbf2182c undo CL 4557058 / b4c2ffae7034
Using the getaddrinfo order is only okay if we
are smart enough to try multiple addresses in Dial.
Since the code does not do that, we must make
the right first choice, regardless of what getaddrinfo
does, and more often that not that means using the
IPv4 address, even on IPv6 systems.  With the CL
applied, gotest fails in package net on OS X.

helix.cam=; gotest
...
--- FAIL: net.TestDialGoogleIPv4 (1.05 seconds)
        -- 74.125.226.179:80 --
        -- www.google.com:80 --
        Dial("tcp", "", "www.google.com:80") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
        -- 74.125.226.179:http --
        -- www.google.com:http --
        Dial("tcp", "", "www.google.com:http") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
        -- 074.125.226.179:0080 --
        -- [::ffff:74.125.226.179]:80 --
        -- [::ffff:4a7d:e2b3]:80 --
        -- [0:0:0:0:0000:ffff:74.125.226.179]:80 --
        -- [0:0:0:0:000000:ffff:74.125.226.179]:80 --
        -- [0:0:0:0:0:ffff::74.125.226.179]:80 --
FAIL
gotest: "./6.out" failed: exit status 1

««« original CL description
net: name-based destination address selection

getaddrinfo() orders the addresses according to RFC 3484.

This means when IPv6 is working on a host we get results like:
    []string = {"2001:4810::110", "66.117.47.214"}

and when it's not working we get:
    []string = {"66.117.47.214", "2001:4810::110"}

thus can drop firstFavoriteAddr.

This also means /etc/gai.conf works on relevant systems.

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

»»»

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4532101
2011-06-01 15:49:57 -04:00
Adam Langley
e0cca45fcb crypto/openpgp: add support for symmetrically encrypting files.
This mostly adds the infrastructure for writing various forms of
packets as well as reading them. Adding symmetric encryption support
was simply an easy motivation.

There's also one brown-paper-bag fix in here. Previously I had the
conditional for the MDC hash check backwards: the code was checking
that the hash was *incorrect*. This was neatly counteracted by another
bug: it was hashing the ciphertext of the OCFB prefix, not the
plaintext.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4564046
2011-06-01 15:23:22 -04:00
Mikkel Krautz
2899535de5 asn1: fix marshalling of empty optional RawValues
This fixes creation of X509 certificates with
RSA keys. (Broken by e5ecc416f2fd)

R=agl
CC=golang-dev
https://golang.org/cl/4553052
2011-06-01 12:54:16 -04:00
Luuk van Dijk
2c4edb0eea gc: make merely referencing an outer variable in a closure not force heapallocation.
before: runtime_test.BenchmarkCallClosure1       20000000              135 ns/op
after:  runtime_test.BenchmarkCallClosure1      500000000                6 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4527091
2011-06-01 17:02:43 +02:00
Rob Pike
dcbf59cb4e path/filepath: clean up a triple negative.
also make the error prints better in the test.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4556069
2011-06-01 14:17:09 +10:00
David Symonds
32e3644883 mail: new package.
Basic parsing, plus date parsing.

R=bradfitz, gary.burd, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/4530079
2011-06-01 14:10:21 +10:00
Yuval Pavel Zholkover
f74f50e046 Make unix Readdir and windows Readdirnames return partially successful results on error.
Make plan 9 Readdir & Readdirnames return os.EOF at end.
Also fix typos in the unix and windows comments.

R=golang-dev, fshahriar, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/4557053
2011-06-01 13:12:37 +10:00
Rob Pike
73d57642a4 filepath: remove string constants. They are unnecessary.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4527090
2011-06-01 13:06:04 +10:00
Andrew Gerrand
581bd378ec gobuilder: include file missing from change, fix build
R=golang-dev
CC=golang-dev
https://golang.org/cl/4539099
2011-06-01 11:56:46 +10:00
Andrew Gerrand
9f0cabfab9 goinstall: document GOPATH and support relative/absolute installs
goinstall: more verbose logging with -v

Fixes #1901.

R=rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/4524078
2011-06-01 10:48:15 +10:00
Rob Pike
9ec0c01e19 unicode: guarantee that the 32-bit range tables contain only
values >= 16 bits, so the lookup code can be smaller in the
common case.
Also make CaseRange uint32s rather than ints, so if we go to
64-bit ints we don't waste more space.

R=rsc
CC=golang-dev
https://golang.org/cl/4550094
2011-06-01 09:49:51 +10:00
William Chan
fecab40586 http/spdy: fix data race in header decompression.
flate's reader greedily reads from the shared io.Reader in Framer. This leads to a data race on Framer.r. Fix this by providing a corkedReader to zlib.NewReaderDict(). We uncork the reader and allow it to read the number of bytes in the compressed payload.

Fixes #1884.

R=bradfitz, rsc, go.peter.90
CC=golang-dev
https://golang.org/cl/4530089
2011-05-31 14:05:35 -07:00
Russ Cox
4706ce309f net: stop Mac popups
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4559059
2011-05-31 16:15:23 -04:00
Russ Cox
15dcdf751c gc: fix m[x], _ = y.(T)
Fixes #1900.

R=ken2
CC=golang-dev
https://golang.org/cl/4561053
2011-05-31 15:52:04 -04:00
Anthony Martin
5b62ba14c4 gc: disallow ... in type conversions
Fixes #1866.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548073
2011-05-31 15:41:47 -04:00
Adam Langley
c72dbaf312 encoding/hex: don't try to print DEL.
R=agl
CC=golang-dev
https://golang.org/cl/4551081
2011-05-31 15:40:33 -04:00
Russ Cox
5ab096d030 gc: implement new shift rules
The change is that 1.0<<2 is now okay.

R=ken2
CC=golang-dev
https://golang.org/cl/4524084
2011-05-31 15:05:40 -04:00
Luuk van Dijk
9b82408f6d gc: elide call to runtime.closure for function literals called in-place.
before:
runtime_test.BenchmarkCallClosure        5000000               499 ns/op
runtime_test.BenchmarkCallClosure1       5000000               681 ns/op

after:
runtime_test.BenchmarkCallClosure       500000000                5 ns/op
runtime_test.BenchmarkCallClosure1       10000000              160 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4515167
2011-05-31 20:52:21 +02:00
Russ Cox
2261021be1 undo CL 4515163 / 42c3cfa4d64f
breaks Mac build

««« original CL description
runtime: use HOST_CC to compile mkversion

HOST_CC is set in Make.inc, so use that rather
than hardcoding quietgcc

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

»»»

R=iant
CC=golang-dev
https://golang.org/cl/4515168
2011-05-31 14:24:21 -04:00
Dave Cheney
fd0cf08748 runtime: use HOST_CC to compile mkversion
HOST_CC is set in Make.inc, so use that rather
than hardcoding quietgcc

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4515163
2011-05-31 10:46:11 -07:00
Anthony Martin
67b4db9e9e gc: check parameter declarations in interface fields
Fixes #1663.
Fixes #1871.

R=rsc, lstoakes
CC=golang-dev
https://golang.org/cl/4530084
2011-05-31 13:41:32 -04:00
Adam Langley
de15f6165e encoding/hex: add hex dumping.
I found this useful, esp with an io.MultiWriter. But I fear that
it may be bloat in such a low-level package so please feel free to
decline if you feel likewise.

R=rsc, ality
CC=golang-dev
https://golang.org/cl/4530088
2011-05-31 12:58:09 -04:00
Brad Fitzpatrick
219805066e http: have client set Content-Length when possible
Also some cleanup, removing redundant code. Make more
things use NewRequest. Add some tests, docs.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/4561047
2011-05-31 08:47:03 -07:00
Christopher Wedgwood
50effb654c net: name-based destination address selection
getaddrinfo() orders the addresses according to RFC 3484.

This means when IPv6 is working on a host we get results like:
    []string = {"2001:4810::110", "66.117.47.214"}

and when it's not working we get:
    []string = {"66.117.47.214", "2001:4810::110"}

thus can drop firstFavoriteAddr.

This also means /etc/gai.conf works on relevant systems.

R=rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4557058
2011-05-31 11:40:11 -04:00
Dmitriy Vyukov
91cc1e6b77 runtime: reset GOMAXPROCS during tests
Fix the fact that the test leaves GOMAXPROCS=3
and a running goroutine behind.

R=golang-dev, rsc
CC=dvyukov, golang-dev
https://golang.org/cl/4517121
2011-05-31 10:38:51 -04:00
Vincent Vanackere
f18a4e9609 syscall : add ProcAttr field to pass an unescaped command line on windows
On windows, the command line is passed as a single null-terminated string. While the automatic parameter escaping done by syscall.StartProcess works fine with most Windows programs, some applications do their own custom parsing of the command line, in which case the automatic escaping becomes harmful.
This CL adds a new extra CmdLine field to syscall.ProcAttr that will be used as the raw/unescaped command line if not empty.
Fixes #1849.

R=golang-dev, alex.brainman, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548050
2011-05-31 10:21:38 -04:00
Alexey Borzenkov
c4206cb231 runtime: save cdecl registers in Windows SEH handler
Fixes #1779

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4566041
2011-05-31 10:11:47 -04:00
Gustavo Niemeyer
463f478dbb filepath: Abs must always return a clean path
When I was first coding Abs, I wondered if people wouldn't
expect the path to be consistently clean, even if the path
passed in was already absolute.

CL 4524078 has a potential problem based on exactly that
assumption, so it feels like this behavior is indeed the
most useful and least surprising.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4548074
2011-05-30 22:28:59 -03:00
Rob Pike
0de328edd6 unicode: make the tables smaller.
By splitting the ranges into 16-bit values and 32-bit values,
we can reduce about 3000 entries by 48 bits per entry, or about
16KB, at the cost of a little more complexity in the code.

R=iant, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/4547066
2011-05-31 09:58:07 +10:00
Russ Cox
2c6a2a9773 goinstall: skip standard packages
R=adg, n13m3y3r
CC=golang-dev
https://golang.org/cl/4526084
2011-05-30 18:23:16 -04:00
Gustavo Niemeyer
87dbec54bb template: fix and clean interaction between quotes and formatters
Fixes issue #1897.

R=r, gustavo, r
CC=golang-dev
https://golang.org/cl/4561049
2011-05-30 11:53:09 -03:00
Robert Hencke
3fbd478a8a pkg: spelling tweaks, I-Z
also, a few miscellaneous fixes to files outside pkg

R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Alex Brainman
9107b530d8 goinstall: use bash to execute gomake
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/4551074
2011-05-30 16:15:08 +10:00
Yasuhiro Matsumoto
1042572528 src: Make.pkg don't create $(TARGDIR) with goinstall.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4548071
2011-05-30 12:35:55 +10:00
Nigel Tao
a479bc8d02 image/png: fix encoding of images that don't start at (0, 0).
R=r
CC=golang-dev
https://golang.org/cl/4560049
2011-05-30 10:55:37 +10:00
David Symonds
5d5d84f3df gob: fix documentation on Decoder.Decode.
R=r, adg
CC=golang-dev
https://golang.org/cl/4515159
2011-05-30 10:48:08 +10:00
Brad Fitzpatrick
da32ed7bf1 http: let Transport use a custom net.Dial function
Permits the use of SOCKS proxy dialer with
the transport.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4536091
2011-05-29 09:32:36 -07:00
Rob Pike
62943df829 template: cosmetic cleanups.
Remove the idea of space being white.  Sometimes space is green.
Simplify a comment and remove the Latin.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4532096
2011-05-29 16:13:41 +10:00
Gustavo Niemeyer
e11d94fcd7 template: fix quote-handling with formatters
Fixes issue #1896.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4539093
2011-05-29 00:23:32 -03:00
Yasuhiro Matsumoto
0f4510b370 os: fix os.MkdirAll with backslash path separator.
MkdirAll() need to use isSeparator().
Move primary defines of filepath.Separator/filepath.ListSeparator
 to os.PathSeparator/os.PathListSeparator.
Move filepath.isSeparator() to os.IsPathSeparator().
filepath package refer them from os package.
Fixes #1831.

R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/4535100
2011-05-29 13:03:49 +10:00
Alex Brainman
505f0bb3ce os: fix windows version of Readdir(0)
Fixes #1893.

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/4528106
2011-05-29 11:59:35 +10:00
Alex Brainman
b7582852f6 gotest, pkg/exec: use bash instead of sh to execute shell scripts on windows
As suggested by dho, iant2.

R=golang-dev, rsc
CC=devon.odell, golang-dev, iant
https://golang.org/cl/4515147
2011-05-28 21:26:03 +10:00
Evan Shaw
f369fc09f4 go/scanner: don't allow "0x" and "0X" as integers
R=gri
CC=golang-dev
https://golang.org/cl/4560047
2011-05-27 16:47:26 -07:00
Brad Fitzpatrick
399a311e64 http: client+server benchmark
baseline runs: (6g, gopher.mtv)

http_test.BenchmarkClientServer  5000  412588 ns/op
http_test.BenchmarkClientServer  5000  403346 ns/op
http_test.BenchmarkClientServer  5000  413936 ns/op
http_test.BenchmarkClientServer  5000  410287 ns/op
http_test.BenchmarkClientServer  5000  388037 ns/op
http_test.BenchmarkClientServer  5000  405545 ns/op
http_test.BenchmarkClientServer  5000  405179 ns/op
http_test.BenchmarkClientServer  5000  413827 ns/op
http_test.BenchmarkClientServer  5000  392723 ns/op

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4515155
2011-05-27 16:43:02 -07:00
Brad Fitzpatrick
f7a266a5aa encoding/binary: add a non-reflect fast path for Write
before/after:
binary.BenchmarkWrite	  100000	     18312 ns/op
binary.BenchmarkWrite	  500000	      4468 ns/op

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4515154
2011-05-27 16:29:33 -07:00
Evan Shaw
3b980579b4 big: make Int and Rat implement fmt.Scanner
R=gri
CC=golang-dev
https://golang.org/cl/4552056
2011-05-27 15:51:00 -07:00
Rob Pike
5a35757f3f time: midnight is 12AM.
This is the other half of the problem fixed at noon by the previous change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4515150
2011-05-28 07:06:53 +10:00
Brad Fitzpatrick
685a8157e6 os: yet more Readdir tests and fix earlier regression
R=golang-dev, fshahriar
CC=golang-dev
https://golang.org/cl/4548068
2011-05-27 12:58:59 -07:00
Brad Fitzpatrick
0e865ab8e7 os: improve Readdir test coverage, fix Readdir(0) on EOF
Adds tests for Readdir and Readdirnames with different n
values.  No good way to inject faults during full reads,
though.

Also fixes bug report from fshahriar:
Readdir(0) wasn't behaving like Readdir(-1).

R=rsc, fshahriar
CC=golang-dev
https://golang.org/cl/4529092
2011-05-27 12:14:48 -07:00
Brad Fitzpatrick
0b204e4625 http: propagate Set-Cookie in reverse proxy
Also adds Host header tests.

Fixes #1886

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4556063
2011-05-27 11:06:53 -07:00
Brad Fitzpatrick
b88be14982 http/spdy: temporarily disable some failing tests
Issue 1886 has details

R=golang-dev, willchan
CC=golang-dev
https://golang.org/cl/4527083
2011-05-27 10:08:31 -07:00
Rob Pike
406d73876d time: fix Format bug: noon is 12PM, not 0PM.
Fixes #1882.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4556062
2011-05-27 23:24:39 +10:00
Gustavo Niemeyer
a825e8a69f cgo: restrict #cgo directives to prevent shell expansion
Fixes issue #1879.

Directives were not directly expanded, but since their
content ended up in makefiles, further expansion would
take place there.  This prevents such artifacts by
restricting the set of characters that may be used in
a directive value.

To build the list of safe characters I went through the
contents of /usr/lib/pkgconfig and extracted LDFLAGS
and CFLAGS information, so hopefully this is a
reasonable default to get started.

R=rsc
CC=golang-dev
https://golang.org/cl/4532092
2011-05-27 08:46:51 -03:00
Rob Pike
a1d2cbf645 crypto/tls/generate_cert.go: fix misspelling of O_CREATE.
Fixes #1888.

R=ken
CC=golang-dev
https://golang.org/cl/4515148
2011-05-27 21:06:50 +10:00
Alex Brainman
cb96d98b06 os: another attempt to handle OpenFile flag parameter properly on Windows
Fixes #1791.

R=rsc, r, r, iant
CC=golang-dev
https://golang.org/cl/4551046
2011-05-27 17:02:24 +10:00
Dmitry Chestnykh
e4492ce3c3 runtime: fix mmap error return on linux.
Fixes #1511 again.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4527070
2011-05-26 21:43:27 -07:00
Gustavo Niemeyer
bddb75127f cgo: support pkg-config for flags and libs
Fixes issue #1853.

R=golang-dev, mattn.jp, adg
CC=golang-dev
https://golang.org/cl/4550084
2011-05-26 22:19:23 -03:00
Mikio Hara
12376c93ef syscall: add routing messages support for BSD variants
R=rsc
CC=golang-dev
https://golang.org/cl/4539084
2011-05-26 20:02:03 -04:00
Alex Brainman
86327cdcf5 os: TestMkdirAll should not fail to delete _test/_TestMkdirAll_ on Windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4515142
2011-05-27 09:52:15 +10:00
Mikio Hara
4d118835ab syscall: add routing messages support for Linux
R=rsc
CC=golang-dev
https://golang.org/cl/4515135
2011-05-26 17:04:58 -04:00
Ivan Krasin
1b5d04c5ae compress/flate: fix Huffman tree bug
Incorporate refactoring and a regression test from https://golang.org/cl/4538090/

R=rsc, go.peter.90, imkrasin
CC=golang-dev, mirtchovski
https://golang.org/cl/4524070
2011-05-26 17:02:11 -04:00
Robert Griesemer
e8c87a7ddd fix build: temporarily disable the use of strings.Reader UnreadRune in fmt
R=r
CC=golang-dev
https://golang.org/cl/4532090
2011-05-26 11:54:10 -07:00
Ian Lance Taylor
9ef8ebafe4 gc: patch y.tab.c to fix build when using Bison 2.5
Fixes #1843.

R=rsc
CC=golang-dev
https://golang.org/cl/4535101
2011-05-26 11:28:23 -07:00
Robert Griesemer
5b1fb9d5c6 io: add ByteScanner, RuneScanner interfaces
R=r, rsc
CC=golang-dev
https://golang.org/cl/4530069
2011-05-26 11:03:52 -07:00
Robert Griesemer
9cd3372f9b strings: implement UnreadByte, UnreadRune
Added corresponding tests.

R=rsc
CC=golang-dev
https://golang.org/cl/4560045
2011-05-26 11:02:07 -07:00
William Chan
abb970ef57 http/spdy: redo interfaces, flesh out implementation & frame types
Added a new Framer to handle reading/writing Frames. This is necessary since we have to maintain a compression context across streams.

TODO:
* Separate the types and read/write routines into different files.
* Improve error handling.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4503042
2011-05-26 09:54:54 -07:00
Brad Fitzpatrick
3648a03b3a encoding/binary: add a non-reflect fast path for Read
before/after:
binary.BenchmarkRead  200000     10860 ns/op
binary.BenchmarkRead  500000      2846 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/4547062
2011-05-26 09:01:05 -07:00
Yasuhiro Matsumoto
c0decc35ae exp/eval: fix compile error.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4550086
2011-05-26 22:05:25 +10:00
Brad Fitzpatrick
4923ba9155 mime/multipart: misc code/doc fixes
R=rsc
CC=golang-dev
https://golang.org/cl/4532089
2011-05-25 19:21:05 -07:00
Brad Fitzpatrick
0836b86e8b http: Transport hook to register non-http(s) protocols
This permits external packages implementing e.g.
FTP or gopher to register themselves with the
http.DefaultClient:

package ftp
func init() {
    http.DefaultTransport.RegisterProtocol("ftp", &ftp{})
}

Client code would look like:

import (
    _ "github.com/exampleuser/go/gopher"
    _ "github.com/exampleuser/go/ftp"
)

func main() {
    resp, err := http.Get("ftp://example.com/path.txt")
    ...
}

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4526077
2011-05-25 12:31:11 -07:00
Brad Fitzpatrick
1b6bf88767 encoding/base64: add DecodeString and EncodeToString
... like encoding/hex. Same signatures.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4530070
2011-05-25 12:24:36 -07:00
Ian Lance Taylor
0b8f1ac802 net: If we stop polling, remove any pending events for the socket
Fixes #1872.

R=rsc
CC=golang-dev, lars.pensjo
https://golang.org/cl/4559046
2011-05-25 12:21:10 -07:00
Robert Griesemer
a1c92c612f go/scanner: use strconv.QuoteRune now that it is available
R=r, rsc
CC=golang-dev
https://golang.org/cl/4538096
2011-05-25 11:16:17 -07:00
Russ Cox
5190907299 quietgcc: fix typo, respect $TMPDIR
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4529087
2011-05-25 13:20:50 -04:00
Brad Fitzpatrick
b0f39cc27c io, net, http: sendfile support
Speeds up static fileserver, avoiding kernel/userspace copies.

Numbers: downloading 14 MB AppEngine Go SDK with ab (Apache Bench)
with 5 threads:

Before/after numbers:

CPU:
user    0m3.910s
sys     0m23.650s
->
user    0m0.720s
sys     0m4.890s

Time taken for tests:   8.906 seconds
->
Time taken for tests:   8.545 seconds

Percentage of the requests served within a certain time (ms)
50%     44
66%     45
75%     46
80%     46
90%     48
95%     51
98%     59
99%     71
100     74 (longest request)
->
50%     42
66%     43
75%     43
80%     44
90%     46
95%     57
98%     62
99%     63
100%    64 (longest request)

R=iant, gary.burd, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4543071
2011-05-25 10:15:26 -07:00
Russ Cox
e94eb38975 gc: typo
R=ken2
CC=golang-dev
https://golang.org/cl/4539086
2011-05-25 10:19:50 -04:00
Russ Cox
2286471651 5g: alignment fixes
Makes all.bash work after echo 4 >/proc/cpu/alignment,
which means kill the process on an unaligned access.

The default behavior on DreamPlug/GuruPlug/SheevaPlug
is to simulate an ARMv3 and just let the unaligned accesses
stop at the word boundary, resulting in all kinds of surprises.

Fixes #1240.

R=ken2
CC=golang-dev
https://golang.org/cl/4551064
2011-05-25 10:18:49 -04:00
Russ Cox
831c684434 5l: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/4538095
2011-05-25 09:44:05 -04:00
Russ Cox
64b497c62a ld: add -w to disable dwarf, make errors obviously from dwarf
Reenable dwarf output on Mac.
Was writing headers but no actual dwarf data.

Fixes #1877 (accidentally).
Workaround for issue 1878.

R=lvd
CC=golang-dev
https://golang.org/cl/4515139
2011-05-25 08:25:33 -04:00
Wei Guangjing
2ad58d48fb 8l: emit resources (.rsrc) in Windows PE.
R=alex.brainman, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4516055
2011-05-25 07:53:00 -04:00
Rob Pike
7b03f2a990 fmt: make %q work for integers, printing a quoted character literal.
R=rsc
CC=golang-dev
https://golang.org/cl/4556060
2011-05-25 21:25:15 +10:00
Ian Lance Taylor
ddcdbd4470 os: Fix test to work on Solaris.
On Solaris /bin is a symlink to /usr/bin, so running "pwd" in
the directory "/bin" prints out "/usr/bin".

R=rsc, r, bradfitz
CC=golang-dev
https://golang.org/cl/4559043
2011-05-24 22:53:37 -07:00
Rob Pike
c4918db8b9 strconv: add QuoteRune, which is analogous to Quote, but for runes rather than strings.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4556059
2011-05-25 15:04:07 +10:00
Russ Cox
d2b2b3f4a8 6l, 8l: fix Mach-O binaries with many dynamic libraries
R=ken2
CC=golang-dev
https://golang.org/cl/4529084
2011-05-24 19:50:13 -04:00
Anthony Martin
0b209b36b6 gc: relax assignability of method receivers
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers.  This change updates the compiler.

Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.

Fixes #1402.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
2011-05-24 19:48:19 -04:00
Robert Griesemer
3857747dce go/scanner: remove some code
R=r
CC=golang-dev
https://golang.org/cl/4550077
2011-05-24 15:00:42 -07:00
Robert Griesemer
3c7271f057 go spec: be precise with the use of the informal ellipsis … and the Go token ...
Fixes #1867.

R=r
CC=golang-dev
https://golang.org/cl/4538092
2011-05-24 14:18:44 -07:00
Brad Fitzpatrick
b32ad8bff5 http: Client test for streaming responses (no code changes)
I had a report that this was broken. It seems fine.

I think the reporter was just never flushing their response
headers.  If I omit the test server's initial Flush I get the
same behavior as reported. (a hang at Client.Get)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4552062
2011-05-24 09:02:01 -07:00
Brad Fitzpatrick
3933cb2371 http: fix Set-Cookie date parsing
Fixes #1855

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4527073
2011-05-24 08:31:43 -07:00
Rob Pike
b3d3762b2e encoding/line: delete package.
Its functionality is now in bufio.
Fixes #1869.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4553061
2011-05-24 16:05:26 +10:00
Rob Pike
4c945c2cfc image/gif: simplify blockReader.Read.
Inverting the tests avoids recursion and simplifies the flow.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4551057
2011-05-24 11:02:44 +10:00
Kyle Consalus
78a7dda739 time: Remove unnecessary call to Nanoseconds() in after().
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4528091
2011-05-23 12:38:51 -07:00
Brad Fitzpatrick
ccafd53ed3 http: add docs/warning on incorrect use of NewChunkedWriter
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/4536075
2011-05-22 18:46:48 -07:00
Mikio Hara
12104807de syscall: add IPv6 scope zone ID support
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4515124
2011-05-22 10:09:07 -07:00
Mikio Hara
8c6dc5fea5 net: re-enable wildcard listening
Fixes #1854.

R=bradfitz, golang-dev
CC=golang-dev
https://golang.org/cl/4550062
2011-05-22 09:48:04 -07:00
Dave Cheney
d4a9bce70a runtime: fix function args not checked warning on arm
This tiny nit was driving me nuts

R=rsc, ken, r
CC=golang-dev
https://golang.org/cl/4550069
2011-05-22 14:59:25 +10:00
Andrew Gerrand
3975b9910c flag: fix build
R=r
CC=golang-dev
https://golang.org/cl/4543064
2011-05-22 11:55:02 +10:00
Robert Hencke
6dced6d992 crypto/x509: fix incorrect prints found by govet
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4526073
2011-05-22 09:23:22 +10:00
Rob Pike
f4fe688b09 flags: allow distinct sets of flags.
A FlagSet is an independent set of flags that may be used,
for example, to provide flag processing for subcommands
in a CLI.  The standard, os.Args-derived set of flags is a
global but non-exported FlagSet and the standard functions
are wrappers for methods of that FlagSet.

Allow the programmer to control whether the program
exits if there is a parse error.  For the default set, the behavior
remains to exit on error.

The handling of Usage is odd due to backward compatibility.

R=golang-dev, bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4517092
2011-05-22 09:22:00 +10:00
Dave Cheney
648f25b237 5l: fix set but not used warnings
R=rsc, iant
CC=golang-dev
https://golang.org/cl/4538083
2011-05-21 08:00:53 -07:00
Brad Fitzpatrick
e4b942245a http: include Host header in requests, even with proxies
A user pointed out that Go didn't work with their
corp proxy, always throwing 400 Bad Request errors.

Looking at the RFC 2616, Host is always required,
even with proxies.

The old code assumed that writing an absolute URL
in the first line of an HTTP request implied
that the Host header was no longer necessary.

Double-checked behavior with curl.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4539075
2011-05-20 19:40:23 -07:00
Evan Shaw
3230fd1469 fmt: scanning doc fix
R=r
CC=golang-dev
https://golang.org/cl/4539073
2011-05-21 07:38:01 +10:00
Brad Fitzpatrick
bf73ca88a6 syscall: sendfile
R=iant
CC=golang-dev
https://golang.org/cl/4553051
2011-05-20 11:51:31 -07:00
Adam Langley
7f099cdc76 asn1: add big support.
Initially I wanted to minimise dependencies but it's become clear that
big int support in ASN.1 is a common need and that it should be part
of the core.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4550063
2011-05-20 10:20:08 -07:00
Adam Langley
4fdcb7b684 crypto/openpgp: add key generation support.
This change adds a function for generating new Entities and inchoate
support for reserialising Entities.

R=bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4551044
2011-05-20 09:36:20 -07:00
Brad Fitzpatrick
b22151f7dc mime/multipart: add a multipart Writer
Fixes #1823

R=golang-dev, adg, robert.hencke
CC=golang-dev
https://golang.org/cl/4530054
2011-05-20 09:03:43 -07:00
Robert Griesemer
b790ae2efb go/printer, gofmt: fix formatting of expression lists (missing blank)
This appears to have been a long-standing formatting bug.
The test cases has misformatted golden files.

Applied gofmt -w src misc .

Fixes #1839.

R=iant
CC=golang-dev
https://golang.org/cl/4515113
2011-05-19 17:05:35 -07:00
Gustavo Niemeyer
29b246c644 template: support string, int and float literals
This enables customizing the behavior of formatters
with logic such as {"template"|import} or even
{Field1 Field2 "%.2f 0x%X"|printf}

Thanks to Roger Peppe for some debate on this.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4536059
2011-05-19 09:24:27 -03:00
David Symonds
bddd092dc3 flag: fix docs on flag.Var.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4539067
2011-05-19 14:53:26 +10:00
Anthony Martin
24b2f48a4a crypto/rand: add utility functions for number generation
This code is extracted from crypto/rsa with
a few variables renamed and a comment fixed.

R=agl, rsc, agl
CC=golang-dev
https://golang.org/cl/4446068
2011-05-18 18:55:06 -07:00
Brad Fitzpatrick
4ffff35abd http: Client.Do should follow redirects for GET and HEAD
It's documented as such, but it was never wired up
after Transport went in and Head was fixed.

If people don't want redirects, that's what RoundTripper/
Transport are for.  Or a custom redirect policy.

R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/4526065
2011-05-18 17:17:26 -07:00
Mikio Hara
1d550bdedf syscall: add netlink support for linux/386, linux/amd64, linux/arm
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4535078
2011-05-18 16:33:41 -07:00
Nigel Tao
0a2650f398 image/jpeg: small memory layout optimization for encoding.
Before:
jpeg.BenchmarkEncodeRGBOpaque ... 23.29 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.27 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.17 MB/s

After:
jpeg.BenchmarkEncodeRGBOpaque ... 23.42 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.34 MB/s
jpeg.BenchmarkEncodeRGBOpaque ... 23.33 MB/s

R=rsc
CC=golang-dev
https://golang.org/cl/4538077
2011-05-18 14:39:37 -07:00
Jonathan Allie
e7db6d78a2 crypto/x509: add support for parsing and verifying DSA signatures
(DSA with SHA1, DSA with SHA256). Cleanup getSignatureFromOID
function.

R=agl, agl, rsc
CC=golang-dev
https://golang.org/cl/4530055
2011-05-18 12:59:04 -07:00
Robert Griesemer
bda36cf3ab fmt: fix minor documentation nits
R=r, rsc
CC=golang-dev
https://golang.org/cl/4556041
2011-05-18 11:34:19 -07:00
Russ Cox
975ba88e0e cgo: use packed struct to fix Windows behavior
R=golang-dev, mattn.jp, jcowgar, iant
CC=golang-dev
https://golang.org/cl/4535080
2011-05-18 14:08:12 -04:00
Robert Griesemer
82ddf97094 big: support %v and # modifier, better handling of unknown formats
R=r
CC=golang-dev
https://golang.org/cl/4536065
2011-05-18 11:02:08 -07:00
Nigel Tao
8e26a644ca image/jpeg: make writeDQT do fewer array copies.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4536069
2011-05-18 10:56:20 -07:00
Mikio Hara
9cd674be93 syscall: adjust freebsd syscalls.master URL properly
R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/4552051
2011-05-18 13:28:01 -04:00
Robert Hencke
c8727c81bb pkg: spelling tweaks, A-H
R=ality, bradfitz, rsc, dsymonds, adg, qyzhai, dchest
CC=golang-dev
https://golang.org/cl/4536063
2011-05-18 13:14:56 -04:00
Wei Guangjing
b256358008 6l: fix emit windows dwarf sections
R=alex.brainman, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4532069
2011-05-18 13:12:38 -04:00
Brad Fitzpatrick
feca99fd6f http: add Transport.ProxySelector
R=mattn.jp, rsc
CC=golang-dev
https://golang.org/cl/4528077
2011-05-18 09:23:29 -07:00
Mikio Hara
cef64d8e2b syscall: add TODO about required manual corrections
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/4553042
2011-05-18 10:51:45 -04:00
Nigel Tao
5f7b0bc366 image/jpeg: fix bounds calculation for grayscale JPEG images.
Also add grayscale test cases for image/decode_test.

R=r
CC=golang-dev
https://golang.org/cl/4526063
2011-05-17 15:47:14 -07:00
Robert Griesemer
9fa6cb2f2b big: better support for string conversions
Fixes #1842.

R=r
CC=golang-dev
https://golang.org/cl/4517081
2011-05-17 15:32:38 -07:00
Brad Fitzpatrick
9ea0bd3986 http: add http.SetCookie(ResponseWriter, *Cookie)
R=golang-dev, gary.burd, rsc
CC=golang-dev
https://golang.org/cl/4526062
2011-05-17 15:07:44 -07:00
Roger Peppe
83fd82b349 big: add Int methods to act on numbered bits.
Speeds up setting individual bits by ~75%, useful
when using big.Int as a bit set.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/4538053
2011-05-17 13:38:21 -07:00
Robert Griesemer
8f57f49398 go/ast resolver: properly maintain map of package global imports
- add Data field to ast.Object
- for package objects, the Data field holds the package scope
- resolve several TODOs

R=rsc
CC=golang-dev
https://golang.org/cl/4538069
2011-05-17 11:22:52 -07:00
Rob Pike
1242c76794 reflect: make allocation test less fragile.
When GOMAXPROCS>1, the testing framework runs in parallel with the
test itself and may do a small number of allocations, so allow the
"noAllocs" condition to admit just a few.

Fixes #1782.

R=rsc
CC=golang-dev, rsc
https://golang.org/cl/4533041
2011-05-17 11:15:14 -04:00
Robert Hencke
3faa490f89 pkg: fix new incorrect prints found by govet
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4539063
2011-05-16 21:15:06 -07:00
Mikio Hara
db36e03692 net, http: add and make use of IP address scope identification API
Add seven methods to IP struct: IsUnspecified, IsLoopback,
IsMulticast, IsInterfaceLocalMulticast, IsLinkLocalMulticast,
IsLinkLocalUnicast and IsGlobalUnicast.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4515083
2011-05-16 23:21:13 -04:00
Alex Brainman
5342aedeed filepath: make EvalSymlinks work on Windows
Fixes #1830.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4526060
2011-05-17 12:33:36 +10:00
Anthony Martin
f570d9d765 8g: fix conversion from float to uint64
The code for converting negative floats was
incorrectly loading an FP control word from
the stack without ever having stored it there.

Thanks to Lars Pensjö for reporting this bug.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4515091
2011-05-16 22:14:56 -04:00
Rob Pike
de7c28fe76 image/gif: enable images with <8 bits per pixel.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4552042
2011-05-16 16:00:41 -07:00
Rob Pike
ff1093852f GIF: support decoding of interlaced images.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4535073
2011-05-16 15:17:17 -07:00
Gary Burd
aea17570c0 net: sort records returned by LookupSRV
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4518061
2011-05-16 17:48:00 -04:00
Mikio Hara
2ddcad96d7 net: protocol family adaptive address family selection
This CL will help to make an adaptive address family
selection possible when an any address family, vague
network string such as "ip", "tcp" or "udp" is passed
to Dial and Listen API.

Fixes #1769.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4438066
2011-05-16 17:03:06 -04:00
Alexey Borzenkov
b701cf3332 runtime: make StackSystem part of StackGuard
Fixes #1779

R=rsc
CC=golang-dev
https://golang.org/cl/4543052
2011-05-16 16:57:49 -04:00
Russ Cox
e69b9ddd42 ld: do not emit reference to dynamic library named ""
Fixes #1778.

R=ken2
CC=golang-dev
https://golang.org/cl/4550047
2011-05-16 16:24:17 -04:00
Russ Cox
2d310a0087 5c, 5g: another attempt at silencing gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4535074
2011-05-16 16:15:13 -04:00
Russ Cox
40745a579c 5l: delete pre-ARMv4 instruction implementations
Add implementation for addr<->reg short moves.
Align large data, for ARM.

R=ken2
CC=golang-dev
https://golang.org/cl/4545050
2011-05-16 16:14:37 -04:00
Adam Langley
d84415d8f0 crypto/x509: support DSA public keys in X.509 certs.
R=agl
CC=golang-dev
https://golang.org/cl/4517072
2011-05-16 11:16:48 -07:00
Brad Fitzpatrick
3587085fb7 os: fix Windows build from earlier readdir change
It worked originally, until I renamed a variable. :/

dir_windows.go:11: undefined: e
http://godashboard.appspot.com/log/092397f2ac7a1e6e812dc6bebc65b40b02368700a119343d5cee5e2e89e0fde5

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4535072
2011-05-16 10:27:49 -07:00
Nigel Tao
0d111a62e1 image/jpeg: decode grayscale images, not just color images.
Also add an image package test that DecodeConfig returns the same
ColorModel as what Decode would.

R=r, r
CC=golang-dev
https://golang.org/cl/4529065
2011-05-16 10:13:17 -07:00
Brad Fitzpatrick
4da5cd4cd6 os: make Readdir & Readdirnames return os.EOF at end
Fixes #678

R=rsc, r, alex.brainman, bsiegert, jdpoirier
CC=golang-dev
https://golang.org/cl/4536058
2011-05-16 09:26:16 -07:00
Nigel Tao
77d66f4131 strings: make Reader.Read use copy instead of an explicit loop.
R=r, bradfitz, r
CC=golang-dev
https://golang.org/cl/4529064
2011-05-15 13:14:10 -07:00
Robert Hencke
d49844bcce gofmt: skip bug340.go in test.sh
bug340.go is a test case for a syntax error

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4523069
2011-05-14 23:06:50 -07:00
Robert Hencke
cc2fc02467 pkg: fix incorrect prints found by govet
Also, clarify some error messages

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4548042
2011-05-14 20:43:18 -07:00
Brad Fitzpatrick
870791a5ac unicode: build maketables during testshort too
Fixes #1825

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4535066
2011-05-14 16:54:49 -07:00
Adam Langley
4eb67563f6 crypto/openpgp: change PublicKey.Serialize to include the header.
Signature.Serialize already does this and they should be consistent.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4521064
2011-05-14 19:13:12 -04:00
Brad Fitzpatrick
b2400c28cf fix windows build: http.Get finalURL removal missed earlier
Not sure why this only broke Windows. Make test is only run
on windows for that directory?

TBR=golang-dev

R=golang-dev
CC=golang-dev
https://golang.org/cl/4545044
2011-05-13 18:56:39 -07:00
Robert Griesemer
c35c672020 go/types: fix (some) builds
The position (type) for which the "invalid cycle" error
message is reported depends on which type in a cycle of
types is first checked. Which one is first depends on
the iteration order of maps which is different on
different platforms. For now, disable this error message.

R=rsc
CC=golang-dev
https://golang.org/cl/4527059
2011-05-13 18:33:04 -07:00
Brad Fitzpatrick
cd4d0004fa http: add Request.SetBasicAuth method
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4543050
2011-05-13 15:43:46 -07:00
Luuk van Dijk
36cec789cd gc: generalize dst = append(src,...) inlining to arbitrary src and dst arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/4517057
2011-05-14 00:35:10 +02:00
Robert Griesemer
ba006e6b6a go/types: type checker API + testing infrastructure
At the moment types.Check() only deals with global
types and only partially so. But the framework is
there to compute them and check for cycles. An initial
type test is passing.

First step of a series of CLs to come.

R=rsc
CC=golang-dev
https://golang.org/cl/4425063
2011-05-13 15:31:09 -07:00
Robert Griesemer
32b822f29a go spec: fix error in production syntax
Fix analoguous error in ebnf.go which already
correctly accepted an empty production.

Fixes #1821.

R=r
CC=golang-dev
https://golang.org/cl/4526056
2011-05-13 12:54:51 -07:00
Russ Cox
2d174db6a6 5c, 5g: fix build with too-smart gcc
R=ken2
CC=golang-dev
https://golang.org/cl/4543049
2011-05-13 12:15:46 -04:00
Eivind Uggedal
092f34feca http: make HEAD client request follow redirects
HEAD requests should in my opinion have the ability to follow redirects
like the implementation of GET requests does. My use case is polling
several thousand severs to check if they respond with 200 status codes.
Using GET requests is neither efficient in running time of the task nor
for bandwidth consumption.

This suggested patch changes the return signature of http.Head() to match
that of http.Get(), providing the final URL in a redirect chain.

`curl -IL http://google.com` follows redirects with HEAD requests just fine.

Fixes #1806.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4517058
2011-05-13 08:17:59 -07:00
Brad Fitzpatrick
05a1b7ec41 http: remove finalURL from Client.Get; move to Response
This CL:

-- removes Response.RequestMethod string
-- adds Response.Request *Request
-- removes the finalURL result parameter from client.Get()
-- adds a gofix rule for callers of http.Get which assign
   the final url to the blank identifier; warning otherwise

Caller who did:

res, finalURL, err := http.Get(...)

now need to do:

res, err := http.Get(...)
if err != nil {
   ...
}
finalURL := res.Request.URL.String()

R=rsc
CC=golang-dev
https://golang.org/cl/4535056
2011-05-13 07:31:24 -07:00
Mikio Hara
4336116d3b net: remove unused functions
Remove unused functions, getip() and sockaddrToString().
Remove unnecessary linebreaks.

R=golang-dev
CC=golang-dev
https://golang.org/cl/4523062
2011-05-13 07:00:06 -07:00
Alex Brainman
34ac4ec30c 6l, 8l: emit windows dwarf sections similar to other platforms
R=golang-dev, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4517056
2011-05-13 16:05:47 +10:00
Robert Hencke
142008c325 strconv: document and test True and False for Atob
R=golang-dev
CC=golang-dev
https://golang.org/cl/4535057
2011-05-12 22:00:50 -07:00
Robert Hencke
a005617c5a gotest: document unit of time for elapsed()
R=golang-dev
CC=golang-dev
https://golang.org/cl/4543044
2011-05-12 22:00:14 -07:00
Robert Griesemer
71630337f2 go/*: various small fixes
parser:
- resolve embedded interface type names
ast:
- clarify some comments
- correctly unquote import paths

R=rsc
CC=golang-dev
https://golang.org/cl/4528060
2011-05-12 20:14:58 -07:00
Benny Siegert
14c59abd76 image/tiff: Reject images with SampleFormat != 1.
The TIFF spec says that a baseline TIFF reader must gracefully terminate
when the image has a SampleFormat tag which it does not support.
For baseline compatibility, only SampleFormat=1 (the default) is needed.
Images with other sample formats (e.g. floating-point color values)
are very rare in practice.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4515073
2011-05-12 22:34:48 -04:00
Brad Fitzpatrick
f4e5f364c7 html: parse empty, unquoted, and single-quoted attribute values
Fixes #1391

R=nigeltao
CC=golang-dev
https://golang.org/cl/4453054
2011-05-12 16:11:35 -07:00
Robert Griesemer
82d1a9dce7 go/printer: more accurate comment for incomplete structs/interfaces
A struct or interface type node is marked incomplete if fields or
methods have been removed through any kind of filtering, not just
because entries are not exported.

The current message was misleading in some cases (for instance:
"godoc -src reflect Implements").

This CL requires CL 4527050 .

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4529054
2011-05-12 09:01:50 -07:00
Robert Griesemer
d376935a18 go/ast: consider anonymous fields and set Incomplete bit when filtering ASTs
Also:
- fieldListExports: don't require internal pointer to StructType/InterfaceType node
- filterFieldLists: make structure match fieldListExports

R=rsc
CC=golang-dev
https://golang.org/cl/4527050
2011-05-12 09:01:32 -07:00
Robert Griesemer
26bbb2b2f7 go/doc, godoc: when filtering for godoc, don't remove elements of a declaration
Partially revert CL 4518050. In go/doc.go, instead of calling the go/ast filter
functions, implement the corresponding match functions that do no remove
declaration elements.

Fixes #1803.

R=rsc
CC=golang-dev
https://golang.org/cl/4517055
2011-05-12 09:01:10 -07:00
Russ Cox
70798eaad6 5l, 8l: add ELF symbol table to binary
Should have been added long ago.
Thanks to Alex Brainman for noticing.

R=ken2
CC=golang-dev
https://golang.org/cl/4538046
2011-05-11 23:59:36 -04:00
Anthony Martin
4fca395321 ld: fix alignment of rodata section on Plan 9
This was causing a panic in the reflect package
since type.* pointers with their low bits set are
assumed to have certain flags set that disallow
the use of reflection.

Thanks to Pavel and Taru for help tracking down
this bug.

R=rsc, paulzhol, taruti
CC=golang-dev
https://golang.org/cl/4511041
2011-05-11 23:52:05 -04:00
Lorenzo Stoakes
f58d911698 gc: fix type switch error message for invalid cases.
Fixes #1606.

R=rsc
CC=golang-dev
https://golang.org/cl/4532045
2011-05-11 23:41:59 -04:00
Anthony Martin
fbb4be3278 make: add nuke target for C commands and libs
Also, clean *.out files for commands written in Go.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4535051
2011-05-11 22:53:42 -04:00
Brad Fitzpatrick
fa23a70044 http: fix two Transport gzip+persist crashes
There were a couple issues:

-- HEAD requests were attempting to be ungzipped,
   despite having no content.  That was fixed in
   the previous patch version, but ultimately was
   fixed as a result of other refactoring:

-- persist.go's ClientConn "lastbody" field was
   remembering the wrong body, since we were
   mucking with it later. Instead, ditch
   ClientConn's readRes func field and add a new
   method passing it in, so we can use a closure
   and do all our bodyEOFSignal + gunzip stuff
   in one place, simplifying a lot of code and
   not requiring messing with ClientConn's innards.

-- closing the gzip reader didn't consume its
   contents.  if the caller wasn't done reading
   all the response body and ClientConn closed it
   (thinking it'd move past those bytes in the
   TCP stream), it actually wouldn't.  so introduce
   a new wrapper just for gzip reader to have its
   Close method do an ioutil.Discard on its body
   first, before the close.

Fixes #1725
Fixes #1804

R=rsc, eivind
CC=golang-dev
https://golang.org/cl/4523058
2011-05-11 22:33:15 -04:00
Adam Langley
d080a1cf14 compress/zlib: actually use provided dictionary.
R=rsc, bradfitz, bradfitzgoog
CC=golang-dev
https://golang.org/cl/4518056
2011-05-11 17:00:19 -04:00
Christian Himpel
158970ea66 http: write cookies according to RFC 6265
RFC 6265 requires that user agents MUST NOT send more than
one Cookie header in a request.

Note, this change also fixes an issue when sending requests
with more than one cookie header line to a php script served
by an apache web server.  Apache concatenates the cookies
with ", ", but php tries to split them only at ";".  E.g.
two cookies: "a=b, c=d" are seen by php as one cookie "a"
with the value "b, c=d".

Fixes #1801

R=bradfitz
CC=golang-dev
https://golang.org/cl/4535048
2011-05-11 13:33:27 -07:00
Brad Fitzpatrick
ca83cd2c2f http: fix transport bug with zero-length bodies
An optimization in Transport which re-uses TCP
connections early in the case where there is
no response body interacted poorly with
ErrBodyReadAfterClose.  Upon recycling the TCP
connection early we would Close the Response.Body
(in case the user forgot to), but in the case
of a zero-lengthed body, the user's handler might
not have run yet.

This CL makes sure the Transport doesn't try
to Close requests when we're about to immediately
re-use the TCP connection.

This also includes additional tests I wrote
while debugging.

R=rsc, bradfitzgoog
CC=golang-dev
https://golang.org/cl/4529050
2011-05-11 12:11:32 -07:00
Nigel Tao
51e6aa1e88 image/bmp: implement a BMP decoder.
R=r
CC=golang-dev
https://golang.org/cl/4521054
2011-05-11 11:12:45 -07:00
Nigel Tao
67992cae53 image/gif: minor fixes.
R=r
CC=golang-dev
https://golang.org/cl/4523054
2011-05-11 11:11:25 -07:00
Adam Langley
55d43f0ce8 crypto/x509/crl: add package
crl parses CRLs and exposes their details. In the future, Verify
should be able to use this for revocation checking.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4485045
2011-05-11 10:39:09 -04:00
Luuk van Dijk
d6b2925923 gc: inline append when len<cap
issue 1604

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4313062
2011-05-11 16:35:11 +02:00
Brad Fitzpatrick
b276293aba http: don't Clean query string in relative redirects
R=adg, rsc, kevlar, r
CC=golang-dev
https://golang.org/cl/4476045
2011-05-11 04:30:05 -07:00
Russ Cox
3f335f80b4 gc: fix unsafe.Sizeof
Fixes #1608.
Fixes #1787.

R=ken2
CC=golang-dev
https://golang.org/cl/4530045
2011-05-10 17:00:15 -04:00
Robert Griesemer
0389051aac go/ast, go/doc, godoc: consider struct fields and interface methods when filtering ASTs
So far, only top-level names where considered when trimming ASTs
using a filter function. For instance, "godoc reflect Implements"
didn't show the "Implements" method of the type Interface because
the local method name was not considered (on the other hand, "top-
level" declared methods associated with types were considered).

With this CL, AST filter functions look also at struct fields
and interface methods.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4518050
2011-05-10 11:09:56 -07:00
Albert Strasheim
69a91663d2 runtime: add newline to "finalizer already set" error
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4523047
2011-05-10 13:47:56 -04:00
Nigel Tao
4c1e1b815b image/jpeg: speed up decoding by inlining the clip function and
writing the idct result directly to the image buffer instead of
storing it in an intermediate d.blocks field.

Writing to d.blocks was necessary when decoding to an image.RGBA image,
but now that we decode to a ycbcr.YCbCr we can write each component
directly to the image buffer.

Crude "time ./6.out" scores to decode a specific 2592x1944 JPEG 20
times show a 16% speed-up:

BEFORE

user	0m10.410s
user	0m10.400s
user	0m10.480s
user	0m10.480s
user	0m10.460s

AFTER

user	0m9.050s
user	0m9.050s
user	0m9.050s
user	0m9.070s
user	0m9.020s

R=r
CC=golang-dev
https://golang.org/cl/4523052
2011-05-09 17:25:32 -07:00
Robert Griesemer
499ad9448b go/printer, gofmt: fix alignment of "=" in const/var declarations
gofmt -w src misc

Fixes #1414.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4456054
2011-05-09 15:16:34 -07:00
Robert Griesemer
447db23c4a go/parser: always introduce an ast.Object when declaring an identifier
When traversing parameter lists (e.g. for type checking), we want the
invariant that all identifers have associated objects (even _ idents),
so that we can associate a type with each object.

R=rsc
CC=golang-dev
https://golang.org/cl/4490042
2011-05-09 14:48:05 -07:00
Rob Pike
45ea58746b gif: fix build
Had bit test wrong on transparency; no excuses.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4526044
2011-05-09 06:38:04 -07:00
Rob Pike
a54dca8357 image/gif: implement transparency.
At least, as I understand it. The spec is unclear about what happens
with a local color map.

R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4515045
2011-05-08 17:26:16 -07:00
Alex Brainman
8bf1515825 syscall: change Overlapped.HEvent type, it is a handle
R=golang-dev, r, r2
CC=golang-dev
https://golang.org/cl/4471046
2011-05-08 16:33:44 +10:00
Alex Brainman
b191155ab4 syscall: fix bug in mksyscall_windows.pl
This change fixes generation of "shadow" variables for bool parameters.
Before the change, it was naming all bool variables with the same name of _p0.
Now it calls them _p0, _p1, ... So the code could compile.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4479047
2011-05-08 16:32:00 +10:00
Rob Pike
92834d351e image/gif: GIF decoder
It's incomplete but sufficient to decode 8-bit GIFs without interlacing
or transparency.   More to come.

I'll put in more tests as the feature set grows.

R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4522041
2011-05-07 22:57:42 -07:00
Nigel Tao
f467803dcd compress/lzw: silently drop implied codes that are too large,
instead of returning an error.

For example, http://www.w3.org/Graphics/GIF/spec-gif89a.txt
explicitly says that GIF encoders can use a full table as is,
without needing to send a clear code.

R=r, dsymonds, nigeltao_gnome, r2
CC=golang-dev
https://golang.org/cl/4518041
2011-05-07 18:57:32 -07:00
Anschel Schaffer-Cohen
a4dee3a746 gob: Doc typo fix
Fixes #1785.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4496042
2011-05-07 11:05:08 -07:00
Joe Poirier
733fde588b windows: reset command var to sh for correct error output messages
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4492043
2011-05-06 22:05:04 -07:00
Roger Peppe
1dc914bc0d cgo: put CFLAGS before filename argument
This means that the -x flag can work, which could enable
support for other languages (e.g. objective-C).

R=iant, rsc
CC=golang-dev
https://golang.org/cl/4476049
2011-05-06 13:35:51 -07:00
Albert Strasheim
0629354bd3 runtime: handle out-of-threads on Linux gracefully
R=rsc
CC=golang-dev
https://golang.org/cl/4396050
2011-05-06 15:29:49 -04:00
David Symonds
606e12f9bf http: fix typo in URL.String doc comment.
R=adg
CC=golang-dev
https://golang.org/cl/4485046
2011-05-06 10:00:50 -07:00
Alex Brainman
8253edcb4c wingui: fix Makefile after rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4477046
2011-05-06 17:15:46 +10:00
Adam Langley
ffd550455c crypto/tls: export the verified chains.
The verified chains are the chains that were actually verified.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4462046
2011-05-05 13:44:36 -04:00
Adam Langley
e1bf165b28 crypto/x509: export raw SubjectPublicKeyInfo.
The SPKI will probably be used for identifying public keys in future
HSTS specs.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4485044
2011-05-05 13:37:42 -04:00
Roger Peppe
da39008a27 image: make AlphaColor.Set conform to usual signature
R=nigeltao, r
CC=golang-dev
https://golang.org/cl/4471045
2011-05-05 10:16:59 -07:00
Benny Siegert
d97b8a817b image/tiff: implement a decoder.
The current iteration can decode 8-bit images in
grayscale, paletted, RGB, RGBA and NRGBA mode. LZW compression
is implemented but does not work on my test images.
Deflate (i.e. zlib) compression with or without a horizontal
predictor is supported.

R=nigeltao, nigeltao_gnome
CC=golang-dev, mpl
https://golang.org/cl/4240051
2011-05-04 20:52:55 -07:00
Dmitry Chestnykh
737e96c7f3 image/png: support encoding of paletted images with alpha channel.
Encoder now writes tRNS chunk for non-opaque paletted images.
CL includes new test images (basn3a08-trns.[ps]ng).

R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432078
2011-05-04 20:46:27 -07:00
Ross Light
bcf3bfe2fe http/spdy: add type to FlagClearPreviouslyPersistedSettings constant
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4436074
2011-05-04 15:01:33 -04:00
Nigel Tao
13f08cd807 exp/draw: fast paths for drawing a YCbCr or an NRGBA onto an RGBA.
On my laptop, I had an 800x600 jpeg and an 800x600 png (with
transparency). I timed how long it took to draw each image onto an
equivalently sized, zeroed RGBA image.

Previously, the jpeg took 75ms and the png took 70ms, going through
the medium-fast path, i.e. func drawRGBA in draw.go.

After this CL, the jpeg took 14ms, and the png took 21ms with the
Over operator and 12ms with the Src operator.

It's only a rough estimate basd on one image file, but it should
give an idea of the order of magnitude of improvement.

R=rsc, r
CC=adg, golang-dev
https://golang.org/cl/4468044
2011-05-04 10:17:53 -07:00
Andrew Gerrand
73f4b847ae http: fix FormFile nil pointer dereference on missing multipart form
R=rsc
CC=golang-dev
https://golang.org/cl/4463042
2011-05-03 20:45:10 -07:00
Alex Brainman
684e065d05 net: disable dnsmsg_test on windows
R=golang-dev, bradfitzwork
CC=golang-dev
https://golang.org/cl/4466041
2011-05-04 13:08:36 +10:00
Alex Brainman
37dca9d417 make.bash: remove old bash version of gotest on Windows
The file is called gotest.exe now.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4444090
2011-05-04 11:16:55 +10:00
Brad Fitzpatrick
4b30d7cead http: improve a test
Should prevent failures on slow machines, such as:
http://godashboard.appspot.com/log/47b5cae591b7ad8908704e327f3b9b41945d7d5fecfc0c8c945d5545ece1a813

Verified the change (on a fast machine) by removing the
existing sleep, in which case the race happens ~50% of the
time with GOMAXPROCS > 1, but recovers gracefully with
retries.

R=rsc
CC=golang-dev
https://golang.org/cl/4441089
2011-05-03 11:25:35 -07:00
Robert Griesemer
e49d50e203 gofmt: update test.sh (exclude a file w/ incorrect syntax)
R=iant, iant2
CC=golang-dev
https://golang.org/cl/4453058
2011-05-03 09:56:18 -07:00
Russ Cox
86e6a44112 reflect: allow unexported key in Value.MapIndex
Fixes #1748.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4444087
2011-05-03 10:38:37 -04:00
Brad Fitzpatrick
8ef56f7e92 net: don't crash on unexpected DNS SRV responses
Fixes #1350

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4432089
2011-05-03 07:10:48 -07:00
Gustavo Niemeyer
2c92fe0b4f Make.cmd: create TARGDIR if necessary
Fixes #1771.

R=adg, rsc1
CC=golang-dev
https://golang.org/cl/4437089
2011-05-03 09:53:04 -03:00
Russ Cox
296d6871a8 ld: make ELF binaries with no shared library dependencies static binaries
$ file $GOROOT/bin/{godoc,goyacc}
/home/rsc/g/go/bin/godoc:  ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not strpped
/home/rsc/g/go/bin/goyacc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
$

Fixes #1758.

R=iant
CC=golang-dev
https://golang.org/cl/4428079
2011-05-03 01:56:23 -04:00
Brad Fitzpatrick
ec1ee024ad os: remove race paranoia from Environ(); it's guarded now
R=rsc
CC=golang-dev
https://golang.org/cl/4426077
2011-05-02 23:08:27 -04:00
Rob Pike
a2354cd4e4 image: fix build
accidentally deleted one method
TBR=rsc

R=rsc
CC=golang-dev
https://golang.org/cl/4438090
2011-05-02 15:42:46 -07:00
Rob Pike
2398a74bd8 image: add type-specific Set methods and use them when decoding PNG.
This speeds up PNG decode about 20% by avoiding per-pixel interface conversions.

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4428080
2011-05-02 15:10:37 -07:00
Russ Cox
4002014cf8 http/pprof: fix POST reading bug
R=bradfitz
CC=golang-dev
https://golang.org/cl/4430075
2011-05-02 17:34:22 -04:00
Brad Fitzpatrick
12cf1699e7 net: default to 127.0.0.1, not localhost, in TestICMP
If localhost resolves to ::1, the IPv4-only test fails.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4444084
2011-05-02 14:22:40 -07:00
Brad Fitzpatrick
6876ad37f3 runtime: maybe fix Windows build broken by cgo setenv CL
R=rsc
CC=golang-dev
https://golang.org/cl/4428078
2011-05-02 13:35:28 -07:00
Robert Griesemer
c783e68ff5 godoc: added -index flag to enable/disable search index
Fixes #1647.

R=adg, rsc1, r2, rsc, r
CC=golang-dev
https://golang.org/cl/4444083
2011-05-02 13:28:02 -07:00
Brad Fitzpatrick
f279a93929 http: fix racy test with a simpler version
This was seen breaking the slow arm5 builder:
http://godashboard.appspot.com/log/ec54ee302a70c07093e8f5c47454b3eb48768b77e1d8cc7943d8951f8b6696be

The test was unnecessarily complex and didn't benefit from
using httptest.Server. That just got in the way.

R=rsc
CC=golang-dev
https://golang.org/cl/4439088
2011-05-02 13:01:36 -07:00
Brad Fitzpatrick
623e7de187 os: make Setenv update C environment variables
Fixes #1569

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4456045
2011-05-02 12:38:13 -07:00
Robert Griesemer
3599e3fc12 go/printer: make tests follow syntactic restrictions
R=rsc
CC=golang-dev
https://golang.org/cl/4439087
2011-05-02 10:05:43 -07:00
Robert Griesemer
16381b145e go/token: faster FileSet.Position implementation
- added a cache for last file looked up: avoids binary
  search if the file matches

- don't look up extra line info if not present
  (it is almost never present)

- inline one critical binary search call (inlining
  provides almost 30% improvement in this case)

Together, these changes make the go/printer benchmark
more than twice as fast (53% improvement). gofmt also
sped up by about the same amount.

Also: removed an unused internal field from FileSet.

Measurements (always best of 5 runs):

* original:
  printer.BenchmarkPrint     5    238354200 ns/op (100%)

* using last file cache:
  printer.BenchmarkPrint    10    201796600 ns/op (85%)

* avoiding lookup of extra line info:
  printer.BenchmarkPrint    10    157072700 ns/op (66%)

* inlining a critical binary search call:
  printer.BenchmarkPrint    10    111523500 ns/op (47%)

gofmt (always best of 3 runs):

* before:
  time gofmt -l src misc
  real	0m33.316s
  user	0m31.298s
  sys	0m0.319s

* after:
  time gofmt -l src misc
  real	0m15.889s
  user	0m14.596s
  sys	0m0.224s

R=r, dfc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4433086
2011-05-02 09:17:46 -07:00
Russ Cox
a46a311dec 5a, 6a, 8a, cc: remove old environment variables
Uses of $INCLUDE and $NPROC are left over from Plan 9.
Remove them to avoid causing confusion.

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4445079
2011-05-02 11:24:32 -04:00
Brad Fitzpatrick
ef94520380 multipart: add FileName accessor on Part
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4426074
2011-05-02 08:14:31 -07:00
Mikio Hara
bc926713c7 net: enable SO_REUSEPORT on BSD variants
Fixes #1694.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4445067
2011-05-02 10:50:12 -04:00
Mikio Hara
756df8e081 net: fix ipv6 test
Fixes #1767.

R=rsc
CC=golang-dev
https://golang.org/cl/4436073
2011-05-02 10:49:42 -04:00
Russ Cox
540feaae47 runtime, sync/atomic: fix arm cas
Works around bug in kernel implementation on old ARM5 kernels.
Bug was fixed on 26 Nov 2007 (between 2.6.23 and 2.6.24) but
old kernels persist.

Fixes #1750.

R=dfc, golang-dev
CC=golang-dev
https://golang.org/cl/4436072
2011-05-02 10:49:19 -04:00
Brad Fitzpatrick
807ce2719c jpeg: speed up RGBA encoding ~%50
Avoids image.At(), color.RGBA(), opposing 8 bit shifts,
and min function calls in a loop.  Not as pretty as before,
but the pure version is still there to revert back to
later if/when the compiler gets better.

before (best of 5)
jpeg.BenchmarkEncodeRGBOpaque   50   64781360 ns/op   18.97 MB/s

after (best of 5)
jpeg.BenchmarkEncodeRGBOpaque   50   42044300 ns/op   29.23 MB/s

(benchmarked on an HP z600; 16 core Xeon E5520 @ 2.27Ghz)

R=r, r2, nigeltao
CC=golang-dev
https://golang.org/cl/4433088
2011-05-02 07:26:40 -07:00
Brad Fitzpatrick
437015bbed png: speed up opaque RGBA encoding
With Linux/8g on a 2006 Mac Mini (1.66 GHz Intel Core Duo,
2KB L1, 2MB L2, 2G main memory), GOMAXPROCS unset:

start:
png.BenchmarkEncodePaletted	      50	  44772820 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 208395900 ns/op
png.BenchmarkEncodeRGBA		       5	 331088000 ns/op

remove interface method calls:
png.BenchmarkEncodePaletted	      50	  44722880 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 139042600 ns/op
png.BenchmarkEncodeRGBA		       5	 334033600 ns/op

flate inline min/max():
png.BenchmarkEncodePaletted	      50	  40631180 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 124894900 ns/op
png.BenchmarkEncodeRGBA		       5	 312099000 ns/op

after adler change:
png.BenchmarkEncodePaletted	      50	  40181760 ns/op
png.BenchmarkEncodeRGBOpaque	      20	 121781950 ns/op
png.BenchmarkEncodeRGBA		       5	 313890800 ns/op

In comparison to 121 ms on this 2006 machine, on my
Core2 Duo 2.66 GHz laptop, the final BenchmarkEncodeRGBOpaque
runs in 27 ms. (these are all for 640x480 images)

R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432077
2011-05-02 07:25:53 -07:00
Brad Fitzpatrick
db16bca18f multipart: return an error on Reader EOF, not (nil, nil)
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4430074
2011-05-01 18:23:39 -07:00
Evan Shaw
366986a3fe syscall: add Windows file mapping functions and constants
R=brainman, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4375046
2011-05-02 09:35:55 +10:00
Andrew Gerrand
89adf5dce4 http: rename ErrBodyReadAferClose to ErrBodyReadAfterClose
R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/4432085
2011-05-01 12:37:20 -07:00
Brad Fitzpatrick
27d0a731a2 mime/multipart: fix regression from previous ReadSlice change
The previous change to make multipart use ReadSlice out of
paranoia broke multipart to not deal with large lines in
the bodies.

We should only be paranoid about long lines in the header
sections.

Fixes http://code.google.com/p/camlistore/issues/detail?id=4

R=adg
CC=golang-dev
https://golang.org/cl/4432083
2011-04-30 19:54:36 -07:00
Brad Fitzpatrick
cb375ffbb0 http: new error for reading a body after it's been closed
R=adg
CC=golang-dev
https://golang.org/cl/4433094
2011-04-30 19:54:08 -07:00
Robert Griesemer
0d1f76ded2 go/parser: accept parenthesized receive operations in select statements
R=rsc
CC=golang-dev
https://golang.org/cl/4439082
2011-04-29 13:06:03 -07:00
Brad Fitzpatrick
f5fa215d8a image: png & jpeg encoding benchmarks
No code changes in this CL.

R=r
CC=golang-dev
https://golang.org/cl/4445074
2011-04-29 10:42:44 -07:00
Ian Lance Taylor
2e7d6729d4 http/cgi: pass down environment variables for irix and solaris
Used by gccgo.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4435080
2011-04-29 10:38:07 -07:00
Evan Shaw
0add1c3ed8 http/cgi: correctly set request Content-Type
R=bradfitz
CC=golang-dev
https://golang.org/cl/4433087
2011-04-29 07:04:28 -07:00
Robert Griesemer
da9b8b8352 go/printer: added simple performance benchmark
R=r, dfc, bradfitzwork, bradfitz
CC=golang-dev
https://golang.org/cl/4441078
2011-04-28 17:06:34 -07:00
Brad Fitzpatrick
548c9c8624 cgi: set Request.TLS and Request.RemoteAddr for children
R=agl, eds, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4432079
2011-04-28 15:02:32 -07:00
Evan Shaw
98945a2bad cgi: export RequestFromMap
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4452056
2011-04-28 13:30:53 -07:00
Ross Light
1801972b30 http/spdy: new package
R=bradfitz, agl1, rsc
CC=golang-dev
https://golang.org/cl/4435055
2011-04-28 13:11:37 -07:00
Russ Cox
6f88288a13 xml: fix reflect error
Fixes #1749.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4431075
2011-04-28 15:43:42 -04:00
Brad Fitzpatrick
df2c5d5429 http: update cookie doc to reference new RFC 6265
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4442100
2011-04-28 11:36:06 -07:00
Gustavo Niemeyer
3e9a1d50db syslog: fix skipping of net tests
Also remove some left over copy & paste
in the test of reflect.Copy for arrays.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4431074
2011-04-28 14:16:41 -03:00
Russ Cox
8133cb3565 gc: preserve original expression for errors
Fixes #1722.

R=ken2
CC=golang-dev
https://golang.org/cl/4442099
2011-04-28 13:14:35 -04:00
Evan Shaw
f319e1df37 http: add Header.Write method
R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/4426069
2011-04-28 00:16:15 -07:00
Andrew Gerrand
200bd0a057 http: add MultipartForm, FormFile, and ParseMultipartForm to Request
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4431068
2011-04-28 15:21:54 +10:00
Brad Fitzpatrick
ba43be30c4 adler32: speed up ~40% by avoiding bounds checks
before & after:
adler32.BenchmarkGolden	  100000	     14747 ns/op
adler32.BenchmarkGolden	  200000	      8761 ns/op

Found by profiling PNG encoding.

R=rsc, bradfitzwork, eds
CC=golang-dev
https://golang.org/cl/4441073
2011-04-27 21:36:11 -07:00
Russ Cox
37b3494026 runtime: fix typo in gc bug fix
This time for sure.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4437078
2011-04-28 00:20:37 -04:00
Lorenzo Stoakes
b6f0632e93 gc: correctly handle fields of pointer type to recursive forward references
Previously, whether declaring a type which copied the structure of a type it was referenced in via a pointer field would work depended on whether you declared it before or after the type it copied, e.g. type T2 T1; type T1 struct { F *T2 } would work, however type T1 struct { F *T2 }; type T2 T1 wouldn't.

Fixes #667.

R=rsc
CC=golang-dev
https://golang.org/cl/4313064
2011-04-28 00:13:49 -04:00
Russ Cox
370276a3e5 runtime: stack split + garbage collection bug
The g->sched.sp saved stack pointer and the
g->stackbase and g->stackguard stack bounds
can change even while "the world is stopped",
because a goroutine has to call functions (and
therefore might split its stack) when exiting a
system call to check whether the world is stopped
(and if so, wait until the world continues).

That means the garbage collector cannot access
those values safely (without a race) for goroutines
executing system calls.  Instead, save a consistent
triple in g->gcsp, g->gcstack, g->gcguard during
entersyscall and have the garbage collector refer
to those.

The old code was occasionally seeing (because of
the race) an sp and stk that did not correspond to
each other, so that stk - sp was not the number of
stack bytes following sp.  In that case, if sp < stk
then the call scanblock(sp, stk - sp) scanned too
many bytes (anything between the two pointers,
which pointed into different allocation blocks).
If sp > stk then stk - sp wrapped around.
On 32-bit, stk - sp is a uintptr (uint32) converted
to int64 in the call to scanblock, so a large (~4G)
but positive number.  Scanblock would try to scan
that many bytes and eventually fault accessing
unmapped memory.  On 64-bit, stk - sp is a uintptr (uint64)
promoted to int64 in the call to scanblock, so a negative
number.  Scanblock would not scan anything, possibly
causing in-use blocks to be freed.

In short, 32-bit platforms would have seen either
ineffective garbage collection or crashes during garbage
collection, while 64-bit platforms would have seen
either ineffective or incorrect garbage collection.
You can see the invalid arguments to scanblock in the
stack traces in issue 1620.

Fixes #1620.
Fixes #1746.

R=iant, r
CC=golang-dev
https://golang.org/cl/4437075
2011-04-27 23:21:12 -04:00
Russ Cox
09092a78e6 cgo: handle versioned ELF symbols
Fixes #1397.

R=iant
CC=golang-dev
https://golang.org/cl/4444064
2011-04-27 23:21:03 -04:00
Russ Cox
70b0de8e98 runtime: allow use of >512 MB on 32-bit platforms
runtime: memory allocated by OS not in usable range
runtime: out of memory: cannot allocate 1114112-byte block (2138832896 in use)
throw: out of memory

runtime.throw+0x40 /Users/rsc/g/go/src/pkg/runtime/runtime.c:102
        runtime.throw(0x1fffd, 0x101)
runtime.mallocgc+0x2af /Users/rsc/g/go/src/pkg/runtime/malloc.c:60
        runtime.mallocgc(0x100004, 0x0, 0x1, 0x1, 0xc093, ...)
runtime.mal+0x40 /Users/rsc/g/go/src/pkg/runtime/malloc.c:289
        runtime.mal(0x100004, 0x20bc4)
runtime.new+0x26 /Users/rsc/g/go/src/pkg/runtime/malloc.c:296
        runtime.new(0x100004, 0x8fe84000, 0x20bc4)
main.main+0x29 /Users/rsc/x.go:11
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:93
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:178
        runtime.goexit()
----- goroutine created by -----
_rt0_386+0xbf /Users/rsc/g/go/src/pkg/runtime/386/asm.s:80

R=iant, r
CC=golang-dev
https://golang.org/cl/4444073
2011-04-27 23:20:53 -04:00
Andrew Gerrand
33ca16d616 mime/multipart: add ReadForm and associated types
R=brad_danga_com, rsc, dfc, r, dchest, bradfitz
CC=golang-dev
https://golang.org/cl/4439075
2011-04-28 13:14:35 +10:00
Brad Fitzpatrick
bb1ec0dfc8 tar: use ioutil.Discard
This one didn't come up in previous greps.

R=adg
CC=golang-dev
https://golang.org/cl/4430071
2011-04-27 15:57:22 -07:00
Brad Fitzpatrick
9d12307a12 ioutil: add Discard, update tree.
This also removes an unnecessary allocation in
http/transfer.go

R=r, rsc1, r2, adg
CC=golang-dev
https://golang.org/cl/4426066
2011-04-27 15:47:04 -07:00
Brad Fitzpatrick
ec3fe2a5b6 http: put a limit on POST size
R=rsc
CC=golang-dev
https://golang.org/cl/4432076
2011-04-27 15:36:39 -07:00
Brad Fitzpatrick
6e71e1ca76 http: keep gzip reader inside eofsignaler
Fixes #1725

R=rsc
CC=golang-dev
https://golang.org/cl/4442086
2011-04-27 14:23:25 -07:00
Gustavo Niemeyer
6850dba0ca reflect: Fix Copy of arrays
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4438077
2011-04-27 18:22:53 -03:00
Brad Fitzpatrick
b477a79c4e cgi: improve Location response handling
Add local URI path support, which isn't as fringe
as I originally thought. (it's supported by Apache)

Send an implicit 302 status on redirects (not 200).

Fixes #1597

R=rsc, r
CC=golang-dev
https://golang.org/cl/4442089
2011-04-27 14:07:13 -07:00
Peter Mundy
aee6b1160e runtime: fix mkversion to output valid path separators
In a GOROOT path a backslash is a path separator
not an escape character. For example, `C:\go`.
Fixes gotest error:
version.go:3: unknown escape sequence: g

R=rsc
CC=golang-dev
https://golang.org/cl/4437076
2011-04-27 15:47:12 -04:00
Evan Shaw
87ac7c77c0 http/fcgi: New package
R=golang-dev, bradfitzgo, bradfitzwork, nigeltao, rog
CC=golang-dev
https://golang.org/cl/4271078
2011-04-27 12:34:34 -07:00
Rob Pike
2ccd20a646 tutorial: replace the forever loops with finite counts in sieve programs.
Fixes #1742.
I hope.

Also this picks up an update to go_tutorial.html that should already have happened.

R=brainman, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4452050
2011-04-27 09:59:27 -07:00
Russ Cox
5eeaca12d3 gopack: preserve safe flag when not adding unsafe objects to archive
R=dsymonds
CC=golang-dev
https://golang.org/cl/4436060
2011-04-27 09:20:53 -04:00
Andrew Gerrand
ca8a055f5c goinstall: support GOPATH; building and installing outside the Go tree
For example, with GOPATH set like so
        GOPATH=/home/adg/gocode
And after creating some subdirectories
        mkdir /home/adg/gocode/{bin,pkg,src}

I can use goinstall to install the github.com/nf/goto web server,
which depends on the github.com/nf/stat package, with
        goinstall github.com/nf/goto

This downloads and installs all dependencies (that aren't already
installed) like so
        /home/adg/gocode/bin/goto
        /home/adg/gocode/pkg/darwin_amd64/github.com/nf/stat.a
        /home/adg/gocode/src/github.com/nf/goto/...
        /home/adg/gocode/src/github.com/nf/stat/...

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4438043
2011-04-27 11:00:34 +10:00
Rob Pike
a2014f104c rpc: run benchmarks over HTTP as well as direct network connections.
R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4442085
2011-04-26 16:16:51 -07:00
Rob Pike
a0a10d1988 rpc: allow the argument (first arg of method) to be a value rather than a pointer.
Can make the API nicer in some cases.

R=rsc, rog, r2
CC=golang-dev
https://golang.org/cl/4428064
2011-04-26 15:07:25 -07:00
Brad Fitzpatrick
214b82f2e0 http: new tests + panic hunting issue 1725
No bugs found yet, though.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4436058
2011-04-26 12:32:59 -07:00
Adam Langley
8803d57f3e crypto/x509: memorize chain building.
I ran the new verification code against a large number of certificates
with a huge (>1000) number of intermediates.

I had previously convinced myself that a cycle in the certificate
graph implied a cycle in the hash graph (and thus, a contradiction).
This is bogus because the signatures don't cover each other.

Secondly, I managed to drive the verification into a time explosion
with a fully connected graph of certificates. The code would try to
walk the factorial number of paths.

This change switches the CertPool to dealing with indexes of
certificates rather than pointers: this makes equality easy. (I didn't
want to compare pointers because a reasonable gc could move objects
around over time.)

Secondly, verification now memorizes the chains from a given
certificate. This is dynamic programming for the lazy, but there's a
solid reason behind it: dynamic programming would ignore the Issuer
hints that we can exploit by walking up the chain rather than down.

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4439070
2011-04-26 10:26:22 -04:00
Albert Strasheim
839e9eada0 syscall: Mlock, Munlock, Mlockall, Munlockall on Linux.
R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433070
2011-04-26 06:41:19 -07:00
Russ Cox
e2f9c73391 runtime: more graceful out-of-memory crash
Used to fault trying to access l->list->next
when l->list == nil after MCentral_AllocList.
Now prints

runtime: out of memory: no room in arena for 65536-byte allocation (536870912 in use)
throw: out of memory

followed by stack trace.

Fixes #1650.

R=r, dfc
CC=golang-dev
https://golang.org/cl/4446062
2011-04-26 08:25:40 -04:00
Alex Brainman
b1deb3be7f os: fix race in ReadAt/WriteAt on Windows
R=bradfitzgo, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4441051
2011-04-26 18:09:46 +10:00
Alex Brainman
2d99974ec5 8l: do not emit empty dwarf pe sections
This change will allow to generate valid executable,
even if rsc disables dwarf generation, as it happend
at revision 9a64273f9d68.

R=rsc
CC=golang-dev, lvd, vcc
https://golang.org/cl/4425066
2011-04-26 17:12:16 +10:00
Brad Fitzpatrick
1038e7c853 http: make Client redirect policy configurable
Work on issue 155

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4435071
2011-04-25 22:41:50 -07:00
Russ Cox
bac8f18035 gc: fix order of operations for f() < g().
Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).

Fixes #1728.

R=ken2
CC=golang-dev
https://golang.org/cl/4425070
2011-04-26 00:57:03 -04:00
Russ Cox
f813702f6d all-qemu.bash: remove DISABLE_NET_TESTS
It's no longer used.

R=adg
CC=golang-dev
https://golang.org/cl/4426061
2011-04-26 00:16:12 -04:00
Andrew Gerrand
43b97ce69b websocket: include *http.Request in websocket.Conn
This permits the websocket handler to inspect http headers and such.

Fixes #1726.

R=ukai, bradfitz, bradfitzgo
CC=golang-dev
https://golang.org/cl/4439069
2011-04-26 10:47:49 +10:00
Dave Cheney
079a5cffb3 runtime: fix arm build
R=rsc, r
CC=golang-dev
https://golang.org/cl/4438069
2011-04-25 15:33:57 -07:00
Russ Cox
4684df520f gc: explain why invalid receiver types are invalid
Fixes #1680.

R=ken2
CC=golang-dev
https://golang.org/cl/4446061
2011-04-25 17:16:44 -04:00
Russ Cox
8698bb6c8c runtime: turn "too many EPIPE" into real SIGPIPE
Tested on Linux and OS X, amd64 and 386.

R=r, iant
CC=golang-dev
https://golang.org/cl/4452046
2011-04-25 16:58:00 -04:00
Ian Lance Taylor
41e5de2184 time: Support Irix 6 location for zoneinfo files.
R=rsc
CC=golang-dev
https://golang.org/cl/4440066
2011-04-25 12:37:00 -07:00
Russ Cox
c2c7ee2736 ld: fix 6l -d on Mac, diagnose invalid use of -d
R=r
CC=golang-dev
https://golang.org/cl/4430064
2011-04-25 13:57:52 -04:00
Russ Cox
07abf1c732 fix tree for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4435067
2011-04-25 13:39:36 -04:00
Russ Cox
0e2bb62f23 reflect: rename Typeof, NewValue -> TypeOf, ValueOf
R=r, bradfitzgo
CC=golang-dev
https://golang.org/cl/4433066
2011-04-25 13:39:16 -04:00
Russ Cox
41342dc73c gofix: add support for reflect rename
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4450053
2011-04-25 13:39:00 -04:00
Fazlul Shahriar
f1781bec3b 8g,8l: fix "set but not used" gcc error
$ gcc --version
gcc (GCC) 4.6.0 20110415 (prerelease)

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4442080
2011-04-25 12:14:30 -04:00
Russ Cox
a8bf6f32cc runtime: correct out of memory error
Fixes #1511.

R=golang-dev, iant2
CC=golang-dev
https://golang.org/cl/4433065
2011-04-25 12:13:54 -04:00
Russ Cox
3a1fdc655e gc: fix import width bug
Fixes #1705.

R=ken2
CC=golang-dev
https://golang.org/cl/4443060
2011-04-25 12:08:48 -04:00
Robert Hencke
883d68f885 gc: allow complex types to be receiver types
Fixes #1716.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4439068
2011-04-25 12:02:54 -04:00
Adam Langley
a9a6c90104 crypto/tls: use time(), not Time().
The unexported version returns a sensible default when the user hasn't
set a value. The exported version crashes in that case.

R=bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4435070
2011-04-25 10:27:36 -04:00
Nigel Tao
b6cb4f9bf4 jpeg: decode to a YCbCr image instead of an RGBA image.
R=r
CC=golang-dev
https://golang.org/cl/4436053
2011-04-24 19:25:49 +10:00