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

6662 Commits

Author SHA1 Message Date
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
Joe Poirier
057fa94d31 rc/env.bash: fix for Go tool-chain build on windows under msys.
The path conversion is done automatically if msys' builtin
shell commands are used.

R=rsc1, peterGo, brainman, Mr_Dark, r
CC=golang-dev
https://golang.org/cl/4452042
2011-04-23 11:34:08 -07:00
Rob Pike
f3113ee9b9 fmt: tweak the doc for %U.
Fixes #1727.

R=rsc
CC=golang-dev
https://golang.org/cl/4437069
2011-04-23 11:25:27 -07:00
Russ Cox
c0a895fc0a gc: fix conversion of user-defined string type to []byte
Fixes #1709.

R=ken2
CC=golang-dev
https://golang.org/cl/4438068
2011-04-23 10:55:32 -04:00
Russ Cox
815a1b84c7 gc: fix return variable named _
Fixes #1712.

R=ken2
CC=golang-dev
https://golang.org/cl/4445055
2011-04-23 10:54:19 -04:00
Russ Cox
7879d3118c gc: fix line number at EOF
Fixes #1474.

R=ken2
CC=golang-dev
https://golang.org/cl/4432061
2011-04-23 10:54:05 -04:00
Anthony Martin
c7008f47ec ld: fix Plan 9 symbol table
Static symbols were not being marked as such.

I also made the 'z' symbols use the first byte of
the name instead of an explicit NUL so that if
the symbol table format is ever changed, the only
place that would need updating is addhist().

R=rsc
CC=golang-dev
https://golang.org/cl/4366047
2011-04-23 10:53:49 -04:00
Russ Cox
4f7fd3cb7f runtime: disable long test (fix arm build)
TBR=r
CC=golang-dev
https://golang.org/cl/4449051
2011-04-23 10:03:51 -04:00
Ian Lance Taylor
14531fbaa5 fmt: decrease recursion depth
This permits the test to run when using gccgo on system
without split-stack support.  See
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01420.html
http://gcc.gnu.org/PR48553

R=r
CC=golang-dev
https://golang.org/cl/4440062
2011-04-22 16:59:21 -07:00
David Symonds
d911b872ce container/heap: fix circular dependency in test
Having the test be in the container/heap package yields a cycle
  container/heap (for the test)
  -> testing
  -> time
  -> container/heap (for timerHeap)

Occasionally the linker would get mixed up, resulting in a test panic
in a very weird place.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4395042
2011-04-22 16:29:05 -04:00
Petar Maymounkov
f589728ff4 http: in ServerConn and ClientConn, rename Close to Hijack, add Close
R=rsc
CC=golang-dev
https://golang.org/cl/4372046
2011-04-22 15:56:27 -04:00
Adam Langley
361e4e5f64 crypto/rsa: add file that I forgot to add last time.
R=rsc
CC=golang-dev
https://golang.org/cl/4452041
2011-04-22 15:46:49 -04:00
Adam Langley
555685e26c crypto/rsa: support > 3 primes.
With full multi-prime support we can support version 1 PKCS#1 private
keys. This means exporting all the members of rsa.PrivateKey, thus
making the API a little messy. However there has already been another
request to export this so it seems to be something that's needed.

Over time, rsa.GenerateMultiPrimeKey will replace rsa.GenerateKey, but
I need to work on the prime balance first because we're no longer
generating primes which are a multiples of 8 bits.

Fixes #987.

R=rsc
CC=golang-dev
https://golang.org/cl/4378046
2011-04-22 15:33:41 -04:00
Russ Cox
781df132f9 runtime: stop deadlock test properly (fix arm5 build)
TBR=r
CC=golang-dev
https://golang.org/cl/4446058
2011-04-22 15:22:11 -04:00
Dave Cheney
d5864454dc syscall: fix Ftruncate under linux/arm5
Fixes #1714.

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4441056
2011-04-22 14:44:18 -04:00
Brad Fitzpatrick
c94db30ec9 http/cgi: pass some default environment variables
This isn't really part of RFC 3875 but matches
the behavior of Apache, et al.

R=iant, iant2
CC=golang-dev
https://golang.org/cl/4435065
2011-04-22 11:02:33 -07:00
Brad Fitzpatrick
4335bee42e os/user: new package to look up users
Only for Unix presently. Other operating systems
are stubbed out, as well as arm (lacks cgo).

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4440057
2011-04-22 09:30:30 -07:00
Brad Fitzpatrick
81cfb4ec2b http: fix FileServer's default text content type
Fixes #1729

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4443057
2011-04-22 09:09:37 -07:00
Ian Lance Taylor
75ca6d189c http/cgi: copy some PATH environment variables to child
R=bradfitz, bradfitzwork, iant2, bradfitzgo
CC=golang-dev
https://golang.org/cl/4444058
2011-04-22 08:53:52 -07:00
Alex Brainman
59c18b0b36 os: Open with O_APPEND|O_CREATE to append to the end of file on Windows
Credit for the fix goes to Hector, test by PeterGo.

Fixes #1655.

R=golang-dev, rsc1, peterGo
CC=golang-dev, hector
https://golang.org/cl/4436051
2011-04-22 15:31:25 +10:00
Brad Fitzpatrick
8d6a12f570 http: clarify docs on Request HTTP version
Fixes #910

R=adg, rsc1
CC=golang-dev
https://golang.org/cl/4439062
2011-04-21 19:57:19 -07:00
Brad Fitzpatrick
750b6c63f9 http: close underlying gzip Reader too
Fixes #1724

R=rsc
CC=golang-dev
https://golang.org/cl/4443056
2011-04-21 16:01:29 -07:00
Brad Fitzpatrick
a1f5f3f109 xml: Parser hook for non-UTF-8 charset converters
Adds an optional hook to Parser to let charset
converters step in when a processing directive
with a non-UTF-8 encoding is specified.

(Open to alternative proposals too...)

