Russ Cox [Mon, 5 Dec 2011 14:40:22 +0000 (09:40 -0500)]
runtime: prep for type-specific algorithms
Equality on structs will require arbitrary code for type equality,
so change algorithm in type data from uint8 to table pointer.
In the process, trim top-level map structure from
104/80 bytes (64-bit/32-bit) to 24/12.
Equality on structs will require being able to call code generated
by the Go compiler, and C code has no way to access Go return
values, so change the hash and equal algorithm functions to take
a pointer to a result instead of returning the result.
Russ Cox [Fri, 2 Dec 2011 18:11:30 +0000 (13:11 -0500)]
spec: pointer to array can be sliced
This has always been true, but we lost it from the spec
somewhere along the way, probably when we disallowed
the general 'pointer to anything sliceable' slice case.
Russ Cox [Fri, 2 Dec 2011 17:30:37 +0000 (12:30 -0500)]
doc: do not slice array literal
The special case in the spec is that you can take the
address of a composite literal using the & operator.
A composite literal is not, however, generally addressable,
and the slice operator requires an addressable argument,
so [3]int{1,2,3}[:] is invalid. This tutorial code and one bug
report are the only places in the tree where it appears.
Gustav Paul [Fri, 2 Dec 2011 15:34:42 +0000 (10:34 -0500)]
exp/ssh: allow for msgUserAuthBanner during authentication
The SSH spec allows for the server to send a banner message to the client at any point during the authentication process. Currently the ssh client auth types all assume that the first response from the server after issuing a userAuthRequestMsg will be one of a couple of possible authentication success/failure messages. This means that client authentication breaks if the ssh server being connected to has a banner message configured.
This changeset refactors the noneAuth, passwordAuth and publickeyAuth types' auth() function and allows for msgUserAuthBanner during authentication.
Mikio Hara [Fri, 2 Dec 2011 14:18:16 +0000 (23:18 +0900)]
net, syscall: remove BindToDevice API from UDPConn, IPConn
For now a pair of socket options SOL_SOCKET and SO_BINDTODEVICE
is supported on Linux only. I'd like to demote BindToDevice API
to syscall level because it's Linux dependent one.
In the near future, probably we may have a bit more portable
API that using IPROTO_IP/IPV6 level socket options to specify,
identify an inbound, outbound IP interface on incoming, outgoing
UDP and raw IP packets.
Robert Griesemer [Thu, 1 Dec 2011 23:14:15 +0000 (15:14 -0800)]
go/doc: exclude lines ending in ':' from possible headings
This is a more conservative approach to heading detection and
removes 11 headings from the current repository (several in
fmt). The current headscan output is:
Robert Griesemer [Thu, 1 Dec 2011 19:50:15 +0000 (11:50 -0800)]
go/doc: better headscan
- scan all comments not just the package documentation
- declutter output so that false positives are more easily spotted
- count the number of headings to quickly see differences
- minor tweaks
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5450061
Volker Dobler [Thu, 1 Dec 2011 17:49:58 +0000 (09:49 -0800)]
go/doc: Detect headings in comments and format them as h3 in html.
To structure larger sections of comments in html output headings
are detected in comments and formated as h3 in the generated html.
A simple heuristic is used to detect headings in comments:
A heading is a non-blank, non-indented line preceded by a blank
line. It is followed by a blank and a non-blank, non-indented line.
A heading must start with an uppercase letter and end with a letter,
digit or a colon. A heading may not contain punctuation characters.
R=jan.mercl, gri, adg, rsc, r
CC=golang-dev
https://golang.org/cl/5437056
Adam Langley [Thu, 1 Dec 2011 17:35:37 +0000 (12:35 -0500)]
Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.
The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.
Rob Pike [Thu, 1 Dec 2011 04:11:57 +0000 (20:11 -0800)]
html/template: make execution thread-safe
The problem is that execution can modify the template, so it needs
interlocking to have the same thread-safe guarantee as text/template.
Fixes #2439.
Russ Cox [Wed, 30 Nov 2011 18:42:14 +0000 (13:42 -0500)]
os: fix path/filepath test on Windows
This is not the right fix, but it is what used to happen
before the FileInfo conversion, and it should get the
build working again (at least that part).
Russ Cox [Wed, 30 Nov 2011 18:36:25 +0000 (13:36 -0500)]
encoding/asn1: fix test on OpenBSD
time.Parse uses time.Local if it has the right zone offset,
otherwise it calls time.FixedZone. The test's use of reflect.DeepEqual
meant that the test expected time.FixedZone always, failing
when the local time zone really would have used -0700 for
that time. The fix is to format the time to display only the
pieces we intend to test.
Roger Peppe [Wed, 30 Nov 2011 17:29:58 +0000 (09:29 -0800)]
math/big: fix destination leak into result value
This code would panic:
z := big.NewInt(1)
z.SetBit(big.NewInt(0), 2, 1)
if z.Cmp(big.NewInt(1<<2)) != 0 {
panic("fail")
}
Gustav Paul [Tue, 29 Nov 2011 17:26:39 +0000 (12:26 -0500)]
exp/ssh: Add Start(cmd string) and Signal(sig string) to Session. Rename Exec to Run.
Exec() has been renamed to Run() in keeping with the os/exec API.
Added func (*Session) Start(cmd string) which starts a remote process but unlike Run() doesn't wait for it to finish before returning.
Run() has been refactored to use Start internally. Its really just a refactoring, no new code but some extra functionality was won.
Also added func (*Session) Signal(sig signal) which sends a UNIX signal to a remote process. This is espcially useful in conjunction with Start() as the two allow you to start a remote process, monitor its stdout/stderr, and send it a TERM/HUP/etc signal when you want it to close.
Rob Pike [Mon, 28 Nov 2011 18:42:57 +0000 (10:42 -0800)]
text/template: address a couple of issues for html/template
- allow Lookup to work on uninitialized templates
- fix bug in add: can't error after parser is stopped
- add Add method for html/template