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

4848 Commits

Author SHA1 Message Date
Andrew Gerrand
9834a25d33 testing: trim spaces before comparing example output
bytes: add two Buffer examples

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5490048
2011-12-16 09:43:58 +11:00
Nigel Tao
a369004e23 html: handle end tags in foreign objects.
I'm not 100% sure I get all the corner cases right, for end tags, but
I'll let the test suite smoke it out.

Pass tests10.dat, test 1:
<!DOCTYPE html><svg></svg><![CDATA[a]]>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <svg svg>
|     <!-- [CDATA[a]] -->

Also pass tests through test 5:
<!DOCTYPE html><body><table><svg></svg></table>

R=andybalholm
CC=golang-dev
https://golang.org/cl/5495044
2011-12-16 09:36:50 +11:00
Robert Griesemer
9f65e99ad4 go/printer, gofmt: don't write too many newlines
In some rare cases, gofmt would accept more than the maximum
number of empty lines (1) between source code snippets.

The actual change is in printer.go, lines 773-775; the rest
is some minor restructuring.

Applied gofmt -w src misc .

Fixes #2387.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496047
2011-12-15 13:51:47 -08:00
Dave Cheney
52c8107a3c exp/ssh: simplify Stdin/out/errPipe methods
If a Pipe method is called, return the underlying
reader/writer from session.clientChan, bypassing the
io.Copy and io.Pipe harness.

StdoutPipe and StderrPipe now return an io.Reader not
an io.ReadCloser as SSH cannot signal the close of the
local reader to the remote process.

R=rsc, agl, gustav.paul, cw
CC=golang-dev
https://golang.org/cl/5493047
2011-12-15 16:50:41 -05:00
Rob Pike
04faa08c07 fmt: speed up floating point print, clean up some code
%g down to two mallocs from four. Also a mild speedup.

fmt_test.BenchmarkSprintfFloat         3016         2703  -10.38%

Fixes #2557.

R=rsc
CC=golang-dev
https://golang.org/cl/5491054
2011-12-15 12:52:29 -08:00
Brad Fitzpatrick
29264c6f4f json: use strconv.Append variants to avoid allocations in encoding
Before/after, best of 3:
json.BenchmarkCodeEncoder  10  183495300 ns/op  10.58 MB/s
->
json.BenchmarkCodeEncoder  10  133025100 ns/op  14.59 MB/s

But don't get too excited about this.  These benchmarks, while
stable at any point of time, fluctuate wildly with any line of
code added or removed anywhere in the path due to stack splitting
issues.

It's currently much faster, though, and this is the API that
doesn't allocate so should always be faster in theory.

R=golang-dev, dsymonds, rsc, r, gri
CC=golang-dev
https://golang.org/cl/5411052
2011-12-15 11:21:21 -08:00
Robert Griesemer
fb6ffd8f78 go/scanner: strip CRs from raw literals
R=rsc
CC=golang-dev
https://golang.org/cl/5495049
2011-12-15 10:51:32 -08:00
Russ Cox
fd1f10966d more tags for go/build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5490047
2011-12-15 13:35:59 -05:00
Brad Fitzpatrick
ea51dd23b4 sql: add Rows.Columns
Also, fix package name in error messages.

Fixes #2453

R=rsc
CC=golang-dev
https://golang.org/cl/5483088
2011-12-15 10:14:57 -08:00
Brad Fitzpatrick
f89b5746fb json: some tests to demonstrate bad error messages
Not a fix yet (help wanted), but part of Issue 2331

R=rsc
CC=golang-dev
https://golang.org/cl/5490043
2011-12-15 10:02:47 -08:00
Russ Cox
1b82e03a8f os: make compatible with go/build
It is probably a mistake to have these here at all -
os is supposed to be portable - but this only fixes
the build issue.

R=golang-dev, r, r, iant
CC=golang-dev
https://golang.org/cl/5487073
2011-12-15 12:33:36 -05:00
Christopher Nielsen
d10126a622 os: OS-dependent bits to support NetBSD.
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5482068
2011-12-15 12:19:19 -05:00
Roger Peppe
cebf55dc9b time: new AddDate method
R=rsc
CC=golang-dev
https://golang.org/cl/5465044
2011-12-15 11:23:01 -05:00
Dave Cheney
fc6df2fdd8 exp/ssh: rename ClientAuthPublicKey helper ClientAuthKeyring
Also, rename ServerConfig.PubKeyCallback to PublicKeyCallback.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5477059
2011-12-15 11:06:10 -05:00
Rob Pike
24e9683ae6 fmt: don't recur if String method (etc.) misbehaves
Fixes #2555.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5486076
2011-12-14 16:37:54 -08:00
Andrew Balholm
85fdd68bd9 html: don't leave "in column group" mode when ignoring a token
Pass tests6.dat, test 26:
foo<col>

| <col>

Also pass tests through test 35:
<table><tr><div><td>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5482074
2011-12-15 10:45:19 +11:00
Vadim Vygonets
8fbeb945db gzip: Convert between Latin-1 and Unicode
I realize I didn't send the tests in last time.  Anyway, I added
a test that knows too much about the package's internal structure,
and I'm not sure whether it's the right thing to do.

Vadik.

R=bradfitz, rsc, go.peter.90
CC=golang-dev
https://golang.org/cl/5450073
2011-12-14 17:17:40 -05:00
Vadim Vygonets
58b97a29fd net/smtp: add CRAM-MD5 authentication
R=golang-dev, edsrzf, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5451087
2011-12-14 17:17:25 -05:00
Rob Pike
1402d1a686 html/template: define the FuncMap type locally
This redefinition means that the public signature of html/template
does not refer to text/template.

