Rob Pike [Tue, 17 Jan 2012 21:13:50 +0000 (13:13 -0800)]
cmd/go: remove mentions of 'gotest' from the documentation
go test runs the tests itself; it does not run the gotest command,
so these mentions are confusing.
Rob Pike [Tue, 17 Jan 2012 18:45:36 +0000 (10:45 -0800)]
fmt: enable and fix malloc test
On 32-bit machines, %g takes an extra malloc. I don't know why yet,
but this makes the test pass again, and enables it even for -short.
Fixes #2653.
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5542055
Gustavo Niemeyer [Tue, 17 Jan 2012 02:49:05 +0000 (00:49 -0200)]
net/url: cleaned up URL interface (v2)
Duplicated fields from URL were dropped so that its behavior
is simple and expected when being stringified and when being
operated by packages like http. Most of the preserved fields
are in unencoded form, except for RawQuery which continues to
exist and be more easily handled via url.Query().
The RawUserinfo field was also replaced since it wasn't practical
to use and had limitations when operating with empty usernames
and passwords which are allowed by the RFC. In its place the
Userinfo type was introduced and made accessible through the
url.User and url.UserPassword functions.
Adam Langley [Sun, 15 Jan 2012 14:59:06 +0000 (09:59 -0500)]
exp/ssh: remove duplicated terminal code.
The terminal code in exp/terminal was forked from the code in exp/ssh.
This change removes the duplicated code from exp/ssh in favour of
using exp/terminal.
Mikio Hara [Sun, 15 Jan 2012 05:19:44 +0000 (14:19 +0900)]
net: platform-dependent default socket options
This CL revises existing platform-dependent default socket
options to make it possible to accomodate multiple multicast
datagram listeners on a single service port.
Also removes unnecessary SO_REUSEADDR, SO_REUSEPORT socket
options from unicast datagram sockets by default.
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.