R=rsc
CC=golang-dev
https://golang.org/cl/4437061
2011-04-21 14:37:26 -07:00
Lucio De Re
f367c13c79 8l/prof.c: #if 0 is not accepted by the Plan 9 native toolchain.
The solution may be a bit of a sledgehammer, but it looks like
a temporary situation anyway.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4400042
2011-04-21 17:03:58 -04:00
Albert Strasheim
10d1680efb cgo: avoid "incompatible pointer type" warning
R=rsc
CC=golang-dev
https://golang.org/cl/4409041
2011-04-21 17:02:52 -04:00
Mikio Hara
380f4ab2ff syscall: add BPF support for darwin/386, darwin/amd64
note: due to issue 1466 the Msghdr and BpfProgram
struct for src/pkg/syscall/ztypes_darwin_386.go,
src/pkg/syscall/ztypes_darwin_amd64.go had to be
edited after the godefs generation.

R=rsc
CC=golang-dev
https://golang.org/cl/4403042
2011-04-21 16:58:20 -04:00
Brad Fitzpatrick
ee154f5df5 mime/multipart: limit line length to prevent abuse
Fixes #1528

R=rsc
CC=golang-dev
https://golang.org/cl/4425060
2011-04-21 10:45:49 -07:00
Quan Yong Zhai
256df10eae gc: fix copy([]int, string) error message
R=rsc
CC=golang-dev
https://golang.org/cl/4433064
2011-04-21 12:09:29 -04:00
Dmitriy Vyukov
29d78f1243 runtime: fix GOMAXPROCS vs garbage collection bug
Fixes #1715.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4434053
2011-04-21 12:09:25 -04:00
Ian Lance Taylor
1f09cc25a1 runtime: skip functions with no lines when building src line table
Avoid getting out of synch when a function, such as main.init,
has no associated line number information.  Without this the
function before main.init can skip the PC all the way to the
next function, which will cause the next function's line table
to be associated with main.init, and leave subsequent
functions with the wrong line numbers.

R=rsc
CC=golang-dev
https://golang.org/cl/4426055
2011-04-21 08:32:58 -07:00
Albert Strasheim
946a4ea0e3 syscall: Madvise and Mprotect for Linux.
R=rsc
CC=golang-dev
https://golang.org/cl/4369047
2011-04-21 10:23:11 -04:00
Dmitry Chestnykh
a260de44e9 net: try /etc/hosts before loading DNS config.
On Mac X 10.6 /etc/resolv.conf is changed dynamically,
and may not exist at all when all network connections
are turned off, thus any lookup, even for "localhost"
would fail with "error reading DNS config: open
/etc/resolv.conf: no such file or directory". This
change avoids the error by trying to lookup addresses
in /etc/hosts before loading DNS config.

R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4431054
2011-04-21 10:23:03 -04:00
Mikio Hara
338b7abdfc net: fix EAI_BADFLAGS error on freebsd
R=rsc
CC=golang-dev
https://golang.org/cl/4442072
2011-04-21 10:22:53 -04:00
Vincent Vanackere
1f59004511 syscall : add a field to ProcAttr so that StartProcess can hide the executed application on windows
The SW_HIDE parameter looks like the only way for a windows GUI application to execute a CLI subcommand without having a shell windows appearing.

R=brainman, golang-dev, bradfitzgo, rsc1
CC=golang-dev
https://golang.org/cl/4439055
2011-04-22 00:12:06 +10:00
Russ Cox
f10a7882c6 gc: another pointer to interface message
R=ken2
CC=golang-dev
https://golang.org/cl/4444056
2011-04-21 08:20:29 -04:00
Russ Cox
5ff3336490 gc: correct handling of unexported method names in embedded interfaces
go/types: update for export data format change
reflect: require package qualifiers to match during interface check
runtime: require package qualifiers to match during interface check
test: fixed bug324, adapt to be silent

Fixes #1550.
Issue 1536 remains open.

R=gri, ken2, r
CC=golang-dev
https://golang.org/cl/4442071
2011-04-21 08:14:50 -04:00
Alex Brainman
5aad514674 syscall: correct Windows CreateProcess input parameters
Fixes #1718.

R=golang-dev, rsc, peterGo, r
CC=golang-dev
https://golang.org/cl/4435059
2011-04-21 10:36:27 +10:00
Russ Cox
98cf39e270 run.bash: remove redundant rebuilds
R=r
CC=golang-dev
https://golang.org/cl/4449041
2011-04-20 18:19:22 -04:00
Rob Pike
c4cc9c282f gob: have errorf always prefix the message with "gob: "
to regularize the errors.

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4443053
2011-04-20 13:53:34 -07:00
Russ Cox
047e698c52 ld: remove MachoLoad limit
Fixes #1571.

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

Before this CL, reflect required strict type identity.

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

Fixes #327.
Fixes #1212.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4439058
2011-04-20 16:24:45 -04:00
Russ Cox
ec735c4ec8 gc: fix error for +string
Fixes #1710.

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

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

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

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

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

R=r
CC=golang-dev
https://golang.org/cl/4442066
2011-04-20 15:04:04 -04:00
Robert Griesemer
7412583e89 gofix, gofmt: update documentation
gofmt: also fix a typo in gofmt.go

R=rsc, r
CC=golang-dev
https://golang.org/cl/4431055
2011-04-20 11:01:21 -07:00
David Crawshaw
123e89fef1 gofmt: add -diff
Some code duplication with gofix.

R=rsc, gri, bradfitzgo, r2, adg, peterGo, r, brainman
CC=golang-dev
https://golang.org/cl/4430054
2011-04-20 10:07:56 -07:00
Andrew Gerrand
aaa6ce2301 goinstall: support building executable commands
This CL gives goinstall the ability to build commands,
not just packages.

"goinstall foo.googlecode.com/hg/bar" will build the command named
"bar" and install it to GOBIN. "goinstall ." will use the name of the
local directory as the command name.

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

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

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

TBR=bradfitzgo

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

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

R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4435051
2011-04-19 11:00:47 +10:00
Russ Cox
3bac16a6bf reflect: allow Slice of arrays
R=r
CC=golang-dev
https://golang.org/cl/4444049
2011-04-18 20:00:42 -04:00
Russ Cox
b331f3cfd0 5c: make alignment rules match 5g, just like 6c matches 6g
I should have done this a year ago in:

        changeset:   5137:686b18098944
        user:        Russ Cox <rsc@golang.org>
        date:        Thu Mar 25 14:05:54 2010 -0700
        files:       src/cmd/8c/swt.c
        description:
        make alignment rules match 8g, just like 6c matches 6g.

        R=ken2
        CC=golang-dev
        https://golang.org/cl/760042