Fixes #2546.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487083
2011-12-14 11:22:17 -08:00
Brad Fitzpatrick
22dafc9bc5 http: fix failing Transport HEAD request with gzip-looking response
We only want to attempt to un-gzip if there's a body (not in
response to a HEAD)

This was accidentally passing before, but revealed to be broken
when c3c6e72d7cc went in.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5477093
2011-12-14 11:20:21 -08:00
Robert Griesemer
6890afd9a3 strconv: slightly faster int conversion for GOARCH=386
benchmark                           old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatInt         12198        12031   -1.37%
strconv_test.BenchmarkAppendInt          9268         9153   -1.24%
strconv_test.BenchmarkFormatUint         3538         3429   -3.08%
strconv_test.BenchmarkAppendUint         3133         3062   -2.27%

No performance difference for GOARCH=amd64.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5488089
2011-12-14 11:14:10 -08:00
Rob Pike
34c7765fe5 json: treat renamed byte slices the same as []byte
Fixes #2163.

R=rsc
CC=golang-dev
https://golang.org/cl/5488068
2011-12-14 11:03:28 -08:00
Robert Griesemer
465aba66c1 strconv: even faster int conversion
benchmark                           old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatInt         10038         8217  -18.14%
strconv_test.BenchmarkAppendInt          6822         4969  -27.16%
strconv_test.BenchmarkFormatUint         2811         1814  -35.47%
strconv_test.BenchmarkAppendUint         2349         1360  -42.10%

R=rsc
CC=golang-dev
https://golang.org/cl/5488083
2011-12-14 10:45:59 -08:00
Robert Griesemer
25e94154b7 undo CL 5477092 / c3c6e72d7cc5
The obvious fix is breaking the build in non-obvious ways.
Reverting while waiting for the correct fix, if any is needed.

««« original CL description
net/http: fix bug in error checking

Thanks to josef86@gmail.com for pointing this out.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5477092
»»»

R=iant
CC=golang-dev
https://golang.org/cl/5488085
2011-12-14 10:44:34 -08:00
Robert Griesemer
c0421d92c8 net/http: fix bug in error checking
Thanks to josef86@gmail.com for pointing this out.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5477092
2011-12-14 08:43:42 -08:00
Russ Cox
d842acd57e crypto/tls: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5484073
2011-12-14 10:25:48 -05:00
Russ Cox
23cd406496 hash/crc32: make compatible with go/build
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5486060
2011-12-14 10:25:16 -05:00
Russ Cox
576311d72b go/build: make compatible with go/build
The irony!

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482062
2011-12-14 10:24:17 -05:00
Andrew Balholm
e25a83d03e html: close <button> element before opening a new one
Pass tests6.dat, test 13:
<button><button>

| <html>
|   <head>
|   <body>
|     <button>
|     <button>

Also pass tests through test 25:
<table><colgroup>foo

R=nigeltao
CC=golang-dev
https://golang.org/cl/5487072
2011-12-14 21:40:31 +11:00
Christopher Wedgwood
1e63a4e424 runtime: bump gc 'extra bytes' check
(needed for non-zero GOMAXPROCS)

R=iant, rsc
CC=go.peter.90, golang-dev
https://golang.org/cl/5486059
2011-12-13 21:28:43 -08:00
Rob Pike
ba576b2b48 encoding/gob: better error messages when types mismatch
The transmitter must encode an interface value if it is to be decoded
into an interface value, but it's a common and confusing error to
encode a concrete value and attempt to decode it into an interface,
particularly *interface{}. This CL attempts to explain things better.

Fixes #2367.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5485072
2011-12-13 20:40:55 -08:00
Yasuhiro Matsumoto
1c50c32af0 exp/winfsnotify: fix build.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5483057
2011-12-14 13:17:48 +11:00
Joel Sing
7b5ae29afd syscall: regenerate z-files for openbsd
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5414053
2011-12-14 10:46:49 +11:00
Ian Lance Taylor
26239417bb runtime: Make gc_test test extra allocated space, not total space.
Testing total space fails for gccgo when not using split
stacks, because then each goroutine has a large stack, and so
the total memory usage is large.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487068
2011-12-13 15:12:55 -08:00
Rob Pike
64776da456 bufio: make the minimum read buffer size 16 bytes.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/5485067
2011-12-13 15:07:17 -08:00
Brad Fitzpatrick
39213c1fdb strconv: some allocation tests
R=rsc, r
CC=golang-dev
https://golang.org/cl/5477084
2011-12-13 14:49:26 -08:00
Russ Cox
2572803899 math: delete non-Sqrt-based Hypot
I was confused by the existence of two portable Hypot
routines in the tree when I cleaned things up, and I made
ARM use the wrong (imprecise) one.  Use the right one,
and delete the wrong one.

Fixes arm build.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485065
2011-12-13 17:08:56 -05:00
Russ Cox
2c6d3eaf78 undo CL 5414048 / f6b994f33cf4
breaks build

««« original CL description
http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5414048

»»»

R=bradfitz
CC=golang-dev
https://golang.org/cl/5482061
2011-12-13 17:08:18 -05:00
Robert Griesemer
5fb7e5b482 go/printer, godoc: print comments in example code
- go/printer: support for printing CommentedNodes
- go/doc: collect comments from examples

Fixes #2429.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5482052
2011-12-13 14:05:05 -08:00
Roger Peppe
516168057e http: close connection after printing panic stack trace
In a testing situation, it's possible for a local http
server to panic and the test exit without the stack trace
ever being printed.
Fixes #2480.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5414048
2011-12-13 16:34:22 -05:00
Christopher Wedgwood
0e9ee93cea archive/tar: (test) structure comparison not reflect.DeepEqual
R=dsymonds
CC=golang-dev
https://golang.org/cl/5487064
2011-12-14 08:08:49 +11:00
Russ Cox
dd8dc6f059 math: regularize build
This will be nicer to the automatic tools.
It requires a few more assembly stubs
but fewer Go files.

