Previously we were using the map iteration order to set the order of
the cipher suites in the ClientHello.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5440048
- allow Lookup to work on uninitialized templates
- fix bug in add: can't error after parser is stopped
- add Add method for html/template
R=adg, rogpeppe, r, rsc
CC=golang-dev
https://golang.org/cl/5436080
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes#2452.
R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
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.
R=gri
CC=golang-dev
https://golang.org/cl/5438058
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.
R=golang-dev, dave, rsc, agl
CC=golang-dev
https://golang.org/cl/5433063
IIRC, package sql used to be called db. There was one occurrence
of the old name in a comment.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5431075
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.
R=dsymonds, adg, rsc, r, gri, mikesamuel, nigeltao
CC=golang-dev
https://golang.org/cl/5415060
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%)
R=r
CC=golang-dev
https://golang.org/cl/5432054
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
Pass tests2.dat, test 47:
" \n "
(That is, two spaces separated by a newline)
| <html>
| <head>
| <body>
Also pass tests through test 49:
<!DOCTYPE html><script>
</script> <title>x</title> </head>
R=nigeltao
CC=golang-dev
https://golang.org/cl/5422043
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.
R=rsc
CC=ality, golang-dev
https://golang.org/cl/5411046
Also introduce a new insertion heuristic:
insert new import next to existing import
with the longest matching prefix.
R=golang-dev, adg, gri
CC=golang-dev
https://golang.org/cl/5412053
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.
R=rsc, agl, n13m3y3r, huin, bradfitz
CC=cw, golang-dev
https://golang.org/cl/5322055
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.
R=nigeltao
CC=golang-dev
https://golang.org/cl/5410049
Slight slow-down for printer benchmark (-0.7%) before
applying CL 5416049 (which will wash it out). Code is
cleaner and simpler.
R=rsc
CC=golang-dev
https://golang.org/cl/5417053
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
deps.bash does not understand current format,
so make.bash fails (with MAKEFLAGS=-j20).
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5410046
Parse {{define}} blocks during template parsing rather than separately as a set-specific thing.
This cleans up set parse significantly, and enables the next step, if we want, to unify the
API for templates and sets.
Other than an argument change to parse.Parse, which is in effect an internal function and
unused by client code, there is no API change and no spec change yet.
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5393049
This feature should make it easier to look at very large
directory trees.
- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
presented with slightly less indentation
- there is an internal hook for programmatic control of the
display mode (for specialized versions of godoc).
R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
Work around a bug that was fixed after OpenBSD 5.0 - a request for
kern.hostname or kern.domainname with a nil value for oldp will result
in a length of zero being returned. If we hit this case use a length
of MAXHOSTNAMELEN (256).
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5408041
Move the existing darwin/freebsd specific nametomib implementation
into the respective operating system dependent files.
Provide a nametomib implementation for openbsd, which operates on a
sysctl MIB that has been pre-generated from the various system headers
by mksysctl_openbsd.pl.
R=rsc
CC=golang-dev
https://golang.org/cl/4935044
Making Value opaque means we can drop the interface kludges
in favor of a significantly simpler and faster representation.
v.Kind() will be a prime candidate for inlining too.
On a Thinkpad X201s using -benchtime 10:
benchmark old ns/op new ns/op delta
json.BenchmarkCodeEncoder 284391780 157415960 -44.65%
json.BenchmarkCodeMarshal 286979140 158992020 -44.60%
json.BenchmarkCodeDecoder 717175800 388288220 -45.86%
json.BenchmarkCodeUnmarshal 734470500 404548520 -44.92%
json.BenchmarkCodeUnmarshalReuse 707172280 385258720 -45.52%
json.BenchmarkSkipValue 24630036 18557062 -24.66%
benchmark old MB/s new MB/s speedup
json.BenchmarkCodeEncoder 6.82 12.33 1.81x
json.BenchmarkCodeMarshal 6.76 12.20 1.80x
json.BenchmarkCodeDecoder 2.71 5.00 1.85x
json.BenchmarkCodeUnmarshal 2.64 4.80 1.82x
json.BenchmarkCodeUnmarshalReuse 2.74 5.04 1.84x
json.BenchmarkSkipValue 77.92 103.42 1.33x
I cannot explain why BenchmarkSkipValue gets faster.
Maybe it is one of those code alignment things.
R=iant, r, gri, r
CC=golang-dev
https://golang.org/cl/5373101
Fixes use of c after Dial failure (causes crash).
May fix Dial failure by listening to 127.0.0.1:0
instead of 0.0.0.0:0 (tests should only listen on
localhost).
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5395052
I've modified Plan 9's yacc to work with
the grammar in go.y. These are the only
changes necessary on the Go side.
R=rsc
CC=golang-dev
https://golang.org/cl/5375104
The wrong length was being sent, and two parameters
were also transposed. Made the record type be a type
and made the constants typed, to prevent that sort
of bug in the future.
Fixes#2469
R=golang-dev, edsrzf
CC=golang-dev
https://golang.org/cl/5394046
text/template does this (in an entirely different way), so
make html/template do the same. Before this fix, the template
{{.}} given a pointer to a string prints its address instead of its
value.
R=mikesamuel, r
CC=golang-dev
https://golang.org/cl/5370098
Ensure that empty NameLists always return
a zero length []string, not nil.
In practice NameLists are only used in a few
message types and always consumed by a for
range function so the difference between nil
and []string{} is not significant.
Also, add exp/ssh to pkg/Makefile as suggested
by rsc.
R=rsc, agl
CC=golang-dev
https://golang.org/cl/5400042
Move scanner allocation out of loop.
It's the only allocation in the test so it dominates
when it triggers a garbage collection.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5369117
Errors in the code under test go to standard output.
Errors in testing or its usage go to standard error.
R=r
CC=golang-dev
https://golang.org/cl/5374090
An experiment: allow structs to be copied even if they
contain unexported fields. This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.
In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.
All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.
Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef
R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
No need for creating a new nat each time.
Per Roger Peppe's suggestion; assuming
nat(nil) produces better code than nat{}.
R=rsc
CC=golang-dev
https://golang.org/cl/5375092
The environment is needed by package time, which
we want not to depend on os (so that os can use
time.Time), so push down into syscall.
Delete syscall.Sleep, now unnecessary.
The package os environment API is preserved;
it is only the implementation that is moving to syscall.
Delete os.Envs, which was undocumented,
uninitialized on Windows and Plan 9, and
not maintained by Setenv and Clearenv.
Code can call os.Environ instead.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5370091
- syscall (not os) now defines the Errno type.
- the low-level assembly functions Syscall, Syscall6, and so on
return Errno, not uintptr
- syscall wrappers all return error, not uintptr.
R=golang-dev, mikioh.mikioh, r, alex.brainman
CC=golang-dev
https://golang.org/cl/5372080
This CL adds experimental support for making proxied
net.Conn connections via the remote server.
nb. Functional tests exist for this feature but CL
5320053 or similar needs to be committed to support them.
R=rsc, agl, n13m3y3r
CC=cw, golang-dev, huin
https://golang.org/cl/5371081
client.go/client_auth.go:
* add support for publickey key auth using the interface
outlined by rsc in the previous auth CL
client_auth_test.go:
* password and publickey tests against server.go
common.go/server.go:
* move some helper methods from server.go into common.go
* generalise serializeRSASignature
R=rsc, agl, huin
CC=cw, golang-dev, n13m3y3r
https://golang.org/cl/5373055
Some remote servers send a 0 window size in the channel
open confirm msg, others send a non zero window size. Make
sure this initial advertisement is not lost.
R=agl, rsc, cw
CC=golang-dev
https://golang.org/cl/5372083
Currently, the state transition functions in the HTML parser
return the next insertion mode and whether the token is consumed.
This works well except for when one insertion mode needs to use
the rules for another insertion mode. Then the useTheRulesFor
function needs to patch things up. This requires comparing functions
for equality, which is going to stop working.
Adding a field to the parser structure to store the current
insertion mode eliminates the need for useTheRulesFor;
one insertion mode function can now just call the other
directly. The insertion mode will be changed only if it needs to be.
This CL is an alternative to CL 5372078.
R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/5372079
Not sure if this is what you'd really want. Maybe with a higher limit than 10
or perhaps keep checking nerrors > 10 per yyerror, but check the cumulative
after each function?
R=rsc
CC=golang-dev
https://golang.org/cl/5376064
Without this check, gofmt panics when trying to apply
the identity transformation on "item.field" expressions.
Fixes#2410.
R=rsc, gri
CC=golang-dev, remy
https://golang.org/cl/5376061
Fedora 16 mounts selinux at /sys/fs/selinux, instead of the
traditional /selinux. Check both locations for the selinux
filesystem in make.bash
Fixes#2448.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5373077
Without this, a missing gmake will result in bogus error "Did not find
Go environment variables".
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5369066
I had to replace the single use of io/ioutil
in the time package with a bytes.Buffer since
there would've been a dependency cycle.
There are no other uses of os.Time.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5372054
It was never really a shell, but the name carried
over from SSH's ServerShell.
Two small functional changes:
Add SetSize, which allows the size of the terminal
to be changed in response, say, to an SSH message.
Don't write the prompt if there's already something
on the current line.
R=rsc
CC=golang-dev
https://golang.org/cl/5376066
(This is part of removing the duplicate code between exp/terminal and
exp/ssh, but hg is having a very hard time keeping up so I'm doing it
in small steps.)
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5373061
Godefs was a C program that ran gcc and then parsed the
stabs debugging information in the resulting object file to
generate C or Go code for bootstrapping as part of
package runtime or package syscall.
Cgo does the same work, but using the dwarf debugging
information. Add -godefs and -cdefs options to cgo that
mimic godefs's output, albeit with different input
(a Go program, not a C program).
This has been a "nice to have" for a while but was forced
by Apple removing stabs debugging output from their
latest compilers.
Fixes#835.
Fixes#2338.
R=golang-dev, bradfitz, r, dave, iant
CC=golang-dev
https://golang.org/cl/5367043
As the ISO 8601 week number is untrivial to compute a new method
on *Time provides year and number of week.
R=golang-dev, rsc, r, r
CC=golang-dev
https://golang.org/cl/5316074
The timespec passed to thrsleep() needs to be an absolute/realtime
value, so add the current nanotime to ns.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5374048
Types are left as nil if no DWARF information is found and
checking in the rewriting pass so that appropriate errors
with line numbers can be printed.
Fixes#2408.
R=rsc
CC=golang-dev, remy
https://golang.org/cl/5336041
Converting from polynomial constants to counted array speeds up Lgamma from 51.3 to 37.7 ns/op. Variables renamed in Gamma to avoid overlap in Lgamma.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5359045
This looks like it is just moving some code from
time to runtime (and translating it to C), but the
runtime can do a better job managing the goroutines,
and it needs this functionality for its own maintenance
(for example, for the garbage collector to hand back
unused memory to the OS on a time delay).
Might as well have just one copy of the timer logic,
and runtime can't depend on time, so vice versa.
It also unifies Sleep, NewTicker, and NewTimer behind
one mechanism, so that there are no claims that one
is more efficient than another. (For example, today
people recommend using time.After instead of time.Sleep
to avoid blocking an OS thread.)
Fixes#1644.
Fixes#1731.
Fixes#2190.
R=golang-dev, r, hectorchu, iant, iant, jsing, alex.brainman, dvyukov
CC=golang-dev
https://golang.org/cl/5334051
Fixes crash when cgo consumes more than 8K
of stack and makes a callback.
Fixes#1328.
R=golang-dev, rogpeppe, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5371042
. removed an unnexessary initialisation.
. replaced 0 with 0L to match print format that in turn matched
the type of the original function return value.
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5306072
Allow any type in switch on interface value.
Statically check typeswitch early.
Fixes#2423.
Fixes#2424.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
Arrange the code so that it's easier to keep edits in sync.
R=golang-dev, mikioh.mikioh, bradfitz, andybalholm, rsc
CC=golang-dev
https://golang.org/cl/5345041