R=ken2
CC=golang-dev
https://golang.org/cl/4437054
2011-04-18 18:50:31 -04:00
Russ Cox
857f17d346 http: fix IP confusion in TestServerTimeouts
Don't assume that localhost == 127.0.0.1.
It might be ::1.

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

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

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

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

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

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

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

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

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

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

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

as illegal as

       0 = 42.

It would also make this illegal:

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

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

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

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

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

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

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

which, when the API changed, turned into:

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

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

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

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

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

       v := reflect.NewValue(x)

into

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

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

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

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

R=rsc, r
CC=golang-dev
https://golang.org/cl/4437052
2011-04-18 10:59:39 -07:00
Russ Cox
beb64bbd6e gc: fix complex move again
R=ken2
CC=golang-dev
https://golang.org/cl/4443047
2011-04-18 13:22:31 -04:00
Quan Yong Zhai
f80f97a351 net: fix dialgoogle_test.go
~$ nslookup www.google.com
Server: 8.8.8.8
cannonical name = www-g-com-chn.l.google.com.

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

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

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

R=r
CC=golang-dev
https://golang.org/cl/4430049
2011-04-15 16:33:52 -07:00
Russ Cox
3d36a81fcc undo 4439044
cannot use regalloc with floating point on 386.
will redo some other way.

R=ken2
CC=golang-dev
https://golang.org/cl/4439045
2011-04-15 19:17:16 -04:00
Ross Light
bfb486875a compress/zlib: add FDICT flag in Reader/Writer
R=bradfitzgo, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406046
2011-04-15 15:32:03 -07:00
Russ Cox
a12d70f60d gc: fix complex move bug
R=ken2
CC=golang-dev
https://golang.org/cl/4439044
2011-04-15 16:16:33 -04:00
Russ Cox
de5616fbb4 gc: print of unsafe.Pointer
Got lost when I introduced TUNSAFEPTR.

R=ken2
CC=golang-dev
https://golang.org/cl/4442046
2011-04-15 16:16:20 -04:00
Ian Lance Taylor
4c137b6162 5g: correct size of reg array.
Found by gcc 4.5.2 -Werror build reported on IRC by niemeyer.

R=ken2, rsc, r2
CC=golang-dev
https://golang.org/cl/4438042
2011-04-15 13:09:57 -07:00
Brad Fitzpatrick
4787e70b7b http: handler timeout support
Fixes #213

R=r, rsc
CC=golang-dev
https://golang.org/cl/4432043
2011-04-15 12:53:32 -07:00
Rob Pike
07dc26f88d 6l: fix another "set and not used".
R=rsc
CC=golang-dev
https://golang.org/cl/4433042
2011-04-15 08:31:32 -07:00
Russ Cox
b7065c5da4 net: disable one more external network test
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4442042
2011-04-15 11:21:29 -04:00
Brad Fitzpatrick
9b8d4e0977 json: keep track of error offset in SyntaxError
R=rsc
CC=golang-dev
https://golang.org/cl/4430043
2011-04-15 08:14:34 -07:00
Brad Fitzpatrick
e806565626 http: reverse proxy handler
R=rsc, petar-m
CC=golang-dev
https://golang.org/cl/4428041
2011-04-15 08:13:52 -07:00
Russ Cox
db7a2024f9 gc: printing of multiple assignment
R=ken2
CC=golang-dev
https://golang.org/cl/4429043
2011-04-15 10:34:55 -04:00
Ian Lance Taylor
a696da10e0 gob: when decoding a string, allocate a string, not a []byte.
R=r, r2
CC=golang-dev
https://golang.org/cl/4430042
2011-04-15 06:49:39 -07:00
Lorenzo Stoakes
bdcc0437f6 make: prevent rm provoking 'text file busy' errors.
Trivial patch to stop intermediate rm'ing of binaries stopping build.

R=rsc1, bradfitzgo, rsc
CC=golang-dev
https://golang.org/cl/4412045
2011-04-15 08:25:44 -04:00
Russ Cox
4c9634fc5b build: remove DISABLE_NET_TESTS
Don't use external network during all.bash.

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

Fixes #1684.

R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/4410041
2011-04-15 01:21:18 -07:00
Russ Cox
6ca71fb897 os: turn EPIPE exit into panic
R=iant, r2
CC=golang-dev
https://golang.org/cl/4427042
2011-04-15 00:01:29 -04:00
Dave Cheney
29cf90a4ef libmach: fix warnings.
Fixes #1706.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4413051
2011-04-14 23:58:08 -04:00
Quan Yong Zhai
c09af6631f net: fix ParseIP
Fixes #1695.

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

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

R=rsc, petar-m, r
CC=golang-dev
https://golang.org/cl/4406047
2011-04-14 20:36:52 -07:00
Russ Cox
89fc2c8f4f gopack: fix prefix bug
When prefix doesn't match, was deleting entire .6 file.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4427041
2011-04-14 23:34:14 -04:00
Rob Pike
c94f5fb0ba gob: fix handling of indirect receivers for GobDecoders.
The previous code was just wrong. Let's not talk about it.
Passes iant's new test.

R=rsc, iant, iant2
CC=golang-dev
https://golang.org/cl/4396053
2011-04-14 17:26:12 -07:00
Ian Lance Taylor
17bd39e7d9 gob: test case for indirection to large field.
R=r
CC=golang-dev
https://golang.org/cl/4404048
2011-04-14 17:16:26 -07:00
Robert Griesemer
604c161e32 gofmt: exclude test case that doesn't compile w/o errors
R=r, r2
CC=golang-dev
https://golang.org/cl/4398048
2011-04-14 17:06:38 -07:00
Robert Griesemer
c78cddd7de gofmt: gofmt test harness bug fix
Don't use the rewrite rule from a previous test
for the next test if there is no rewrite rule
provided.

R=r, r2
CC=golang-dev
https://golang.org/cl/4419045
2011-04-14 16:33:29 -07:00
Petar Maymounkov
8b35293070 http: don't quote Set-Cookie Domain and Path
Fixes #1659

R=rsc, bradfitzgo, bradfitzwork
CC=bradfitz, golang-dev
https://golang.org/cl/4368052
2011-04-14 15:05:02 -07:00
Robert Griesemer
a49e7f393f gofmt: don't crash when rewriting nil interfaces in AST.
The new reflection API makes it an error to call value.Set(x)
if x is invalid. Guard for it.