There are a few instances where it looks like
there are new blobs of code, but they are just
being copied out of deleted files.

There is no new code here.

Suppose you have a portable implementation for Sin
and a 386-specific assembly one.  The old way to
do this was to write three files

sin_decl.go
   func Sin(x float64) float64  // declaration only
sin_386.s
   assembly implementation

sin_port.go
   func Sin(x float64) float64 { ... }  // pure-Go impl

and then link in either sin_decl.go+sin_386.s or
just sin_port.go.  The Makefile actually did the magic
of linking in only the _port.go files for those without
assembly and only the _decl.go files for those with
assembly, or at least some of that magic.

The biggest problem with this, beyond being hard
to explain to the build system, is that once you do
explain it to the build system, godoc knows which
of sin_port.go or sin_decl.go are involved on a given
architecture, and it (correctly) ignores the other.
That means you have to put identical doc comments
in both files.

The new approach, which is more like what we did
in the later packages math/big and sync/atomic,
is to have

sin.go
   func Sin(x float64) float64  // decl only
   func sin(x float64) float64 {...}  // pure-Go impl

sin_386.s
   // assembly for Sin (ignores sin)
sin_amd64.s
   // assembly for Sin: jmp sin
sin_arm.s
   // assembly for Sin: jmp sin

Once we abandon Makefiles we can put all the assembly
stubs in one source file, so the number of files will
actually go down.

Chris asked whether the branches cost anything.
Given that they are branching to pure-Go implementations
that are not typically known for their speed, the single
direct branch is not going to be noticeable.  That is,
it's on the slow path.

An alternative would have been to preserve the old
"only write assembly files when there's an implementation"
and still have just one copy of the declaration of Sin
(and thus one doc comment) by doing:

sin.go
   func Sin(x float64) float64 { return sin(x) }

sin_decl.go
   func sin(x float64) float64 // declaration only
sin_386.s
   // assembly for sin

sin_port.go
   func sin(x float64) float64 { portable code }

In this version everyone would link in sin.go and
then either sin_decl.go+sin_386.s or sin_port.go.

This has an extra function call on all paths, including
the "fast path" to get to assembly, and it triples the
number of Go files involved compared to what I did
in this CL.  On the other hand you don't have to
write assembly stubs.  After starting down this path
I decided that the assembly stubs were the easier
approach.

As for generating the assembly stubs on the fly, much
of the goal here is to eliminate magic from the build
process, so that zero-configuration tools like goinstall
or the new go tool can handle this package.

R=golang-dev, r, cw, iant, r
CC=golang-dev
https://golang.org/cl/5488057
2011-12-13 15:20:12 -05:00
Christopher Wedgwood
6f975fbb31 cypto/ocsp: fix tests
Actually compare the result with expected not itself

R=agl, bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5477079
2011-12-13 14:40:28 -05:00
Rob Pike
38df0459ae strconv: make QuoteRune etc. take a rune argument
Just an oversight it didn't already.
Fixes #2515.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5483064
2011-12-13 11:13:23 -08:00
Rob Pike
02f6719d44 strconv: include package and function name in error strings
Fixes #2548.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5484062
2011-12-13 10:42:05 -08:00
Russ Cox
6bf84214c1 godoc: text wrapping
Example:

PACKAGE

package utf8
    import "unicode/utf8"

    Package utf8 implements functions and constants to support text
    encoded in UTF-8.  This package calls a Unicode character a rune for
    brevity.

CONSTANTS

const (
    RuneError = unicode.ReplacementChar // the "error" Rune or "replacement character".
    RuneSelf  = 0x80                    // characters below Runeself are represented as themselves in a single byte.
    UTFMax    = 4                       // maximum number of bytes of a UTF-8 encoded Unicode character.
)
    Numbers fundamental to the encoding.

FUNCTIONS

func DecodeLastRune(p []byte) (r rune, size int)
    DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
    rune and its width in bytes.

func DecodeLastRuneInString(s string) (r rune, size int)
    DecodeLastRuneInString is like DecodeLastRune but its input is a
    string.

func DecodeRune(p []byte) (r rune, size int)
    DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
    and its width in bytes.

func DecodeRuneInString(s string) (r rune, size int)
    DecodeRuneInString is like DecodeRune but its input is a string.

func EncodeRune(p []byte, r rune) int
    EncodeRune writes into p (which must be large enough) the UTF-8
    encoding of the rune.  It returns the number of bytes written.

func FullRune(p []byte) bool
    FullRune reports whether the bytes in p begin with a full UTF-8
    encoding of a rune.  An invalid encoding is considered a full Rune
    since it will convert as a width-1 error rune.

func FullRuneInString(s string) bool
    FullRuneInString is like FullRune but its input is a string.

func RuneCount(p []byte) int
    RuneCount returns the number of runes in p.  Erroneous and short
    encodings are treated as single runes of width 1 byte.

func RuneCountInString(s string) (n int)
    RuneCountInString is like RuneCount but its input is a string.

func RuneLen(r rune) int
    RuneLen returns the number of bytes required to encode the rune.

func RuneStart(b byte) bool
    RuneStart reports whether the byte could be the first byte of an
    encoded rune.  Second and subsequent bytes always have the top two
    bits set to 10.

func Valid(p []byte) bool
    Valid reports whether p consists entirely of valid UTF-8-encoded
    runes.

func ValidString(s string) bool
    ValidString reports whether s consists entirely of valid UTF-8-encoded
    runes.

TYPES

