1
0
mirror of https://github.com/golang/go synced 2024-10-04 10:31:22 -06:00
Commit Graph

4549 Commits

Author SHA1 Message Date
Robert Griesemer
a0e54aaffa 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%)

R=r
CC=golang-dev
https://golang.org/cl/5432054
2011-11-22 15:12:34 -08:00
Andrew Balholm
57ed39fd3b html: on EOF in a comment, ignore final dashes (up to 2)
Pass tests2.dat, test 57:
<!DOCTYPE html><!--x--

| <!DOCTYPE html>
| <!-- x -->
| <html>
|   <head>
|   <body>

Also pass test 58:
<!DOCTYPE html><table><tr><td></p></table>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5436048
2011-11-23 09:26:37 +11:00
Russ Cox
fe838c2ddb encoding/xml: fix copy bug
Fixes #2484.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5417059
2011-11-22 12:31:33 -05:00
Russ Cox
6e3e380923 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
2011-11-22 12:30:02 -05:00
Russ Cox
c69d6345da os: make ReadAt comment clearer
Fixes #2486.

R=golang-dev, hanwen
CC=golang-dev
https://golang.org/cl/5417064
2011-11-22 12:22:28 -05:00
Andrew Balholm
95e60acb97 html: copy attributes from extra <html> tags to root element
Pass tests2.dat, test 50:
<!DOCTYPE html><html><body><html id=x>

| <!DOCTYPE html>
| <html>
|   id="x"
|   <head>
|   <body>

Also pass tests through test 56:
<!DOCTYPE html>X<p/x/y/z>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5432045
2011-11-22 12:08:22 +11:00
Andrew Balholm
750de28d6c html: ignore whitespace before <head> element
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
2011-11-22 09:27:27 +11:00
Adam Langley
7c161b05aa 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.

See http://groups.google.com/group/golang-nuts/browse_thread/thread/84715b5f0c9e3c30/63a8a27b53e102a6

R=bradfitz
CC=golang-dev
https://golang.org/cl/5416059
2011-11-21 14:18:42 -05:00
Benny Siegert
85255f9942 bcrypt: Correct typo in package comment.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5415062
2011-11-21 09:11:34 -08:00
Brad Fitzpatrick
6c9f466273 json: speed up encoding, caching reflect calls
Before
json.BenchmarkCodeEncoder  10  181232100 ns/op  10.71 MB/s
json.BenchmarkCodeMarshal  10  184578000 ns/op  10.51 MB/s

After:
json.BenchmarkCodeEncoder  10  146444000 ns/op  13.25 MB/s
json.BenchmarkCodeMarshal  10  151428500 ns/op  12.81 MB/s

R=rsc, r
CC=golang-dev
https://golang.org/cl/5416046
2011-11-21 07:49:14 -08:00
Charles L. Dorian
f3aa54e30d math: faster Cbrt
For amd64, from 127 to 105 ns/op; for 386, from 208 to 169 ns/op.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5412056
2011-11-21 09:56:07 -05:00
Lucio De Re
8ec32e8d84 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.

R=rsc
CC=ality, golang-dev
https://golang.org/cl/5411046
2011-11-21 09:55:15 -05:00
Brad Fitzpatrick
750d0e33fb sql: more driver docs & tests; no functional changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5415055
2011-11-20 14:56:49 -05:00
Dave Cheney
fb57134d47 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.

R=rsc, agl, n13m3y3r, huin, bradfitz
CC=cw, golang-dev
https://golang.org/cl/5322055
2011-11-20 11:46:35 -05:00
Andrew Balholm
05d8d112fe 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.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5410049
2011-11-20 22:42:28 +11:00
Nigel Tao
dbb591d8da exp/gui: delete exp/gui and exp/gui/x11. They are moving to
x-go-binding.googlecode.com.

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5406041
2011-11-20 21:56:17 +11:00
Sébastien Paolacci
e2467f047b syscall: add SUSv3 RLIMIT/RUSAGE constants
R=golang-dev, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/5369092
2011-11-19 15:17:40 +09:00
Robert Griesemer
8218251498 go/printer: cleanup more string/byte conversions
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
2011-11-18 20:55:35 -08:00
Robert Griesemer
17e493a2b1 go/printer: remove gratuitous string/[]byte conversions
Cleanup and slight performance improvement (1.5%).

Before (best of 3 runs):
printer.BenchmarkPrint	      50	  47377420 ns/op

After (best of 3 runs):
printer.BenchmarkPrint	      50	  46707180 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5416049
2011-11-18 19:10:45 -08:00
Andrew Gerrand
6c864210fc html/template: fix documentation formatting
See http://weekly.golang.org/pkg/html/template/

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5413055
2011-11-19 10:54:44 +11:00
Lucio De Re
5b9d7825ed html/template, net/http, websocket: fix import paths in comments
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5411048
2011-11-18 18:33:44 -05:00
Rob Pike
10e012c85f 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
2011-11-18 13:10:15 -08:00
Adam Langley
5cad861136 crypto/x509: fix documentation typos
Thanks to Jeff R. Allen for pointing them out.