Added corresponding test case.

Fixes #1696.

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

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

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

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4419042
2011-04-14 10:40:23 -07:00
Brad Fitzpatrick
e0533b044d http: fix race in transport_test
R=rsc
CC=golang-dev
https://golang.org/cl/4414044
2011-04-14 09:07:20 -07:00
Russ Cox
3441bda959 gotest: add timing, respect $GOARCH
R=r, r2
CC=golang-dev
https://golang.org/cl/4370049
2011-04-14 10:59:33 -04:00
Russ Cox
bd43a2d9ff ld: defend against some broken object files
Fixes #1698.
Fixes #1699.

R=ken2
CC=golang-dev
https://golang.org/cl/4419041
2011-04-14 10:42:48 -04:00
Russ Cox
36713a2a53 compress/flate: dictionary support
R=bradfitzwork
CC=golang-dev
https://golang.org/cl/4397043
2011-04-14 10:41:55 -04:00
Russ Cox
bd77eedacf gc: fix use of typekind array in error messages
Fixes #1697.

R=ken2
CC=golang-dev
https://golang.org/cl/4395045
2011-04-14 09:33:53 -04:00
Luuk van Dijk
dd93df35b9 runtime: fix gdb support for channels.
R=rsc
CC=golang-dev
https://golang.org/cl/4418043
2011-04-14 15:32:20 +02:00
Dave Cheney
9c3ecb3617 runtime: fix set and not used in chan.c
R=rsc
CC=golang-dev
https://golang.org/cl/4416042
2011-04-14 08:16:40 -04:00
Rob Pike
2fca1a4049 lib9/create.c: delete unused variable
fixes build with GCC4.6

R=adg
CC=golang-dev
https://golang.org/cl/4396048
2011-04-13 23:12:48 -07:00
Russ Cox
507df959e4 runtime: drop chan circular linked list in favor of circular buffer
The list elements are already being allocated out of a
single memory buffer.  We can drop the Link* pointer
following and the memory it requires, replacing it with
index operations.

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

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

Fixes #1676.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4411045
2011-04-13 23:42:06 -04:00
Russ Cox
4c006182dc pkg: manual cleanup of some gofixed code
R=golang-dev, niemeyer, r
CC=golang-dev
https://golang.org/cl/4372052
2011-04-13 23:36:00 -04:00
Russ Cox
017e73c1b2 gc: fix func syntax error
Fixes #1685.

R=ken2
CC=golang-dev
https://golang.org/cl/4414042
2011-04-13 22:48:21 -04:00
Corey Thomasson
785fbd94fd net: sort records returned by LookupMX
R=rog, adg, rsc
CC=golang-dev
https://golang.org/cl/4388048
2011-04-14 10:30:56 +10:00
Rob Pike
bb855f985a govet: make name-matching for printf etc. case-insensitive.
Update goyacc, cgo to be more canonical in their naming and silence the new warnings.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4417042
2011-04-13 16:57:44 -07:00
Nigel Tao
4c60569e7c image: allow "?" wildcards when registering image formats.
R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4404041
2011-04-14 09:56:42 +10:00
Robert Griesemer
a2e286828b gofmt: gofmt -s -w src misc
R=r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406044
2011-04-13 15:13:59 -07:00
Rob Pike
179f0b8a07 libmach: fix the windows build.
Newly enabled compiler errors need workaround.

R=rsc
CC=golang-dev
https://golang.org/cl/4397047
2011-04-13 14:57:47 -07:00
Robert Griesemer
5666ec8735 fix build: disable gofmt test script, enable gotest testing instead
R=rsc
CC=golang-dev
https://golang.org/cl/4403045
2011-04-13 14:24:38 -07:00
Brad Fitzpatrick
c7d16cc411 http: flesh out server Expect handling + tests
This mostly adds Expect 100-continue tests (from
the perspective of server correctness) that were
missing before.

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

Proper 100-continue client support remains a TODO.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4399044
2011-04-13 14:09:04 -07:00
Robert Griesemer
99f069a97f gofmt: add test framework in Go
- replaced existing testdata/test.sh with new gofmt_test
- added initial test case for rewrite tests

TODO: Need to add more tests.

R=rsc
CC=golang-dev
https://golang.org/cl/4368063
2011-04-13 13:59:59 -07:00
Robert Griesemer
3d4b55ad5b gofmt: minor refactor to permit easy testing
R=rsc
CC=golang-dev
https://golang.org/cl/4397046
2011-04-13 13:57:53 -07:00
Russ Cox
7b6ee1a5d4 reflect: inline method implementations
This CL is only cut-and-paste, moving code around.
Moving it in a separate CL should simplify the diffs in later CLs.

There are three patterns here.

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

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

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

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

R=r
CC=golang-dev
https://golang.org/cl/4398044
2011-04-13 16:55:20 -04:00
Rob Pike
e6cf42c39a gofix: fix embarrassing typo in osopen.go
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4411044
2011-04-13 13:49:24 -07:00
Russ Cox
4c5dd0e1ee libmach: fix freebsd compiler errors
TBR=r
CC=golang-dev
https://golang.org/cl/4396045
2011-04-13 16:26:25 -04:00
Russ Cox
1499c78281 build: tidy intermediate files during build
This CL changes the behavior of 'make install' and 'make test'
in the src/cmd directory and the src/pkg directory to have
each recursive make clean up after itself immediately.

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

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

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

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

R=golang-dev, r, iant2
CC=golang-dev
https://golang.org/cl/4413042
2011-04-13 16:24:57 -04:00
Russ Cox
1d26908d3f build: use gcc -Werror
Better to fix the warnings that we find.

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

R=rsc, rog, peterGo
CC=golang-dev
https://golang.org/cl/4389046
2011-04-13 15:12:28 -04:00
Brad Fitzpatrick
0be2ef3fc4 io: clarify that ReadAt shouldn't move the seek offset
R=r, mkrautz, r2, rsc
CC=golang-dev
https://golang.org/cl/4415041
2011-04-13 11:18:38 -07:00
Robert Griesemer
a5ca635287 gofmt: avoid endless loops
With the (partial) resolution of identifiers done
by the go/parser, ast.Objects point may introduce
cycles in the AST. Don't follow *ast.Objects, and
replace them with nil instead (they are likely
incorrect after a rewrite anyway).

