Brad Fitzpatrick [Wed, 16 Jun 2010 17:15:39 +0000 (10:15 -0700)]
http: reply to Expect 100-continue requests automatically
This CL replaces my earlier https://golang.org/cl/1640044/show
in which Continue handling was explicit. Instead, this CL makes
it automatic. Reading from Body() is an implicit acknowledgement
that the request headers were fine and the body is wanted. In that
case, the 100 Continue response is written automatically when the
request continues the "Expect: 100-continue" header.
Rob Pike [Wed, 16 Jun 2010 00:41:11 +0000 (17:41 -0700)]
fmt.Scan: fix %c in the case where the input does not implement ReadRune itself.
While we're at it, clean up and test the code to guarantee we see every byte when
the text is erroneous UTF-8.
Rob Pike [Tue, 15 Jun 2010 00:16:35 +0000 (17:16 -0700)]
fmt.Print*: reimplement to switch on type first.
This shortens, simplifies and regularizes the code significantly.
(Improvements to reflect could make another step.)
Passes all.bash.
One semantic change occurs: The String() method changes
behavior. It used to run only for string formats such as %s and %q.
Instead, it now runs whenever the item has the method and the
result is then processed by the format as a string. Besides the
regularization, this has three effects:
1) width is honored for String() items
2) %x works for String() items
3) implementations of String that merely recur will recur forever
Regarding point 3, example from the updated documentation:
type X int
func (x X) String() string { return Sprintf("%d", x) }
should cast the value before recurring:
func (x X) String() string { return Sprintf("%d", int(x)) }
Roger Peppe [Mon, 14 Jun 2010 21:54:48 +0000 (14:54 -0700)]
Add IndexFunc and LastIndexFunc.
Change TrimRight and TrimLeft to use these functions.
Incidentally fix minor bug in TrimRight.
Add some test cases for this.
YMMV whether it's worth saving the closure allocation.
Russ Cox [Fri, 11 Jun 2010 22:29:19 +0000 (15:29 -0700)]
gopack: simplify go metadata code
There's only one Go object file per package now,
so there's no need to parse the metadata and merge
metadata from multiple files. Just save the original
and use it as __.PKGDEF verbatim.
Ian Lance Taylor [Fri, 11 Jun 2010 20:41:49 +0000 (13:41 -0700)]
Pad Go symbol table out to page boundary when linking dynamically.
This avoids a crash when using cgo where glibc's malloc thinks
that it can use some of the memory following the symbol table.
This fails because the symbol table is mapped read-only, which
affects the whole page.
Adam Langley [Thu, 10 Jun 2010 00:52:41 +0000 (20:52 -0400)]
asn1: allow '*' in PrintableString.
Although technically incorrect, we want this in order to parse X.509
certificates where a wildcard hostname ("*.example.com") has been put
into a PrintableString.
Russ Cox [Wed, 9 Jun 2010 18:00:55 +0000 (11:00 -0700)]
gc: more cleanup
* disallow surrogate pair runes.
* diagnose impossible type assertions
* eliminate another static buffer.
* do not overflow lexbuf.
* add -u flag to disable package unsafe.
Russ Cox [Wed, 9 Jun 2010 01:50:02 +0000 (18:50 -0700)]
gc: new typechecking rules
* Code for assignment, conversions now mirrors spec.
* Changed some snprint -> smprint.
* Renamed runtime functions to separate
interface conversions from type assertions:
convT2I, assertI2T, etc.
* Correct checking of \U sequences.
Robert Griesemer [Wed, 9 Jun 2010 00:06:26 +0000 (17:06 -0700)]
go/parser: correct position of empty statement ';'
(caused certain files to not be idempotent under gofmt)
- corrected golden files for go/printer
- slightly simplified some code in nodes.go (no impact on formatting)
- these changes have no impact on gofmt output of .go files under src, misc
Robert Griesemer [Mon, 7 Jun 2010 22:49:39 +0000 (15:49 -0700)]
go spec: clean-up and consolidation of spec with implementation
Specifically:
- introduced notion of "underlying type"
- removed notion of type compatibility
- consolidated rules about assignment compatibility in
assignment compatibility section
- be consistent with specyfing that nil is the value
for uninitialized variables that can be nil (this
was not specified clearly for pointers, functions, interfaces)
- added/fixed various related links throughout
- clarify language on conversions
Nigel Tao [Fri, 4 Jun 2010 00:19:00 +0000 (17:19 -0700)]
draw.Draw fast paths for the Over operator.
Time (us) to draw a 200x200 src onto an image.RGBA dst with the Over
operator. Each case was measured three separate times, and the sorted
times are reported.
Fill case (where src is an image.ColorImage):
Before:
7438, 7511, 7526
After:
3073, 3087, 3102
Copy case (where src is an image.RGBA):
Before:
9506, 9510, 9563
After:
5262, 5300, 5344
Robert Griesemer [Thu, 3 Jun 2010 23:55:50 +0000 (16:55 -0700)]
go spec: Base comparison compatibility on assignment compatibility.
Specifically:
- Simplified definition of comparison compatibility and folded into
section on comparison operators since it's only used there.
This is a small language change/cleanup. As a consequence:
- An interface value may now be compared against a non-interface value.
- Channels with opposite directions cannot be compared directly anymore
(per discussion with rsc).
Kyle Consalus [Thu, 3 Jun 2010 06:04:44 +0000 (23:04 -0700)]
Optimization to regexp _CharClass: keep track of overall range of
charclass to avoid unnecessarily iterating over ranges.
Also, use the fact that IntVector is an []int to avoid method calls.
On my machine, this brings us from ~27500 ns/op to ~17500 ns/op in the benchmark I've added (it is also faster in the case where a range check
doesn't help, added a benchmark for this too.)
I'd also like to propose that "[]", and "[^]" be disallowed. They aren't useful as far as I can tell, they aren't widely supported, and they make reasoning about character classes a bit more complicated.
Russ Cox [Wed, 2 Jun 2010 23:17:18 +0000 (16:17 -0700)]
bufio: change ReadSlice to match description
On error, ReadSlice is defined to return the available data
and advance past that data, but it was not behaving that
way for err == ErrBufferFull, making it harder for callers to
handle well.
Rob Pike [Tue, 1 Jun 2010 22:22:01 +0000 (15:22 -0700)]
fmt.Scan: renamings, strings, errors
- implement scanning for all renamed types
(compiler bug stops complex from being renamable,
so it can't be tested but the code is there)
- %q %x for strings
- error handling now done with panic/recover
Rob Pike [Tue, 1 Jun 2010 22:21:21 +0000 (15:21 -0700)]
fmt.Scan: renamings, strings, errors
- implement scanning for all renamed types
(compiler bug stops complex from being renamable,
so it can't be tested but the code is there)
- %q %x for strings
- error handling now done with panic/recover
Vinu Rajashekhar [Tue, 1 Jun 2010 19:02:00 +0000 (12:02 -0700)]
Correct the regexp for finding unix signal names.
For example, earlier, the regexp would accept SIGQUEUE_MAX
as a unix signal with name SIGQUEUE. Now it is ignored.