type String struct {
    // contains filtered or unexported fields
}
    String wraps a regular string with a small structure that provides
    more efficient indexing by code point index, as opposed to byte index.
    Scanning incrementally forwards or backwards is O(1) per index
    operation (although not as fast a range clause going forwards).
    Random access is O(N) in the length of the string, but the overhead is
    less than always scanning from the beginning.  If the string is ASCII,
    random access is O(1).  Unlike the built-in string type, String has
    internal mutable state and is not thread-safe.

func NewString(contents string) *String
    NewString returns a new UTF-8 string with the provided contents.

func (s *String) At(i int) rune
    At returns the rune with index i in the String.  The sequence of runes
    is the same as iterating over the contents with a "for range" clause.

func (s *String) Init(contents string) *String
    Init initializes an existing String to hold the provided contents.
    It returns a pointer to the initialized String.

func (s *String) IsASCII() bool
    IsASCII returns a boolean indicating whether the String contains only
    ASCII bytes.

func (s *String) RuneCount() int
    RuneCount returns the number of runes (Unicode code points) in the
    String.

func (s *String) Slice(i, j int) string
    Slice returns the string sliced at rune positions [i:j].

func (s *String) String() string
    String returns the contents of the String.  This method also means the
    String is directly printable by fmt.Print.

Fixes #2479.

R=golang-dev, dsymonds, mattn.jp, r, gri, r
CC=golang-dev
https://golang.org/cl/5472051
2011-12-13 13:33:40 -05:00
Dave Cheney
2b600f77dd exp/ssh: improve client channel close behavior
R=gustav.paul
CC=golang-dev
https://golang.org/cl/5480062
2011-12-13 10:27:17 -05:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
Nigel Tao
66113ac818 html: update comments to match latest spec.
R=dsymonds
CC=golang-dev
https://golang.org/cl/5482054
2011-12-13 14:20:26 +11:00
Nigel Tao
b9064fb132 html: a first step at parsing foreign content (MathML, SVG).
Nodes now have a Namespace field.

Pass adoption01.dat, test 12:
<a><svg><tr><input></a>

| <html>
|   <head>
|   <body>
|     <a>
|       <svg svg>
|         <svg tr>
|           <svg input>

The other adoption01.dat tests already passed.

R=andybalholm
CC=golang-dev
https://golang.org/cl/5467075
2011-12-13 13:52:47 +11:00
Mikio Hara
0643aacee9 syscall: regenerate z-files for darwin, freebsd
R=golang-dev, jsing, rsc
CC=golang-dev
https://golang.org/cl/5479054
2011-12-13 10:27:23 +09:00
Mikio Hara
f6972ba62b net: fix typo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5488052
2011-12-13 10:12:45 +09:00
David Symonds
3dbecd592b various: a grab-bag of time.Duration cleanups.
R=adg, r, rsc
CC=golang-dev
https://golang.org/cl/5475069
2011-12-13 10:42:56 +11:00
Russ Cox
fc7b9fc269 time: allow sleep tests to run for 200% too long
Some VMs are slow.  Very slow.
Fixes #2421.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5482049
2011-12-12 18:33:47 -05:00
Ivan Krasin
b1ae728d19 compress/flate: fix out of bounds error
Fixes #2508.

R=rsc, krasin
CC=golang-dev
https://golang.org/cl/5449115
2011-12-12 18:25:32 -05:00
Christopher Nielsen
26089cfe25 runtime: Changes to the runtime to support NetBSD.
R=rsc
CC=golang-dev
https://golang.org/cl/5477052
2011-12-12 18:10:11 -05:00
Brad Fitzpatrick
06a9bc6835 sql: fix missing mutex unlock in an error case
Fixes #2542

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5483054
2011-12-12 13:56:56 -08:00
Gustavo Niemeyer
3dc278d3e2 reflect: fix Slice cap
R=golang-dev, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5483044
2011-12-12 19:45:40 -02:00
Sébastien Paolacci
e6f5a90b5f runtime: madvise and SysUnused for Linux
SysUnused being a direct call to madvise MADV_DONTNEED.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/5477057
2011-12-12 16:33:13 -05:00
Anthony Martin
2c2a582ae9 os: fix Plan 9 build for new FileInfo API
R=lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/5440073
2011-12-12 16:14:00 -05:00
Anthony Martin
1cb254a085 time: fix Plan 9 build for new API
I had to move readFile into sys_$GOOS.go
since syscall.Open takes only two arguments
on Plan 9.

R=lucio.dere, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5447061
2011-12-12 16:12:22 -05:00
Robert Hencke
d0cf3fa21e time: gob marshaler for Time
Addresses issue 2526

R=rsc, r
CC=golang-dev
https://golang.org/cl/5448114
2011-12-12 16:08:29 -05:00
Charles L. Dorian
f5c211172b math: fix special cases in Nextafter
Nextafter(0, -1) != -0.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5467060
2011-12-12 15:51:11 -05:00
Christopher Nielsen
728c16cf13 build: Changes to the build infrastructure for NetBSD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5476048
2011-12-12 15:42:06 -05:00
Roger Peppe
2cb1aa4681 archive/zip: make zip understand os.FileMode.
Fixes implicit dependency on underlying os file modes.

R=rsc, r, n13m3y3r, gustavo, adg
CC=golang-dev
https://golang.org/cl/5440130
2011-12-12 15:22:55 -05:00
Ian Lance Taylor
68ec347c16 net/http: make test remove temporary file and directory
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5486044
2011-12-12 10:40:15 -08:00
Taru Karttunen
a620f2b73a crypto/aes: Made faster by eliminating some indirection
Made te and td arrays into variables te0-3 and td0-3,
which improves performance from 7000ns/op to 5800.