- minor manual cleanups after reflect change automatic rewrite
- includes fix by rsc related to reflect change

Fixes #1667.

R=rsc
CC=golang-dev
https://golang.org/cl/4387044
2011-04-13 09:38:13 -07:00
Robert Griesemer
7c270aef08 go/ast: fixed bug in NotNilFilter, added test
- fixed a couple of comments
- cleanups after reflect change

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

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

R=golang-dev, lucio, r
CC=golang-dev
https://golang.org/cl/4381048
2011-04-12 16:58:56 -07:00
Lucio De Re
36b6d1aaf2 8l: correct Plan 9 compiler warnings
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4390047
2011-04-12 16:21:01 -04:00
Rob Pike
4fe9f57413 fmt: allow %U for unsigned integers.
Suggested by jan.mercl@nic.cz.

R=rsc, jnml
CC=golang-dev
https://golang.org/cl/4376054
2011-04-12 11:03:05 -07:00
Lucio De Re
11e07d23ed ld: ELF header function declarations.
Added "void" inside "()" for two functions.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4381056
2011-04-12 11:00:09 -07:00
Brad Fitzpatrick
92210eefb2 http: client gzip support
R=adg, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4389048
2011-04-12 09:35:07 -07:00
Gustavo Niemeyer
c34aadf063 openpgp: Fix improper := shadowing
R=golang-dev, agl1, jnml
CC=golang-dev
https://golang.org/cl/4381058
2011-04-12 11:48:05 -03:00
Nigel Tao
ce89a233a2 image/ycbcr: new package.
R=r, rsc, nigeltao_gnome
CC=golang-dev, raph
https://golang.org/cl/4374043
2011-04-12 22:32:03 +10:00
Nigel Tao
420a17e371 net: fix laddr typo in test code.
R=rsc
CC=golang-dev
https://golang.org/cl/4381050
2011-04-12 10:36:41 +10:00
Luuk van Dijk
0cc055e8f7 ld: fix dwarf decoding of strings for struct's fieldnames
Moved Sym printing to Yconv.
Fixed warning in data.c

R=rsc
CC=golang-dev
https://golang.org/cl/4378052
2011-04-11 16:38:37 -04:00
Robert Hencke
d36271a3e5 http: fix incorrect prints found by govet
R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4370053
2011-04-11 13:05:08 -07:00
Fazlul Shahriar
8c1a703560 syscall: fix StartProcess in Plan 9
This makes os_test.TestStartProcess test from os package pass.

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

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

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

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4372047
2011-04-10 11:23:23 +10:00
Russ Cox
1bc84b7e18 ld: 25% faster
The ld time was dominated by symbol table processing, so
  * increase hash table size
  * emit fewer symbols in gc (just 1 per string, 1 per type)
  * add read-only lookup to avoid creating spurious symbols
  * add linked list to speed whole-table traversals

Breaks dwarf generator (no idea why), so disable dwarf.

Reduces time for 6l to link godoc by 25%.

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

gofmt -w src misc (no changes)

Fixes #1673.

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

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4382044
2011-04-08 15:43:19 -04:00
Russ Cox
23f6479be6 8g: optimize byte mov
Rewrite MOVB with less expensive
instruction when possible.

Suggested by atomic symbol.

benchmark                                        old ns/op    new ns/op    delta
crc32.BenchmarkCrc32KB                               13066         3942  -69.83%
crc64.BenchmarkCrc64KB                                8780         5949  -32.24%
lzw.BenchmarkDecoder1e4                             771224       636538  -17.46%
lzw.BenchmarkDecoder1e5                            7101218      6096634  -14.15%
lzw.BenchmarkDecoder1e6                           69762020     60789400  -12.86%
lzw.BenchmarkEncoder1e4                             707968       638812   -9.77%
lzw.BenchmarkEncoder1e5                            6567122      5965552   -9.16%
lzw.BenchmarkEncoder1e6                           65006000     58911680   -9.38%
utf8_test.BenchmarkRuneCountTenASCIIChars              166          165   -0.60%
utf8_test.BenchmarkRuneCountTenJapaneseChars           246          258   +4.88%
utf8_test.BenchmarkEncodeASCIIRune                      13           10  -23.08%
utf8_test.BenchmarkEncodeJapaneseRune                   37           16  -56.76%
utf8_test.BenchmarkDecodeASCIIRune                      23           21   -8.70%
utf8_test.BenchmarkDecodeJapaneseRune                   58           32  -44.83%

R=ken2
CC=golang-dev
https://golang.org/cl/4381045
2011-04-08 13:53:59 -04:00
Russ Cox
e7c4a6dfca gc: fix weird error message
Fixes #1670.

R=ken2
CC=golang-dev
https://golang.org/cl/4386045
2011-04-08 13:53:32 -04:00
Robert Hencke
8dc0ba7ae5 io: fixes for Read with n > 0, os.EOF
R=rsc
CC=golang-dev
https://golang.org/cl/4271080
2011-04-08 13:45:56 -04:00
Russ Cox
d26e73646e ld: fix arm build
R=ken2
CC=golang-dev, mikkel
https://golang.org/cl/4384048
2011-04-08 13:42:11 -04:00
Russ Cox
e6e2eb5807 http: do not listen on 0.0.0.0 during test
Quiets the pop-up boxes on OS X.

R=bradfitzgo, r2
CC=golang-dev
https://golang.org/cl/4387042
2011-04-08 13:04:29 -04:00
Rob Pike
ddd0fa1744 gotest: Fix fix for \r\n on windows.
R=rsc, brainman, rh, r2
CC=golang-dev
https://golang.org/cl/4366045
2011-04-08 09:50:20 -07:00
Russ Cox
db5c5d6fa6 update go tree for reflect changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4353043
2011-04-08 12:27:58 -04:00
Russ Cox
fb94eb1922 gofix: reflect changes
R=gri
CC=golang-dev
https://golang.org/cl/4343047
2011-04-08 12:27:24 -04:00
Russ Cox
877c1892bb gofix: add -diff, various fixes and helpers
* add -diff command line option
  * use scoping information in refersTo, isPkgDot, isPtrPkgDot.
  * add new scoping-based helpers countUses, rewriteUses, assignsTo, isTopName.
  * rename rewrite to walk, add walkBeforeAfter.
  * add toy typechecker, a placeholder for go/types

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

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

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

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

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

           OLD                          NEW

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

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

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

