Adam Langley [Sat, 14 Jan 2012 15:59:11 +0000 (10:59 -0500)]
exp/terminal: add SetPrompt and handle large pastes.
(This was missing in the last change because I uploaded it from the
wrong machine.)
Large pastes previously misbehaved because the code tried reading from
the terminal before checking whether an line was already buffered.
Large pastes can cause multiples lines to be read at once from the
terminal.
Brad Fitzpatrick [Fri, 13 Jan 2012 23:25:07 +0000 (15:25 -0800)]
exp/sql: fix statement leak
Also verified in external test suite that this fixes MySQL
resource exhaustion problems, and also exposed a double-free
bug in the gosqlite3 driver (where gosqlite3 either got lucky
before, or was working around this bug)
Rob Pike [Fri, 13 Jan 2012 21:38:36 +0000 (13:38 -0800)]
spec: change the wording regarding select statement choice
s/pseudo-random fair/uniform pseudo-random/
This careful word choice soothes the theoretically inclined.
Robert Griesemer [Fri, 13 Jan 2012 17:32:35 +0000 (09:32 -0800)]
godoc: make ?m=src mode deterministic
Merge package files in the go/ast MergePackageFiles
function always in the same order (sorted by filename)
instead of map iteration order to obtain the same
package file each time. This functionality is used
by godoc when displaying packages in ?m=src mode.
Gustavo Niemeyer [Fri, 13 Jan 2012 10:05:19 +0000 (11:05 +0100)]
xml: major Go 1 fixup
This CL improves the xml package in the following ways:
- makes its interface match established conventions
- brings Marshal and Unmarshal closer together
- fixes a large number of bugs and adds tests
- improves speed significantly
- organizes and simplifies the code
Fixes #2426.
Fixes #2406.
Fixes #1989.
What follows is a detailed list of those changes.
- All matching is case sensitive without special processing
to the field name or xml tag in an attempt to match them.
Customize the field tag as desired to match the correct XML
elements.
- Flags are ",flag" rather than "flag". The names "attr",
"chardata", etc, may be used to name actual XML elements.
- Overriding of attribute names is possible with "name,attr".
- Attribute fields are marshalled properly if they have
non-string types. Previously they were unmarshalled, but were
ignored at marshalling time.
- Comment fields tagged with ",comment" are marshalled properly,
rather than being marshalled as normal fields.
- The handling of the Any field has been replaced by the ",any"
flag to avoid unexpected results when using the field name for
other purposes, and has also been fixed to interact properly
with name paths. Previously the feature would not function
if any field in the type had a name path in its tag.
- Embedded struct support fixed and cleaned so it works when
marshalling and also when using field paths deeper than one level.
- Conflict reporting on field names have been expanded to cover
all fields. Previously it'd catch only conflicts of paths
deeper than one level. Also interacts correctly with embedded
structs now.
- A trailing '>' is disallowed in xml tags. It used to be
supported for removing the ambiguity between "attr" and "attr>",
but the marshalling support for that was broken, and it's now
unnecessary. Use "name" instead of "name>".
- Fixed docs to point out that a XMLName doesn't have to be
an xml.Name (e.g. a struct{} is a good fit too). The code was
already working like that.
- Fixed asymmetry in the precedence of XML element names between
marshalling and unmarshalling. Marshal would consider the XMLName
of the field type before the field tag, while unmarshalling would
do the opposite. Now both respect the tag of the XMLName field
first, and a nice error message is provided in case an attempt
is made to name a field with its tag in a way that would
conflict with the underlying type's XMLName field.
- Do not marshal broken "<???>" tags when in doubt. Use the type
name, and error out if that's not possible.
- Do not break down unmarshalling if there's an interface{} field
in a struct.
- Significant speed boost due to caching of type metadata and
overall allocation clean ups. The following timings reflect
processing of the the atom test data:
Only ParseFile, ParseDir, and ParseExpr are used in the tree.
If partial parsing of code is required, it is fairly simple
to wrap the relevant piece of code into a dummy package for
parsing (see parser.ParseExpr).
Russ Cox [Thu, 12 Jan 2012 21:44:02 +0000 (13:44 -0800)]
go/build: pass CgoLDFLAGS at end of link command
By the time a Unix linker gets to the end of the
command line it has forgotten what you told it
at the beginning of the command line, so you
have to put library arguments (like -lm) at the end.
Rob Pike [Thu, 12 Jan 2012 18:42:39 +0000 (10:42 -0800)]
dashboard: use build.golang.org as the domain
The domain returned by appengine.DefaultVersionHostname
isn't the one we want.
This change has been uploaded to build.golang.org
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5539043
it can be important that cleanup run as the test fails.
The old code did this in Fatal:
t.signal <- t
runtime.Goexit()
The runtime.Goexit would run the deferred cleanup
but the send on t.signal would cause the main test loop
to move on and possibly even exit the program before
the runtime.Goexit got a chance to run.
This CL changes tRunner (the top stack frame of a test
goroutine) to send on t.signal as part of a function
deferred by the top stack frame. This delays the send
on t.signal until after runtime.Goexit has run functions
deferred by the test itself.
For the above TestFoo, this CL guarantees that cleanup
will run before the test binary exits.
This is particularly important when cleanup is doing
externally visible work, like removing temporary files
or unmounting file systems.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532078
Russ Cox [Thu, 12 Jan 2012 18:18:03 +0000 (10:18 -0800)]
cmd/go: fix linker arguments
Especially affects tests, but not test-specific.
The linker was only being told where to find the
direct dependencies of package main. Sometimes that
was sufficient to find the rest; sometimes not.
Shenghou Ma [Thu, 12 Jan 2012 15:54:20 +0000 (07:54 -0800)]
goyacc: fix units.y build breakage
This breakage is mainly due to API changes in pkg.
(e.g., package utf8 moved to unicode/utf8;
remove of strconv.Atof64;
change character type from int to rune.)
Also correct the usage comment.
This fixes issue 2646.
PS: I don't change the goyacc.go, because I think token type
should not be force to rune.
R=golang-dev, adg, rogpeppe, r, r
CC=golang-dev
https://golang.org/cl/5502093
Rémy Oudompheng [Thu, 12 Jan 2012 11:08:40 +0000 (12:08 +0100)]
gc: avoid false positives when using scalar struct fields.
The escape analysis code does not make a distinction between
scalar and pointers fields in structs. Non-pointer fields
that escape should not make the whole struct escape.
Mike Samuel [Wed, 11 Jan 2012 23:47:03 +0000 (18:47 -0500)]
html/template: reenable testcases and fix mis-escaped sequences.
Tighter octal parsing broke some tests and were disabled in
https://golang.org/cl/5530051
Those tests were broken. The CSS decoder was supposed to see CSS
hex escape sequences of the form '\' <hex>+, but those escape
sequences were instead being consumed by the template parser.
This change properly escapes those escape sequences, and uses
proper escaping for NULs.
Robert Griesemer [Wed, 11 Jan 2012 22:20:32 +0000 (14:20 -0800)]
go/scanner: 17% faster scanning
- Changed the Scan API semantics slightly:
The token literal string is only returned
if the token is a literal, comment, semicolon,
or illegal character. In all other cases, the
token literal value is determined by the token
value.
Clients that care about the token literal value
when not present can always use the following
piece of code:
Adam Langley [Wed, 11 Jan 2012 13:35:32 +0000 (08:35 -0500)]
crypto/openpgp: assorted cleanups
1) Include Szabolcs Nagy's patch which adds serialisation for more
signature subpackets.
2) Include Szabolcs Nagy's patch which adds functions for making DSA
keys.
3) Make the random io.Reader an argument to the low-level signature
functions rather than having them use crypto/rand.
4) Rename crypto/openpgp/error to crypto/openpgp/errors so that it
doesn't clash with the new error type.
R=bradfitz, r
CC=golang-dev
https://golang.org/cl/5528044
Shenghou Ma [Wed, 11 Jan 2012 04:48:02 +0000 (20:48 -0800)]
runtime: runtime.usleep() bugfix on darwin/amd64 and linux/arm
pkg/runtime/sys_darwin_amd64.s: fixes syscall select nr
pkg/runtime/sys_linux_arm.s: uses newselect instead of the now unimplemented
(old) select, also fixes the wrong div/mod statements in runtime.usleep.
Fixes #2633
Nigel Tao [Wed, 11 Jan 2012 01:35:05 +0000 (12:35 +1100)]
image: rename image.Tiled to image.Repeated.
What package image currently provides is a larger image consisting
of many copies of a smaller image.
More generally, a tiled image could be a quilt consisting of different
smaller images (like Google Maps), or a technique to view a portion of
enormous images without requiring the whole thing in memory.
This richer construct might not ever belong in the standard library (and
is definitely out of scope for Go 1), but I would like the option for
image.Tiled to be its name.
Luuk van Dijk [Tue, 10 Jan 2012 20:24:31 +0000 (21:24 +0100)]
gc: inlining fixes
flag -l means: inlining on, -ll inline with early typecheck
-l lazily typechecks imports on use and re-export, nicer for debugging
-lm produces output suitable for errchk tests, repeated -mm... increases inl.c's verbosity
export processed constants, instead of originals
outparams get ->inlvar too, and initialized to zero
fix shared rlist bug, that lead to typecheck messing up the patched tree
properly handle non-method calls to methods T.meth(t, a...)
removed embryonic code to handle closures in inlined bodies
also inline calls inside closures (todo: move from phase 6b to 4)
Sameer Ajmani [Tue, 10 Jan 2012 00:55:18 +0000 (19:55 -0500)]
strconv: return ErrSyntax when unquoting illegal octal sequences. This
is consistent with what the Go compiler returns when such sequences
appear in string literals.
Robert Griesemer [Tue, 10 Jan 2012 00:54:24 +0000 (16:54 -0800)]
spec: pointer comparison for pointers to 0-sized variables
- define "0-sized"
- add clarifying sentence to pointer comparison
- removed notion "location" which was used only in pointer comparisons
and which was never defined