R=bradfitz, gri
CC=golang-dev
https://golang.org/cl/5412052
2011-11-18 15:48:34 -05:00
Lucio De Re
aa3dbf2947 syscall: fix env routines for Plan 9
R=golang-dev
CC=ality, golang-dev, rsc
https://golang.org/cl/5364063
2011-11-18 13:36:06 -05:00
John Beisley
0e60804b4a exp/ssh: Add support for (most) of the ciphers from RFC4253, RFC4344 and RFC4345.
R=dave, agl, taruti, rsc, r
CC=golang-dev
https://golang.org/cl/5342057
2011-11-18 12:56:57 -05:00
Dmitriy Vyukov
151bcb11a8 exp/terminal: fix Makefile formatting for deps.bash
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
2011-11-18 15:30:36 +03:00
Rob Pike
25d2987dd9 text/template: refactor set parsing
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
2011-11-17 22:53:23 -08:00
Gustavo Niemeyer
558d055352 exp/terminal: fix build after os.Errno changes
Also include exp/terminal in linux build so such failures
are noticed.

R=rsc
CC=golang-dev
https://golang.org/cl/5416044
2011-11-18 01:12:57 -02:00
Anthony Martin
4a2d30e13b runtime: add nanotime for Plan 9
R=paulzhol, rsc, dave, rminnich
CC=golang-dev
https://golang.org/cl/5327063
2011-11-17 22:09:28 -05:00
Gustavo Niemeyer
f6279b46f8 html: fix doc after Err method name change
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5411045
2011-11-18 01:06:59 -02:00
Alex Brainman
9bfe9dfde7 mime: remove ".wav" from tests (to fix build)
It looks like not all computers have
mime type for .wav extension.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5415045
2011-11-18 13:24:17 +11:00
Alex Brainman
ac17fd4cd2 mime: implement TypeByExtension for windows
Fixes #2071.

R=golang-dev, hcwfrichter, pascal, rsc
CC=golang-dev
https://golang.org/cl/5369056
2011-11-18 10:07:36 +11:00
Joel Sing
ea2c0cd88f os: re-enable hostname test on openbsd
Now that Sysctl() works, re-enable the hostname test.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5408042
2011-11-18 01:53:07 +11:00
Joel Sing
9b571a3120 syscall: hostname/domainname fix for openbsd
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
2011-11-18 01:52:39 +11:00
Joel Sing
773a921ccb syscall: implement nametomib for openbsd.
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
2011-11-17 23:13:49 +11:00
Andrew Balholm
a1dbfa6f09 html: parse <isindex>
Pass tests2.dat, test 42:
<isindex test=x name=x>

| <html>
|   <head>
|   <body>
|     <form>
|       <hr>
|       <label>
|         "This is a searchable index. Enter search keywords: "
|         <input>
|           name="isindex"
|           test="x"
|       <hr>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5399049
2011-11-17 13:12:13 +11:00
Andrew Gerrand
0b1bcf8f94 http: fix serving from CWD with http.ServeFile
http: make Dir("") equivalent to Dir(".")

Fixes #2471.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5370061
2011-11-17 11:42:25 +11:00
Alex Brainman
3ec82f6e09 exp/ssh: change test listen address, also exit test if fails
R=golang-dev, rsc
CC=dave, golang-dev
https://golang.org/cl/5364061
2011-11-17 11:20:42 +11:00
Russ Cox
a479a45548 reflect: make Value an opaque struct
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
2011-11-16 19:18:25 -05:00
Andrew Balholm
3276afd4d4 html: parse </optgroup> and </option>
Pass tests2.dat, test 35:
<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|       <option>
|     <option>

Also pass tests through test 41:
<!DOCTYPE html><!-- XXX - XXX - XXX -->

R=nigeltao, rsc
CC=golang-dev
https://golang.org/cl/5395045
2011-11-17 10:25:33 +11:00
Russ Cox
8c6461bcb1 exp/ssh: fix test?
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
2011-11-16 18:13:50 -05:00
Russ Cox
7d1d8fe430 go/printer: make //line formatting idempotent
Fixes "test.sh" (long test) in src/cmd/gofmt.

R=gri
CC=golang-dev
https://golang.org/cl/5307081
2011-11-16 17:55:35 -05:00
Lucio De Re
087a34869a syscall, os, time: fix Plan 9 build
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5371092
2011-11-16 17:37:54 -05:00
Christopher Wedgwood
8fdd6c05b1 exp/ssh: add to pkg Makefile
R=rsc, dave
CC=golang-dev
https://golang.org/cl/5399045
2011-11-16 17:34:18 -05:00
Robert Griesemer
d0b9a84ab3 go/ast: remove unused receiver names (cleanup)
R=iant, iant
CC=golang-dev
https://golang.org/cl/5393047
2011-11-16 13:41:26 -08:00
Gustavo Niemeyer
c9355596cd net/http: fix EOF handling on response body
http.Response is currently returning 0, nil on EOF.

R=golang-dev, bradfitz, bradfitz
CC=golang-dev
https://golang.org/cl/5394047
2011-11-16 17:35:47 -02:00
Brad Fitzpatrick
881f2076fb fcgi: fix server capability discovery
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
2011-11-16 10:11:39 -08:00
Rob Pike
f5db4d05f2 html/template: indirect top-level values before printing
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
2011-11-16 09:32:52 -08:00
Dave Cheney
00f9b7680a exp/ssh: fix unmarshal test
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
2011-11-16 10:19:56 -05:00
Andrew Balholm
3307597069 html: parse <optgroup> tags
Pass tests2.dat, test 34:
<!DOCTYPE html><select><option><optgroup>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <select>
|       <option>
|       <optgroup>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5393045
2011-11-16 19:25:55 +11:00