R=gri, iant, niemeyer, r, rog, gustavo, r2
CC=golang-dev
https://golang.org/cl/4281055
2011-04-08 12:26:51 -04:00
Russ Cox
846a368b88 gofix: be more conservative about rewrite to os.Create
Rewrite only if we understood all the flags we saw.

R=r
CC=golang-dev
https://golang.org/cl/4376046
2011-04-08 10:59:25 -04:00
Alex Brainman
d976314776 gotest: handle \r\n returned by gomake on Windows (fixes build)
R=golang-dev, peterGo, rsc1
CC=Joe Poirier, golang-dev
https://golang.org/cl/4370048
2011-04-08 23:53:57 +10:00
Robert Griesemer
0ada4a2d62 go/types: fix build: use the right compiler to compile test case
R=rsc
CC=golang-dev
https://golang.org/cl/4369050
2011-04-07 22:10:39 -07:00
Robert Griesemer
1baffa7da0 gotype: use go/types GcImporter
R=rsc
CC=golang-dev
https://golang.org/cl/4358043
2011-04-07 21:42:30 -07:00
Robert Griesemer
a87382e7b3 go/types: New Go type hierarchy implementation for AST.
This CL defines a new, more Go-like representation of
Go types (different structs for different types as
opposed to a single Type node). It also implements
an ast.Importer for object/archive files generated
by the gc compiler tool chain. Besides the individual
type structs, the main difference is the handling of
named types: In the old world, a named type had a
non-nil *Object pointer but otherwise looked no
different from other types. In this new model, named
types have their own representation types.Name. As
a result, resolving cycles is a bit simpler during
construction, at the cost of having to deal with
types.Name nodes explicitly later. It remains to be
seen if this is a good approach. Nevertheless, code
involving types reads more nicely and benefits from
full type checking. Also, the representation seems
to more closely match the spec wording.

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

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

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

R=eds, rog, rsc
CC=golang-dev
https://golang.org/cl/4314054
2011-04-07 21:40:37 -07:00
Robert Griesemer
70bf4215e9 scanner: better TokenString output
R=rsc
CC=golang-dev
https://golang.org/cl/4373048
2011-04-07 19:41:55 -07:00
Alex Brainman
776fd72579 test/bench: enable build and test on Windows
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4366043
2011-04-08 10:43:25 +10:00
Alex Brainman
2683c76d95 misc/cgo/life: enable build and test on Windows
R=golang-dev, rsc1
CC=golang-dev, vcc
https://golang.org/cl/4374044
2011-04-08 10:35:35 +10:00
Alex Brainman
d3cd0c0752 syscall: fix Windows Signalled
Thanks to fhs.

R=golang-dev, r2
CC=ality, fhs, golang-dev
https://golang.org/cl/4375044
2011-04-08 10:27:47 +10:00
Russ Cox
35c880b1e2 gc: bug327
Fixes #1674.

R=ken2
CC=golang-dev
https://golang.org/cl/4368057
2011-04-07 18:53:47 -04:00
Russ Cox
62c24811e7 syscall: fix freebsd/386 again
TBR=r
CC=golang-dev
https://golang.org/cl/4380042
2011-04-07 15:44:10 -04:00
Russ Cox
62049366e7 syscall: freebsd/386 Syscall9 (fix build)
R=r
CC=golang-dev
https://golang.org/cl/4386042
2011-04-07 15:35:04 -04:00
Mikio Hara
c54ed66c75 syscall: fix build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4368050
2011-04-07 12:03:45 -07:00
Mikkel Krautz
2aceea630f ld: fix Mach-O X86_64_RELOC_SIGNED relocations
Fixes #1658.

R=rsc
CC=golang-dev
https://golang.org/cl/4344066
2011-04-07 14:20:42 -04:00
Mikkel Krautz
cf3323f511 ld: fix Mach-O bss bug
Fixes #1559.

R=rsc
CC=golang-dev, peterGo, rog
https://golang.org/cl/4356046
2011-04-07 13:17:28 -04:00
Dave Cheney
b3a4d58ba8 syscall: fix typo in mmap comment
R=rsc
CC=golang-dev
https://golang.org/cl/4377043
2011-04-06 23:07:32 -04:00
Russ Cox
48ae1f2d9b syscall: add Mmap, Munmap on Linux, FreeBSD, OS X
* tweak mksyscall*.pl to be more gofmt-compatible.
* add mkall.sh -syscalls option.
* add sys/mman.h constants on OS X

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

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

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

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

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

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

This should have no effect on existing code.

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

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

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

R=golang-dev, r, rsc1
CC=golang-dev
https://golang.org/cl/4348053
2011-04-05 18:07:01 -04:00
Dmitry Chestnykh
9f1394d270 crypto/ecdsa, crypto/rsa: use io.ReadFull to read from random source.
R=golang-dev, agl1
CC=golang-dev
https://golang.org/cl/4316057
2011-04-05 17:11:31 -04:00
Rob Pike
63e28ae4ab gotest: fix windows build.
R=rsc
CC=golang-dev
https://golang.org/cl/4339055
2011-04-05 13:51:49 -07:00
Rob Pike
88a8ac08b9 gotest: fix a bug in error handling.
If the command couldn't be found, argv[0] would be wiped.
Also, fix a print statement not to refer to make - it was a vestige of a prior form.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4360048
2011-04-05 12:51:10 -07:00
Adam Langley
906b2e7679 crypto/des: cleanups
R=rsc
CC=golang-dev
https://golang.org/cl/4315050
2011-04-05 15:40:48 -04:00
Adam Langley
2db1769d7b crypto/block: remove deprecated package.
R=rsc
CC=golang-dev
https://golang.org/cl/4315051
2011-04-05 15:23:40 -04:00
Peter Mundy
b2bf14acd9 gotest: fixes for [^.]_test file pattern
R=rsc, r
CC=golang-dev
https://golang.org/cl/4339054
2011-04-05 11:49:44 -07:00
Russ Cox
de3aac609c gofix: don't rewrite O_APPEND opens
R=r, rog
CC=golang-dev
https://golang.org/cl/4364041
2011-04-05 11:12:02 -04:00
Yasuhiro Matsumoto
7098f3d442 crypto/des: new package providing implementations of DES and TDEA
Original code by Chris Lennert <cale...@gmail.com>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #1660