R=rsc, rogpeppe, agl
CC=golang-dev
https://golang.org/cl/5449077
2011-12-12 09:58:04 -05:00
Andrew Balholm
0c5443a0a6 html: don't ignore whitespace in or after framesets
Pass tests6.dat, test 7:
<frameset></frameset>
foo

| <html>
|   <head>
|   <frameset>
|   "
"

Also pass tests through test 12:
<form><form>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5480061
2011-12-12 13:18:01 +11:00
Rob Pike
e505c9ccac net/http: further simplify example program
(should have caught this in review.)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5478066
2011-12-11 09:29:44 -08:00
Joel Sing
7e797be7a3 exp/norm: fix rune/int types in test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5472067
2011-12-11 09:25:09 -08:00
Lucio De Re
e628144aeb pkg/runtime/Makefile: sorted object module names.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5479060
2011-12-11 09:21:53 -08:00
Olivier Duperray
3308891c9d net/http: fix trivial example server
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5479061
2011-12-11 09:11:57 -08:00
Hector Chu
fdb09d289a time: fix Time.Add
R=rsc, r
CC=golang-dev
https://golang.org/cl/5448121
2011-12-10 21:55:38 +00:00
Robert Hencke
7ab25a441c pkg: adjust "the a" in comments
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5476055
2011-12-10 13:02:23 +11:00
Rob Pike
0244bae672 expvar: fix typo in Publish documentation
Found and fixed by bketelsen@gmail.com.
Not worth making him a CONTRIBUTOR to delete one character.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5476054
2011-12-09 14:24:51 -08:00
Rob Pike
5912869d61 html/template: make Must work
Fixes #2545.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5475054
2011-12-09 10:47:36 -08:00
Russ Cox
fc128403dc gc: minor changes for inlining
Copied from 5400043 since they stand alone from inlining.

R=lvd
CC=golang-dev
https://golang.org/cl/5479046
2011-12-09 08:03:51 -05:00
Russ Cox
41453d2ed2 exp/types: fix linux build
I don't understand why it was only broken on Linux

TBR=gri
CC=golang-dev
https://golang.org/cl/5479045
2011-12-08 23:20:21 -05:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Charles L. Dorian
2065b0a094 math: special cases for Pow10; delete BUG
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5477046
2011-12-08 22:06:33 -05:00
Alex Brainman
27cab90363 syscall: allow for mksyscall_windows.pl to be used outside of syscall
this change should have been part of fafcd328da73

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/5462045
2011-12-09 11:12:03 +11:00
Benny Siegert
5d045fb0f1 syscall: Remove obsolete Errstr call from commented-out example.
syscall_windows.go contains a small demo, which calls the obsolete
syscall.Errstr function.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5475044
2011-12-09 10:42:34 +11:00
Charles L. Dorian
94b0342f17 math: document more special cases
Acosh, Asinh, Atanh, Ceil, Floor, Trunc, Mod and Remainder affected. These changes add some non-finite arguments and results (and -0.0 results).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5469046
2011-12-08 17:07:13 -05:00
Adam Langley
60f564fc37 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.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5471043
2011-12-08 16:46:19 -05:00
Rob Pike
0397b28a90 html/template: clean up locking for ExecuteTemplate
R=mikesamuel, rogpeppe
CC=golang-dev
https://golang.org/cl/5448137
2011-12-08 10:15:53 -08:00
Andrea Spadaccini
83c30f3ec2 syscall: add constants for flock() system call under Linux.
The values have been generated only for the i386 and amd64 architectures.

R=golang-dev, mikioh.mikioh, dsymonds
CC=bradfitz, dsymonds, golang-dev
https://golang.org/cl/5452060
2011-12-08 15:12:08 +09:00
David Symonds
2949f3b659 time: use Duration for AfterFunc.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5465043
2011-12-08 15:42:44 +11:00
Alex Brainman
ef65feda2a syscall: return error, not uintptr, when function returns error
R=rsc
CC=golang-dev
https://golang.org/cl/5450119
2011-12-08 12:07:21 +11:00
Robert Griesemer
2e3bd890c5 strconv: fix documentation
Also: minor performance fix for large precision results.

benchmark                                   old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatFloatDecimal         2734         2734   +0.00%
strconv_test.BenchmarkFormatFloat                3141         3139   -0.06%
strconv_test.BenchmarkFormatFloatExp             8970         8989   +0.21%
strconv_test.BenchmarkFormatFloatBig             3228         3208   -0.62%

Fixes #2535.

R=rsc
CC=golang-dev
https://golang.org/cl/5435089
2011-12-07 14:45:45 -08:00
David Symonds
9d52fe22b4 exp/sql: simplify some string conversions.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5451112
2011-12-08 08:08:00 +11:00
Russ Cox
1278c6c055 bytes: lost edit from earlier CL
R=iant
CC=golang-dev
https://golang.org/cl/5450125
2011-12-07 15:30:01 -05:00
Russ Cox
9b875bc037 bytes: faster Count, Index, Equal
Benchmarks are from GOARCH=amd64 on a MacPro5,1.

benchmark                                    old MB/s     new MB/s  speedup
bytes_test.BenchmarkEqual32                    452.89       891.07    1.97x
bytes_test.BenchmarkEqual4K                    852.71      1700.44    1.99x
bytes_test.BenchmarkEqual4M                    841.53      1587.93    1.89x
bytes_test.BenchmarkEqual64M                   838.22      1578.14    1.88x

bytes_test.BenchmarkIndex32                     58.02        48.99    0.84x
bytes_test.BenchmarkIndex4K                     48.26        41.32    0.86x
bytes_test.BenchmarkIndex4M                     48.20        41.24    0.86x
bytes_test.BenchmarkIndex64M                    48.08        41.21    0.86x
bytes_test.BenchmarkIndexEasy32                410.04       546.82    1.33x
bytes_test.BenchmarkIndexEasy4K                849.26     14257.37   16.79x
bytes_test.BenchmarkIndexEasy4M                854.54     17222.15   20.15x
bytes_test.BenchmarkIndexEasy64M               843.57     11060.40   13.11x

