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
Michael T. Jones [Sun, 27 Nov 2011 19:10:59 +0000 (11:10 -0800)]
math/big: use recursive subdivision for significant speedup
This change adds the second aspect to the conversion code, the
use of large divisiors (powers of big base) to greatly speed up
the divsion of large numbers. Speedups of 30x are common in the
large cases. Also includes new tests and tuning code for the
key internal parameters.
Gustav Paul [Sun, 27 Nov 2011 14:59:20 +0000 (09:59 -0500)]
exp/ssh: messages now contain remote channel's id instead of local id
According to http://www.ietf.org/rfc/rfc4254.txt most channel messages contain the channel id of the recipient channel, not the sender id. This allows the recipient connection multiplexer to route the message to the correct channel.
This changeset fixes several messages that incorrectly send the local channel id instead of the remote channel's id.
While sessions were being created and closed in sequence channels in the channel pool were freed and reused on the server side of the connection at the same rate as was done on the client, so the channel local and remote channel ids always corresponded. As soon as I had concurrent sessions on the same clientConn the server started to complain of 'uknown channel id N' where N is the local channel id, which is actually paired with server channel id K.
Rob Pike [Sat, 26 Nov 2011 16:32:55 +0000 (08:32 -0800)]
text/template: rename the method Template.Template to Template.Lookup
Calling it Template makes it clumsy to embed the type, which html/template
depends on.
Rob Pike [Thu, 24 Nov 2011 04:17:22 +0000 (20:17 -0800)]
text/template: new, simpler API
The Set type is gone. Instead, templates are automatically associated by
being parsed together; nested definitions implicitly create associations.
Only associated templates can invoke one another.
This approach dramatically reduces the breadth of the construction API.
For now, html/template is deleted from src/pkg/Makefile, so this can
be checked in. Nothing in the tree depends on it. It will be updated next.
Robert Griesemer [Wed, 23 Nov 2011 17:27:38 +0000 (09:27 -0800)]
go/printer, gofmt: more performance tweaks
Removed more string conversions and streamlined bottleneck
printing interface by removing unnecessary tests where possible.
About 6% faster AST printing.
Adam Langley [Wed, 23 Nov 2011 14:44:29 +0000 (09:44 -0500)]
crypto/openpgp/packet: fix private key checksum
I misinterpreted http://tools.ietf.org/html/rfc4880#section-5.5.3
and implemented the sum of 16-bit values, rather than the 16-bit sum
of 8-bit values.
Robert Griesemer [Tue, 22 Nov 2011 23:12:34 +0000 (15:12 -0800)]
go/printer, gofmt: 20 to 30% faster gofmt
Buffer intermediate output via a bytes.Buffer and thus avoid
calling through the entire Writer stack for every item printed.
There is more opportunity for improvements along the same lines.
Before (best of 3 runs):
- printer.BenchmarkPrint 50 47959760 ns/op
- time gofmt -l $GOROOT/src real 0m11.517s
After (best of 3 runs):
- printer.BenchmarkPrint 50 32056640 ns/op (= -33%)
- time gofmt -l $GOROOT/src real 0m9.070s (= -21%)
Russ Cox [Tue, 22 Nov 2011 17:30:02 +0000 (12:30 -0500)]
allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
type Tstring string
type Tbyte []byte
type Trune []rune
string <-> string // ok
string <-> []byte // ok
string <-> []rune // ok
string <-> Tstring // ok
string <-> Tbyte // was illegal, now ok
string <-> Trune // was illegal, now ok
Tstring <-> string // ok
Tstring <-> []byte // ok
Tstring <-> []rune // ok
Tstring <-> Tstring // ok
Tstring <-> Tbyte // was illegal, now ok
Tstring <-> Trune // was illegal, now ok
Update spec, compiler, tests. Use in a few packages.
We agreed on this a few months ago but never implemented it.
Fixes #1707.
R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
Adam Langley [Mon, 21 Nov 2011 19:18:42 +0000 (14:18 -0500)]
crypto/x509, crypto/tls: support PKCS#8 private keys.
OpenSSL 1.0.0 has switched to generating PKCS#8 format private keys by
default. This change allows http.ListenAndServeTLS to work with either
types of keys.
Lucio De Re [Mon, 21 Nov 2011 14:55:15 +0000 (09:55 -0500)]
syscall: fix for Plan 9 build
exec_plan9.go:
. Adjusted return argument to match other changes.
#mksyscall.pl:
. Replaced "err = e1" with "err = NewError(e1)".
* Change abandoned, Russ made a better suggestion involving
syscall_plan9.go.
syscall_plan9.go:
. Removed redundant "err = nil" lines.
. Adjusted //sys lines for mksyscall.pl.
* Replaced "err string" with "err ErrorString" in return arguments.
zsyscall_plan9_386.go:
. This module ought to be generated, but as it exists in the
repository, I rebuilt it and checked that it matched expectations.
Anybody is welcome to remove this from the repository if
they feel it should go, but remember that not all Plan 9
installations have a working Perl.
Dave Cheney [Sun, 20 Nov 2011 16:46:35 +0000 (11:46 -0500)]
exp/ssh: alter Session to match the exec.Cmd API
This CL inverts the direction of the Stdin/out/err members of the
Session struct so they reflect the API of the exec.Cmd. In doing so
it borrows heavily from the exec package.
Additionally Shell now returns immediately, wait for completion using
Wait. Exec calls Wait internally and so blocks until the remote
command is complete.
Credit to Gustavo Niemeyer for the impetus for this CL.
Andrew Balholm [Sun, 20 Nov 2011 11:42:28 +0000 (22:42 +1100)]
html: refactor parse test infrastructure
My excuse for doing this is that test cases with newlines in them didn't
work. But instead of just fixing that, I rearranged everything in
parse_test.go to use fewer channels and pipes, and just call a
straightforward function to read test cases from a file.
Rob Pike [Fri, 18 Nov 2011 21:10:15 +0000 (13:10 -0800)]
template/parse: rename Set to Parse
Preamble to the simplification of the template API.
Although the signature of Parse (nee Set) changes,
it's really an internal function, used only by
text/template.
R=golang-dev, rsc, gri, r
CC=golang-dev
https://golang.org/cl/5415052