R=r
CC=golang-dev
https://golang.org/cl/4358049
2011-04-04 08:10:26 -07:00
Andrew Gerrand
0f46aaf8b3 version.bash: strip changeset hash from 'hg tags' output
Fixes #1651.

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

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4355042
2011-04-01 09:58:05 -07:00
Alex Brainman
799be52b35 gotest: another attempt to make it run on Windows
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4347041
2011-04-01 13:38:33 +11:00
Alex Brainman
6c651728d8 gotest: execute gomake properly on Windows
R=peterGo, rsc, Joe Poirier
CC=golang-dev
https://golang.org/cl/4280087
2011-04-01 10:10:15 +11:00
Ian Lance Taylor
554082d6b1 testing: add -test.timeout option.
Since Go code can deadlock, this lets a testsuite driver set a
time limit for the test to run.  This is simple but imperfect,
in that it only catches deadlocks in Go code, not in the
runtime scheduler.

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

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

R=brainman, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4300045
2011-03-31 15:16:18 +11:00
Rob Pike
7d77e3117c gotest: another try at flags.
doc.go contains the details. The short story:
- command line is passed to the binary
- a new flag, -file, is needed to name files
- known flags have the "test." prefix added for convenience.
- gotest-specific flags are trimmed from the command line.

The effect should be that most existing uses are unaffected,
the ability to name files is still present, and it's nicer to use.
The downside is a lot more code in gotest.

Also allow a test to be called just Test.

R=rsc, niemeyer, rog, r2
CC=golang-dev
https://golang.org/cl/4307049
2011-03-30 21:14:49 -07:00
Russ Cox
5a7a074261 gopack: comment out debugging print
TBR=r
CC=golang-dev
https://golang.org/cl/4333048
2011-03-30 22:41:32 -04:00
Russ Cox
3d2e57a312 gopack: add P flag to remove prefix from filename information
R=r, r2
CC=golang-dev
https://golang.org/cl/4307047
2011-03-30 22:19:02 -04:00
Russ Cox
b66b22cdd4 fmt: remove uintptrGetter type checks
This will make the fmt code easier to gofix
when the new reflect interface is ready.

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

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

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

- permit line comments to end in EOF

R=r
CC=golang-dev
https://golang.org/cl/4277089
2011-03-30 15:26:53 -07:00
Robert Griesemer
61aaadf217 gotest: exclude . files when parsing directories (per r's suggestion)
R=r, rsc1, iant2
CC=golang-dev
https://golang.org/cl/4329044
2011-03-30 09:46:11 -07:00
Roger Peppe
dba96cf411 go/parser: fix scoping for local type declarations
R=gri
CC=golang-dev
https://golang.org/cl/4332045
2011-03-30 09:45:51 -07:00
Andrew Gerrand
6b567d26b7 godoc: remove errant space in HTML tag
R=gri
CC=golang-dev
https://golang.org/cl/4277087
2011-03-30 16:41:41 +11:00
Robert Griesemer
1afc37fa7e go/printer/gofmt: remove special case for multi-line raw strings
As a special case, multi-line raw strings (i.e., strings in `` quotes)
were not indented if they were the only token on a line. This heuristic
was meant to improve formatting for multi-line raw strings where sub-
sequent lines are not indented at the level of the surrounding code.
Multiple people have complained about this. Removing the heuristic
again because it makes the formatting more regular, easier to under-
stand, and simplifies the implementation.

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

Fixes #1643.

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4323044
2011-03-29 13:29:20 -07:00
Rob Pike
518c0adb17 govet: fix bug introduced at 4313054
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4336042
2011-03-29 13:18:52 -07:00
Rob Pike
f61b7e5dc5 gotry: move into its own directory, separate from gotest.
R=rsc
CC=golang-dev
https://golang.org/cl/4327045
2011-03-29 13:00:24 -07:00
Rob Pike
62ed6ee6c4 ngotest: correctly handle packages with tests outside the package.
R=rsc
CC=golang-dev
https://golang.org/cl/4330043
2011-03-29 12:50:41 -07:00
Adam Langley
9225bbfc0c crypto/cipher: bad CTR IV length now triggers panic
R=rsc
CC=golang-dev
https://golang.org/cl/4326042
2011-03-29 15:47:35 -04:00
Albert Strasheim
d41d6fec10 syscall: StartProcess Chroot and Credential.
R=rsc, iant, agl1
CC=golang-dev
https://golang.org/cl/4280065
2011-03-29 14:29:22 -04:00
Alexey Borzenkov
0793176451 net: move bind back to sock.go
It was left in netFD.connect() by an oversight (as the name
implies, bind has no business being in connect). As a result
of this change and by only calling netFD.connect() when ra
isn't nil it becomes simpler with less code duplication.

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

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4331043
2011-03-29 10:41:23 -07:00
Rob Pike
e393efc499 ngotest: a new gotest command, written in Go.
It runs all tests correctly and saves significant time by avoiding the shell script.
However, this is just the code for the command, for review.
A separate CL will move this into the real gotest, which will take some dancing.

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

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

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

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

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

Drop cname return from LookupHost.

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

Preparations for implementing some of the
lookups using cgo.

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

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

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

Fixes #1632.

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

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

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

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

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

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

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

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4289075
2011-03-27 17:15:48 -04:00
Rob Pike
7f9acb53cb testing: shorten some more tests
R=rsc
CC=golang-dev
https://golang.org/cl/4314044
2011-03-26 11:25:22 -07:00
Robert Hencke
a4df525a79 gob: trivial cleanup
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279074
2011-03-25 20:45:21 -07:00
Ian Lance Taylor
2795b13156 gc: remove interim ... error which rejects valid code.
It's been six months.

R=rsc
CC=golang-dev
https://golang.org/cl/4289073
2011-03-25 18:31:55 -07:00
Rob Pike
f0cf7d296c testing: shorten some tests.
These are the top runners.  More to come.
Also print two digits of timing info under -test.v.

R=rsc
CC=golang-dev
https://golang.org/cl/4317044
2011-03-25 16:31:10 -07:00
Dave Cheney
d165dc6036 build: handle broken awk in version.bash
R=adg, rsc, ality
CC=golang-dev
https://golang.org/cl/4281069
2011-03-25 18:00:19 -04:00
Rob Pike
d406f8f650 testing: set up structure for faster testing using the new -test.short flag.
New make target "testshort" runs "gotest -test.short" and is invoked
by run.bash, which is invoked by all.bash.

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

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

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

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

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

/*
Filed as Apple Bug Report #9177434.

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

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

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

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

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

On those operating systems, this program prints:

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

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

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

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

*/

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

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

static pthread_t pmain, ploop;

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

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

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

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

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

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

        return 0;
}

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

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

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

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

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

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

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

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

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

