Rob Pike [Fri, 9 Dec 2011 16:31:04 +0000 (08:31 -0800)]
tmpltohtml: feature for easier snippet extraction
Lines that end with OMIT are omitted from the output.
A comment such as
// Example stops here. OMIT
can be used as a marker but not appear in the output.
Russ Cox [Fri, 9 Dec 2011 05:13:19 +0000 (00:13 -0500)]
spec: examples of untyped boolean, string constants
This is a spec correction, not a language change.
The implementations have behaved like this for years
(and there are tests to that effect), and elsewhere in
the spec true and false are defined to be untyped
boolean constants.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5477047
Adam Langley [Thu, 8 Dec 2011 21:46:19 +0000 (16:46 -0500)]
crypto/dsa: don't truncate input hashes.
Although FIPS 186-3 says that we should truncate the hashes, at least
one other library (libgcrypt) doesn't. This means that it's impossible
to interoperate with code using gcrypt if we enforce the truncation
inside of crypto/dsa.
This change shouldn't actually affect anything because nearly
everybody pairs DSA with SHA1, which doesn't need to be truncated in
either case.
Rob Pike [Thu, 8 Dec 2011 00:11:17 +0000 (16:11 -0800)]
doc/go1: map deletion
This CL is in part a proposal for how to write these sections:
- Brief discussion of change
- No attempt to analyze the thinking about it
- Old code
- New code, runnable if possible
- How to update old programs
Rob Pike [Wed, 7 Dec 2011 22:33:37 +0000 (14:33 -0800)]
doc: skeleton for release note document
No content yet other than titles and an introductory paragraph.
Once this is in, content can arise as separate manageable CLs.
Charles L. Dorian [Wed, 7 Dec 2011 19:52:17 +0000 (14:52 -0500)]
math: document special-cases behavior for Dim, Max and Min
Max returns +Inf if x or y is +Inf; else it returns NaN if either x or y is NaN. Max(-0, -0) returns -0.
Min returns -Inf if x or y is -Inf; else it returns NaN if either x or y is NaN. Min(+0, -0) returns -0.
Dim(+Inf, +Inf) = NaN, Dim(-Inf, -Inf) = NaN and Dim(NaN, anything) = NaN.
Also, change "conditions" to "cases" for Sin (missed it in previous CL).
R=rsc, dave
CC=golang-dev
https://golang.org/cl/5437137
Gustav Paul [Wed, 7 Dec 2011 14:58:22 +0000 (09:58 -0500)]
exp/ssh: Have Wait() return an *ExitError
I added the clientChan's msg channel to the list of channels that are closed in mainloop when the server sends a channelCloseMsg.
I added an ExitError type that wraps a Waitmsg similar to that of os/exec. I fill ExitStatus with the data returned in the 'exit-status' channel message and Msg with the data returned in the 'exit-signal' channel message.
Instead of having Wait() return on the first 'exit-status'/'exit-signal' I have it return an ExitError containing the status and signal when the clientChan's msg channel is closed.
I added two tests cases to session_test.go that test for exit status 0 (in which case Wait() returns nil) and exit status 1 (in which case Wait() returns an ExitError with ExitStatus 1)
Adam Langley [Tue, 6 Dec 2011 23:25:14 +0000 (18:25 -0500)]
crypto: allocate less.
The code in hash functions themselves could write directly into the
output buffer for a savings of about 50ns. But it's a little ugly so I
wasted a copy.
Adam Langley [Tue, 6 Dec 2011 21:42:48 +0000 (16:42 -0500)]
crypto/x509: if a parent cert has a raw subject, use it.
This avoids a problem when creating certificates with parents that
were produce by other code: the Go structures don't contain all the
information about the various ASN.1 string types etc and so that
information would otherwise be lost.
Rob Pike [Tue, 6 Dec 2011 20:47:12 +0000 (12:47 -0800)]
html/template: simplify ExecuteTemplate a little
Allow the text template to handle the error case of no template
with the given name.
Simplification suggested by Mike Samuel.
Robert Griesemer [Tue, 6 Dec 2011 16:15:45 +0000 (08:15 -0800)]
strconv: 34% to 63% faster conversions
(Note that the Int and Uint benchmarks use different test sets
and thus cannot be compared against each other. Int and Uint
conversions are approximately the same speed).
Russ Cox [Tue, 6 Dec 2011 15:47:42 +0000 (10:47 -0500)]
image: avoid func comparison during ColorModel comparison
When I disallowed map + func comparisons, I only did it
in the static case and missed the comparisons via == on
interface values. Fixing that turned these up.
R=nigeltao, r
CC=golang-dev
https://golang.org/cl/5440103
Dave Cheney [Tue, 6 Dec 2011 14:33:23 +0000 (09:33 -0500)]
exp/ssh: simplify client channel open logic
This is part one of a small set of CL's that aim to resolve
the outstanding TODOs relating to channel close and blocking
behavior.
Firstly, the hairy handling of assigning the peersId is now
done in one place. The cost of this change is the slightly
paradoxical construction of the partially created clientChan.
Secondly, by creating clientChan.stdin/out/err when the channel
is opened, the creation of consumers like tcpchan and Session
is simplified; they just have to wire themselves up to the
relevant readers/writers.
Rob Pike [Tue, 6 Dec 2011 00:45:51 +0000 (16:45 -0800)]
fmt: only use Stringer or Error for strings
This is a slight change to fmt's semantics, but means that if you use
%d to print an integer with a Stringable value, it will print as an integer.
This came up because Time.Month() couldn't cleanly print as an integer
rather than a name. Using %d on Stringables is silly anyway, so there
should be no effect outside the fmt tests.
As a mild bonus, certain recursive failures of String methods
will also be avoided this way.
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.