bytes_test.BenchmarkCount32                     57.24        50.68    0.89x
bytes_test.BenchmarkCount4K                     48.19        41.82    0.87x
bytes_test.BenchmarkCount4M                     48.18        41.74    0.87x
bytes_test.BenchmarkCount64M                    48.17        41.71    0.87x
bytes_test.BenchmarkCountEasy32                433.11       547.44    1.26x
bytes_test.BenchmarkCountEasy4K               1130.59     14194.06   12.55x
bytes_test.BenchmarkCountEasy4M               1131.23     17231.18   15.23x
bytes_test.BenchmarkCountEasy64M              1111.40     11068.88    9.96x

The non-easy Count/Index benchmarks are a worst case input.

regexp.BenchmarkMatchEasy0_32                  237.46       221.47    0.93x
regexp.BenchmarkMatchEasy0_1K                  553.53      1019.72    1.84x
regexp.BenchmarkMatchEasy0_32K                 693.99      1672.06    2.41x
regexp.BenchmarkMatchEasy0_1M                  688.72      1611.68    2.34x
regexp.BenchmarkMatchEasy0_32M                 680.70      1565.05    2.30x
regexp.BenchmarkMatchEasy1_32                  165.56       243.08    1.47x
regexp.BenchmarkMatchEasy1_1K                  336.45       496.32    1.48x
regexp.BenchmarkMatchEasy1_32K                 302.80       425.63    1.41x
regexp.BenchmarkMatchEasy1_1M                  300.42       414.20    1.38x
regexp.BenchmarkMatchEasy1_32M                 299.64       413.47    1.38x

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5451116
2011-12-07 15:09:56 -05:00
Russ Cox
2f2cc24cd8 regexp: avoid allocation of input interface
Matters most for small inputs, because there is no real work
to amortize the allocation effort against.

benchmark                                old ns/op    new ns/op    delta
BenchmarkLiteral                               613          473  -22.84%
BenchmarkNotLiteral                           4981         4931   -1.00%
BenchmarkMatchClass                           7289         7122   -2.29%
BenchmarkMatchClass_InRange                   6618         6663   +0.68%
BenchmarkReplaceAll                           7843         7233   -7.78%
BenchmarkAnchoredLiteralShortNonMatch          329          228  -30.70%
BenchmarkAnchoredLiteralLongNonMatch           322          228  -29.19%
BenchmarkAnchoredShortMatch                    838          715  -14.68%
BenchmarkAnchoredLongMatch                     824          715  -13.23%

benchmark                                 old MB/s     new MB/s  speedup
BenchmarkMatchEasy0_32                      119.73       196.61    1.64x
BenchmarkMatchEasy0_1K                      540.58       538.33    1.00x
BenchmarkMatchEasy0_32K                     732.57       714.00    0.97x
BenchmarkMatchEasy0_1M                      726.44       708.36    0.98x
BenchmarkMatchEasy0_32M                     707.77       691.45    0.98x
BenchmarkMatchEasy1_32                      102.12       136.11    1.33x
BenchmarkMatchEasy1_1K                      298.31       307.04    1.03x
BenchmarkMatchEasy1_32K                     273.56       274.43    1.00x
BenchmarkMatchEasy1_1M                      268.42       269.23    1.00x
BenchmarkMatchEasy1_32M                     266.15       267.34    1.00x
BenchmarkMatchMedium_32                       2.53         3.38    1.34x
BenchmarkMatchMedium_1K                       9.37         9.57    1.02x
BenchmarkMatchMedium_32K                      9.29         9.67    1.04x
BenchmarkMatchMedium_1M                       9.42         9.66    1.03x
BenchmarkMatchMedium_32M                      9.41         9.62    1.02x
BenchmarkMatchHard_32                         6.66         6.75    1.01x
BenchmarkMatchHard_1K                         6.81         6.85    1.01x
BenchmarkMatchHard_32K                        6.79         6.85    1.01x
BenchmarkMatchHard_1M                         6.82         6.83    1.00x
BenchmarkMatchHard_32M                        6.80         6.80    1.00x

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5453076
2011-12-07 15:03:05 -05:00
Charles L. Dorian
e4de2e7fd0 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
2011-12-07 14:52:17 -05:00
Peter Mundy
69191553e7 time: fix daysIn for December
daysBefore[12+1]: index out of range
time.December and Windows SYSTEMTIME.wMonth
are 12 for December.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5448130
2011-12-07 14:47:25 -05:00
Robert Griesemer
127b5a66b1 strconv: faster float conversion
- added AppendFloatX benchmarks
- 2% to 13% better performance
- check for illegal bitSize

benchmark                                   old ns/op    new ns/op    delta
strconv_test.BenchmarkFormatFloatDecimal         2993         2733   -8.69%
strconv_test.BenchmarkFormatFloat                3384         3141   -7.18%
strconv_test.BenchmarkFormatFloatExp             9192         9010   -1.98%
strconv_test.BenchmarkFormatFloatBig             3279         3207   -2.20%
strconv_test.BenchmarkAppendFloatDecimal         2837         2478  -12.65%
strconv_test.BenchmarkAppendFloat                3196         2928   -8.39%
strconv_test.BenchmarkAppendFloatExp             9028         8773   -2.82%
strconv_test.BenchmarkAppendFloatBig             3151         2782  -11.71%

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5448122
2011-12-07 10:30:27 -08:00
Gustav Paul
50c24bf6ec 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)