No external API changes in this CL.

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

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

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4306041
2011-03-24 11:20:28 +11:00
Russ Cox
543acc97f9 testing: add -test.cpuprofile flag
R=r
CC=golang-dev
https://golang.org/cl/4272066
2011-03-23 18:17:14 -04:00
Luuk van Dijk
14b9032f84 5l/6l/8l: undo spadj cleanup at ARET for following instructions in the same stackframe.
5l was already correct, clarified comment and added diags for unmaintained code.

R=rsc
CC=golang-dev
https://golang.org/cl/4277070
2011-03-23 23:11:29 +01:00
Brad Fitzpatrick
9d3b39986c http: don't chunk 304 responses
rsc's earlier fix, plus tests.

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

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

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

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

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

R=rob
CC=golang-dev
https://golang.org/cl/4291064
2011-03-22 18:41:17 -07:00
Andrew Gerrand
005fe41125 godoc: add -template flag to specify custom templates
R=gri, niemeyer, rsc1
CC=golang-dev
https://golang.org/cl/4291059
2011-03-23 09:44:23 +11:00
Robert Griesemer
76061f7240 go/printer: Revert API change of CL 4274075.
Revert changes to printer.Config. Pass in the
nodeSizes map trough an internal helper function.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4309042
2011-03-22 14:14:26 -07:00
Ian Lance Taylor
bc0469da33 Make.pkg: Always define _CGO_CFLAGS and friends.
Submitting TBR to fix Darwin build.

TBR=rsc
CC=golang-dev
https://golang.org/cl/4273096
2011-03-22 13:30:16 -07:00
Ian Lance Taylor
f91b37b962 Make.pkg: add support for SWIG, and add two SWIG examples
The SWIG examples are not yet built or tested by default.

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

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

Fixes #1627.

R=rsc
CC=golang-dev
https://golang.org/cl/4303042
2011-03-22 11:05:26 -07:00
Russ Cox
1da382c871 gopprof: fix bug: do not rotate 180 degrees for large scrolls
R=r
CC=golang-dev
https://golang.org/cl/4273088
2011-03-22 02:04:59 -04:00
Andrew Gerrand
d4b19bdbed ld: return > 0 exit code on unsafe import
R=rsc
CC=golang-dev
https://golang.org/cl/4273092
2011-03-22 15:00:21 +11:00
Robert Griesemer
4a33d440b8 go/printer, gofmt: avoid exponential layout algorithm
Use memoization to avoid repeated recomputation of nested
node sizes. Speeds up testdata/slow.input by several orders
of magnitude.

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

Fixes #1628.

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

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

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

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4275060
2011-03-21 13:02:10 -07:00
Gustavo Niemeyer
2187f43e63 exec: document dir option for Run
R=golang-dev, bradfitzwork, rsc1, peterGo
CC=golang-dev
https://golang.org/cl/4271056
2011-03-21 11:25:00 -03:00
Gustavo Niemeyer
b889a9f941 build: reenable clean.bash without gomake
This change had already been made in revision 7371, but
was then undone with changes in revision 7606.

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4239064
2011-03-21 00:27:50 -03:00
Andrew Gerrand
f91e677e12 goinstall: add -clean flag to docs
Fixes #1629.

R=rsc
CC=golang-dev
https://golang.org/cl/4291057
2011-03-21 14:18:12 +11:00
Gustavo Niemeyer
126911dcd2 rpc: increase server_test timeout
These timeouts are breaking tests in very slow
systems every once in a while.  I've noticed
problems when compiling the Ubuntu packages for
arm, specifically.

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

R=rsc, bradfitzgo
CC=golang-dev
https://golang.org/cl/4287063
2011-03-21 11:24:48 +11:00
Fazlul Shahriar
19aecba1d5 flag: document Nflag function
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4279065
2011-03-20 11:45:43 -07:00
Russ Cox
893e02ab59 gopprof: update list of memory allocation functions
R=r, r2
CC=golang-dev
https://golang.org/cl/4275057
2011-03-18 20:55:21 -04:00
Russ Cox
eedfc445a3 build: diagnose Ubuntu's buggy copy of gold
R=iant, dsymonds
CC=golang-dev
https://golang.org/cl/4300041
2011-03-18 18:23:00 -04:00
Ian Lance Taylor
000d60ac6f net: Use preallocated buffer for kqueue/kevent.
R=rsc
CC=golang-dev
https://golang.org/cl/4293056
2011-03-18 12:48:12 -07:00
Robert Griesemer
3be0921e73 cgo: fix index-out-of-bounds bug
R=rsc
CC=golang-dev
https://golang.org/cl/4284057
2011-03-18 12:38:38 -07:00
Rob Pike
3a6c0990a4 rpc: keep free lists of Request and Response structures.
Also in the common case avoid unnecessary buffering in
the channel.
Removes 13 allocations per round trip. Now at 86, down from
144 a week ago.

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/4284056
2011-03-18 11:50:19 -07:00
Yasuhiro Matsumoto
8c4a2ae6f8 godoc: No need to use filepath.IsAbs()
R=golang-dev, brainman, gri
CC=golang-dev
https://golang.org/cl/4277062
2011-03-18 09:28:23 -07:00
Yasuhiro Matsumoto
b22e29d9bf godoc: fix path problem for windows.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4299044
2011-03-17 22:27:30 -07:00
Ken Thompson
61c83b6407 sinit.c: recursion in sinit
fixes #1617

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

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

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

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

R=rsc, iant2
CC=golang-dev
https://golang.org/cl/4272057
2011-03-17 13:42:40 -07:00