R=dave, agl, rsc, golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5452051
2011-12-07 09:58:22 -05:00
Dmitriy Vyukov
428062da4e ld: increase default stack size on Windows for cgo
Fixes #2437.

R=rsc, hectorchu, mattn.jp, alex.brainman, jdpoirier, snaury, n13m3y3r
CC=golang-dev
https://golang.org/cl/5371049
2011-12-07 16:53:17 +03:00
Brad Fitzpatrick
130e2943a3 http: make Transport warning about connections closing more accurate
It was fragile and non-portable, and then became spammy with
the os.EINVAL removal.  Now it just uses the length of the
Peek return value instead.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5453065
2011-12-06 16:38:02 -08:00
Adam Langley
554ac03637 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.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5440111
2011-12-06 18:25:14 -05:00
Dave Cheney
bf59f081c1 exp/ssh: cleanup client auth tests
This CL cleans up the client auth tests, making the
individual test body more manageable.

Also, adds tests for rsa and dsa key negotiation.

Finally, remove the package level use of the variable
strings, which avoids conflicting with the strings pkg.

R=gustav.paul, agl, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5447049
2011-12-06 18:13:20 -05:00
Robert Griesemer
b219e8cbcf strconv: squeezed a bit more out of int/uint formatting
- less code
- slightly better performance (0-4%)

R=r, rsc
CC=golang-dev
https://golang.org/cl/5448120
2011-12-06 13:54:22 -08:00
Adam Langley
02d1dae106 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.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5453067
2011-12-06 16:42:48 -05:00
Rob Pike
ee8b597b1f 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.

R=mikesamuel
CC=golang-dev
https://golang.org/cl/5437147
2011-12-06 12:47:12 -08:00
Rob Pike
66410bac3d fmt: benchmark floating point.
mallocs per Sprintf("%x"): 1
mallocs per Sprintf("%g"): 4

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449106
2011-12-06 08:40:16 -08:00
Robert Griesemer
e0c006a9b0 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).

Before (best of 3 runs):
strconv_test.BenchmarkFormatInt    100000    15636 ns/op
strconv_test.BenchmarkAppendInt    100000    18930 ns/op
strconv_test.BenchmarkFormatUint   500000     4392 ns/op
strconv_test.BenchmarkAppendUint   500000     5152 ns/op

After (best of 3 runs):

strconv_test.BenchmarkFormatInt    200000    10070 ns/op (-36%)
strconv_test.BenchmarkAppendInt    200000     7097 ns/op (-63%)
strconv_test.BenchmarkFormatUint  1000000     2893 ns/op (-34%)
strconv_test.BenchmarkAppendUint   500000     2462 ns/op (-52%)

R=r, rsc, r
CC=golang-dev
https://golang.org/cl/5449093
2011-12-06 08:15:45 -08:00
Russ Cox
46deaa297b gc: disallow map/func equality via interface comparison
Missed when I removed direct map/func equality.

R=ken2
CC=golang-dev
https://golang.org/cl/5452052
2011-12-06 10:48:17 -05:00
Russ Cox
e4e4cdb39a 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
2011-12-06 10:47:42 -05:00
Dave Cheney
bbbd41f4ff 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.

R=agl, gustav.paul, rsc
CC=golang-dev
https://golang.org/cl/5448073
2011-12-06 09:33:23 -05:00
Rob Pike
0a5508c692 various: we don't cast, we convert
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5437142
2011-12-05 19:40:52 -08:00
Andrew Gerrand
ca7d86c4d3 hash: rewrite comment on Hash.Sum method
Fixes #2530.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/5449101
2011-12-06 14:12:09 +11:00
Rob Pike
2ed57a8cd8 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.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5453053
2011-12-05 16:45:51 -08:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
efbeaedb64 strconv: new API
R=golang-dev, bradfitz, gri, r, agl
CC=golang-dev
https://golang.org/cl/5434095
2011-12-05 15:48:21 -05:00
Luuk van Dijk
40b2fe004f gc: changes in export format in preparation of inlining.
Includes minimal change to gcimporter to keep it working,

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5431046
2011-12-05 14:40:19 -05:00
Charles L. Dorian
abc7df9686 math: add special-cases comments to Sinh and Tanh.
Also change "Special conditions" to "Special cases" as in other functions.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5440078
2011-12-05 14:01:24 -05:00
Rémy Oudompheng
3538d40ab5 crypto/aes: eliminate some bounds checking and manual truncation.
By converting array indices to uint8, they are automatically
constrained in the array range, and the binary AND with 0xff
is no longer needed anymore.

Before:  aes.BenchmarkEncrypt    363 ns/op
After:   aes.BenchmarkEncrypt    273 ns/op

R=golang-dev, gri, agl
CC=golang-dev, remy
https://golang.org/cl/5450084
2011-12-05 13:30:25 -05:00
Russ Cox
b9ccd077dc 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.

R=ken
CC=golang-dev
https://golang.org/cl/5453043
2011-12-05 09:40:22 -05:00
David Symonds
dbaeb0cf13 net/mail: correctly compare parsed times in the test.
Fixes #2522.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5449084
2011-12-05 10:05:29 +11:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
dcf1d7bc0e gofmt -s misc src
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5451079
2011-12-02 14:14:25 -05:00
Gustav Paul
bd9dc3d55f 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.

R=golang-dev, rsc, dave, agl
CC=golang-dev
https://golang.org/cl/5432065
2011-12-02 10:34:42 -05:00
Robert Hencke
6f0ef845e6 asn1: fix incorrect prints found by govet
R=golang-dev
CC=golang-dev
https://golang.org/cl/5449063
2011-12-02 10:13:02 -05:00
Mikio Hara
cf4acf80b4 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.

R=cw, golang-dev
CC=golang-dev
https://golang.org/cl/5447071
2011-12-02 23:18:16 +09:00
Rob Pike
30775f67e7 encoding/gob: don't send type info for unexported fields
Fixes #2517.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5440079
2011-12-02 00:02:24 -08:00
Benny Siegert
2a876beb18 os/exec: make LookPath always search the current directory under Windows.
cmd.exe implicitly looks in "." before consulting PATH.
LookPath should match this behavior.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5434093
2011-12-02 14:29:24 +11:00
Rob Pike
e6b3371781 template: move the empty check into parse, which needs it when constructing
tree sets.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449062
2011-12-01 17:24:54 -08:00
Andrew Balholm
a5d300862b html: allow whitespace between head and body
Also ignore <head> tag after </head>.

Pass tests6.dat, test 0:
<!doctype html></head> <head>

| <!DOCTYPE html>
| <html>
|   <head>
|   " "
|   <body>

Also pass tests through test 6:
<body>
<div>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5447064
2011-12-02 11:46:24 +11:00
Robert Griesemer
6ea3a268b6 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:

/home/gri/go3/src/cmd/goinstall (package documentation)
        Remote Repositories
        The GOPATH Environment Variable
/home/gri/go3/src/pkg/exp/gotype (package documentation)
        Examples
/home/gri/go3/src/pkg/html/template (package template)
        Introduction
        Contexts
        Errors
        A fuller picture
        Contexts
        Typed Strings
        Security Model
/home/gri/go3/src/pkg/text/template (package template)
        Actions
        Arguments
        Pipelines
        Variables
        Examples
        Functions
        Associated templates
        Nested template definitions
18 headings found

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5437105
2011-12-01 15:14:15 -08:00
Robert Griesemer
15a3a5cf6c gofmt: applied gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5451070
2011-12-01 14:33:24 -08:00
Robert Griesemer
e281576b9a go/doc: switch ToHTML from []byte to string argument
- this removes extra conversions from strings to bytes and vice versa
  for each comment
- minor cleanups

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5434096
2011-12-01 13:46:57 -08:00
Robert Griesemer
bc9ce6a129 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
2011-12-01 11:50:15 -08:00
Rob Pike
473de60359 time: update doc string for Error method
Fixes #2512.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5449057
2011-12-01 11:44:17 -08:00
Gustavo Niemeyer
d2b77bb194 os: add ModeType constant to mask file type bits
This covers the lack of IsRegular comfortably:

    if stat.Mode()&os.ModeType == 0 { ... }

R=golang-dev, r, rsc, r, gustavo
CC=golang-dev
https://golang.org/cl/5440075
2011-12-01 17:35:43 -02:00
Brad Fitzpatrick
744fb52102 os: be consistent with receiver names for godoc TOC alignment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5449056
2011-12-01 11:23:39 -08:00
Gustav Paul
fad57c0c03 exp/ssh: export type signal. Renamed to Signal
R=dave, agl, rsc, golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5450059
2011-12-01 14:06:15 -05:00
Volker Dobler
a6729b3085 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
2011-12-01 09:49:58 -08:00
Alex Brainman
d5f37122d2 crypto/tls: cleanup certificate load on windows
- correct syscall.CertEnumCertificatesInStore so it returns error
- remove "reflect" dependency

R=hectorchu, agl, rsc
CC=golang-dev, krautz
https://golang.org/cl/5441052
2011-12-01 12:38:00 -05:00
Adam Langley
bac7bc55a6 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.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Rob Pike
d38cc47c0c text/template: replace Add with AddParseTree
Makes it clear we're adding exactly one tree and creating a
new template for it.

R=rsc
CC=golang-dev
https://golang.org/cl/5448077
2011-12-01 09:19:53 -08:00
Dave Cheney
c4d0ac0e2f exp/ssh: add Std{in,out,err}Pipe methods to Session
R=gustav.paul, cw, agl, rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/5433080
2011-12-01 08:30:16 -02:00
Alex Brainman
68e30a9765 time: fix windows build
R=rsc
CC=golang-dev
https://golang.org/cl/5440071
2011-12-01 15:26:28 +11:00
Rob Pike
9a86e244bf 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.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5450056
2011-11-30 20:11:57 -08:00
Andrew Balholm
ce27b00f48 html: implement fragment parsing algorithm
Pass the tests in tests4.dat.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5447055
2011-12-01 12:47:57 +11:00
Joel Sing
595efd0d20 syscall: fix openbsd sysctl hostname/domainname workaround
Fixes #2509.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5451055
2011-12-01 10:17:33 +11:00
Rob Pike
07ee3cc741 html/template: update to new template API
Not quite done yet but enough is here to review.

Embedding is eliminated so clients can't accidentally reach
methods of text/template.Template that would break the
invariants.

TODO later: Add and Clone are unimplemented.
TODO later: address issue 2349

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5434077
2011-11-30 17:42:18 -05:00
Dave Cheney
0e62c75b9d undo CL 5436056 / 03560deae933
Remove the accidentally exported net.Listener

««« original CL description
exp/ssh: remove unused forwarding methods in Server Listener

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5436056

»»»

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5437090
2011-11-30 17:14:03 -05:00
Russ Cox
97197a6248 time: fix windows build
TBR=brainman
CC=golang-dev
https://golang.org/cl/5447057
2011-11-30 15:45:24 -05:00
Charles L. Dorian
06e635e46d math: faster Sincos
Sincos via sincos.go is 35.4 ns/op, via sincos_amd64.s is 37.4 ns/op on 2.53 GHz Intel Core 2 Duo (Mac OS X).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5447045
2011-11-30 15:11:44 -05:00
Russ Cox
e62622b1b1 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).

TBR=brainman
CC=golang-dev
https://golang.org/cl/5434090
2011-11-30 13:42:14 -05:00