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

4505 Commits

Author SHA1 Message Date
David Symonds
75af79b9b5 net/http: fix whitespace handling in sniffer.
A single character typo ("\n" instead of "\r") meant that
HTML data using DOS line breaks (CRLF) was not detected as HTML.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5365041
2011-11-07 11:55:33 +11:00
Alex Brainman
603d80c28d runtime: windows_386 sighandler to use correct g
Fixes #2403.

R=hectorchu
CC=golang-dev
https://golang.org/cl/5309071
2011-11-07 11:00:14 +11:00
Nigel Tao
bbd173fc3d html: be able to test more than one testdata file.
R=andybalholm
CC=golang-dev
https://golang.org/cl/5351041
2011-11-07 09:38:40 +11:00
Charles L. Dorian
c171633780 math: faster Gamma
Having the compiler count the number of array elements speeds up Gamma from 63.7 to 56.6 ns/op.

R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/5362043
2011-11-05 12:25:36 -07:00
Charles L. Dorian
377ac335af math: improved high-angle test for Cos, Sin and Tan
Maximum error for 386 is "close" (1e-14). For amd64, it's "veryclose" (4e-16).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5340042
2011-11-04 15:35:59 -04:00
Mike Samuel
a5291099d2 html/template: wraps package template instead of exposing func Escape
This does escaping on first execution.

template.go defines the same interface elements as package template.
It requires rather more duplication of code than I'd like, but I'm
not clear how to avoid that.

Maybe instead of

    mySet.ParseGlob(...)
    template.ParseSetGlob(...)
    mySet.ParseFiles(...)
    mySet.ParseTemplateFiles(...)
    template.ParseTemplateFiles(...)

we combine these into a fileset abstraction that can be wrapped

    var fileset template.FileSet
    fileset.Glob(...)  // Load a few files by glob
    fileset.Files(...)  // Load a few {{define}}d files
    fileset.TemplateFiles(...)  // Load a few files as template bodies
    fileset.Funcs(...)  // Make the givens func available to templates
    // Do the parsing.
    set, err := fileset.ParseSet()
    // or set, err := fileset.ParseInto(set)

or provide an interface that can receive filenames and functions and
parse messages:

    type Bundle interface {
      TemplateFile(string)
      File(string)
      Funcs(FuncMap)
    }

and define template.Parse* to handle the file-system stuff and send
messages to a bundle:

    func ParseFiles(b Bundle, filenames ...string)

R=r, r
CC=golang-dev
https://golang.org/cl/5270042
2011-11-04 13:09:21 -04:00
Brad Fitzpatrick
b14ee23f9b http: support Trailers in ReadRequest
Available after closing Request.Body.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5348041
2011-11-04 09:17:46 -07:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Gustavo Niemeyer
f2dc50b48d html,bzip2,sql: rename Error methods that return error to Err
There are three classes of methods/functions called Error:

a) The Error method in the just introduced error interface
b) Error methods that create or report errors (http.Error, etc)
c) Error methods that return errors previously associated with
   the receiver (Tokenizer.Error, rows.Error, etc).

This CL introduces the convention that methods in case (c)
should be named Err.

The reasoning for the change is:

- The change differentiates the two kinds of APIs based on
  names rather than just on signature, unloading Error a bit
- Err is closer to the err variable name that is so commonly
  used with the intent of verifying an error
- Err is shorter and thus more convenient to be used often
  on error verifications, such as in iterators following the
  convention of the sql package.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5327064
2011-11-04 09:50:20 -04:00
David Symonds
39fcca60cb template: format error with pointer receiver.
This is a continuation of 982d70c6d5d6.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5348042
2011-11-04 23:45:38 +11:00
Russ Cox
7f5ae484eb runtime: fix linux/arm nanotime?
TBR=r
CC=golang-dev
https://golang.org/cl/5354041
2011-11-04 08:38:10 -04:00
Russ Cox
e73680aec0 template: format errors
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5340043
2011-11-04 07:33:55 -04:00
Russ Cox
cb2040b2ab runtime: fix openbsd nanotime?
TBR=r
CC=golang-dev
https://golang.org/cl/5353041
2011-11-04 07:24:39 -04:00
Andrew Gerrand
ed92549071 bytes: fix typo and resolve to be less idiotic next time
R=bradfitz
CC=golang-dev
https://golang.org/cl/5340044
2011-11-04 17:55:21 +11:00
Andrew Gerrand
1a4402a1fe bytes: add Contains function
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5349041
2011-11-04 17:46:52 +11:00
Andrew Balholm
632a2c59b1 html: properly close <tr> element when an new <tr> starts.
Pass tests1.dat, test 87:
<table><tr><tr><td><td><span><th><span>X</table>

| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|         <tr>
|           <td>
|           <td>
|             <span>
|           <th>
|             <span>
|               "X"

R=nigeltao
CC=golang-dev
https://golang.org/cl/5343041
2011-11-04 15:48:11 +11:00
Brad Fitzpatrick
0865c57f25 http: doc nits
Remove the last two "convenience" mentions.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5344041
2011-11-03 20:37:02 -07:00
Brad Fitzpatrick
3b901f4515 http: clarify Request docs
R=rsc
CC=golang-dev
https://golang.org/cl/5342041
2011-11-03 20:05:13 -07:00
Brad Fitzpatrick
28564d60eb httputil: move dump and chunking functions out of http
This moves DumpRequest, DumpResponse, NewChunkedReader,
and NewChunkedWriter out of http, as part of the continued
http diet plan.

Also, adds DumpRequestOut (for dumping outbound requests),
since DumpRequest's ambiguity (the "wire representation" in
what direction?) was often a source of confusion and bug
reports.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/5339041
2011-11-03 18:12:51 -07:00
Rob Pike
88cf76a9b3 gob: fix bug when registering the same type multiple times
Need to compare user type, not base type.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5340041
2011-11-03 18:05:14 -07:00
Brad Fitzpatrick
a494c20032 http: only recognize application/x-www-form-urlencoded in ParseForm
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5322070
2011-11-03 17:21:58 -07:00
Brad Fitzpatrick
54049767ae httputil: move ReverseProxy out of http
http diet plan, continued.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5305090
2011-11-03 15:54:08 -07:00
Andrew Balholm
46308d7d11 html: move <link> element from after <head> into <head>
Pass tests1.dat, test 85:
<head><meta></head><link>

| <html>
|   <head>
|     <meta>
|     <link>
|   <body>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5297079
2011-11-04 09:29:06 +11:00
Brad Fitzpatrick
a7f1141dee net/http/httputil: new package; move ClientConn and ServerConn
Part of http diet plan.

More of the lesser-used and newcomer-misleading parts of http will
move here.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5336049
2011-11-03 14:44:29 -07:00
Russ Cox
f437331f80 time: faster Nanoseconds call
runtime knows how to get the time of day
without allocating memory.

R=golang-dev, dsymonds, dave, hectorchu, r, cw
CC=golang-dev
https://golang.org/cl/5297078
2011-11-03 17:35:28 -04:00
Russ Cox
31452a3618 runtime: fix set and not used
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5305087
2011-11-03 17:35:11 -04:00
Rob Pike
37d82c8520 os,text,unicode: renamings
This is Go 1 package renaming CL #4.
This one merely moves the source; the import strings will be
changed after the next weekly release.
This one moves pieces into os, text, and unicode.

exec -> os/exec
scanner -> text/scanner
tabwriter -> text/tabwriter
template -> text/template
template/parse -> text/template/parse
utf16 -> unicode/utf16
utf8 -> unicode/utf8

This should be the last of the source-rearranging CLs.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5331066
2011-11-03 14:18:06 -07:00
Vincent Vanackere
eb1717e035 all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050
2011-11-03 14:01:30 -07:00
Rob Pike
de03d502c7 net: renamings
This is Go 1 package renaming CL #3.
This one merely moves the source; the import strings will be
changed after the next weekly release.
This one moves pieces into net.

http -> net/http
http/cgi -> net/http/cgi
http/fcgi -> net/http/fcgi
http/pprof -> net/http/pprof
http/httptest -> net/http/httptest
mail -> net/mail
rpc -> net/rpc
rpc/jsonrpc -> net/rpc/jsonrpc
smtp -> net/smtp
url -> net/url

Also remove rand (now math/rand) from NOTEST - it has a test.

The only edits are in Makefiles and deps.bash.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5335048
2011-11-03 13:26:43 -07:00
Rob Pike
5cb4a15320 html,log,math: renamings
This is Go 1 package renaming CL #2.
This one merely moves the source; the import strings will be
changed after the next weekly release.

exp/template/html -> html/template
big -> math/big
cmath -> math/cmplx
rand -> math/rand
syslog -> log/syslog

The only edits are in Makefiles and deps.bash.

Note that this CL moves exp/template/html out of exp. I decided
to do that so all the renamings can be done together, even though
the API (and that of template, for that matter) is still fluid.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5332053
2011-11-03 12:42:57 -07:00
Brad Fitzpatrick
53493a22fe http: don't use ClientConn in Transport
ClientConn's main feature (pipelining support)
wasn't being used anyway.  Ends up simpler to
just not use it.

This is prep for the http diet, moving ClientConn,
ServerConn, etc into http/httputil.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5305088
2011-11-03 12:35:56 -07:00
Russ Cox
41dc7d3a99 container/heap: document what Push and Pop do
Now that vector is gone, there is no precedent to refer to.
This is a confusing point for people looking to use the
package.

R=golang-dev, r, cw
CC=golang-dev
https://golang.org/cl/5322069
2011-11-03 15:30:57 -04:00
Rob Pike
d615a5255d deps.bash: attempt to fix the windows build
Use simpler shell constructs.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5297080
2011-11-03 12:19:07 -07:00
Rob Pike
f4cd80224a encoding: move asn1, csv, gob, json, xml into encoding
This is Go 1 package renaming CL #1.
This one merely moves the source; the import strings will be
changed after the next weekly release.

The only edits are in Makefiles.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5331060
2011-11-03 11:39:52 -07:00
Andrew Balholm
77aabbf217 html: parse <link> elements in <head>
Pass tests1.dat, test 83:
<title><meta></title><link><title><meta></title>

| <html>
|   <head>
|     <title>
|       "<meta>"
|     <link>
|     <title>
|       "<meta>"
|   <body>

Also pass test 84:
<style><!--</style><meta><script>--><link></script>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5331061
2011-11-03 17:12:13 +11:00
Andrew Gerrand
1c530d5d78 builtin: remove errant spaces
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5337041
2011-11-03 14:52:38 +11:00
David Symonds
e4b464242a http: update mime sniffing doc reference.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5303095
2011-11-03 14:34:35 +11:00
Fumitoshi Ukai
de3d647252 websocket: return an error HTTP response for bad websocket request.
websocket spec had changed server-side requiements to return
an HTTP response with an appropriate error code (such as 400 Bad
Request) when it finds client did not send a handshake that matches
websocket protocol, rather than just closing connection.
It needs to flush out response before closing connection.
Fixes issues 2396.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5318072
2011-11-03 14:13:39 +11:00
Andrew Balholm
cf6a712162 html: properly close <marquee> elements.
Pass tests1.dat, test 80:
<a href=a>aa<marquee>aa<a href=b>bb</marquee>aa

| <html>
|   <head>
|   <body>
|     <a>
|       href="a"
|       "aa"
|       <marquee>
|         "aa"
|         <a>
|           href="b"
|           "bb"
|       "aa"

Also pass tests through test 82:
<!DOCTYPE html><spacer>foo

R=nigeltao
CC=golang-dev
https://golang.org/cl/5319071
2011-11-03 10:11:06 +11:00
Russ Cox
965845a86d all: sort imports
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5319072
2011-11-02 15:54:16 -04:00
Russ Cox
4a9ebb18f1 gofmt, gofix: sort imports
Add ast.SortImports(fset, file) to go/ast, for use by both programs.

Fixes #346.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5330069
2011-11-02 15:53:57 -04:00
Rob Pike
7db617b474 builtin: document the basic types
The recursive definitions are illegal Go, but godoc doesn't mind.

R=bradfitz, r, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5322067
2011-11-02 12:06:36 -07:00
Brad Fitzpatrick
8089e57812 exp/sql: finish transactions, flesh out types, docs
Fixes #2328 (float, bool)

R=rsc, r
CC=golang-dev
https://golang.org/cl/5294067
2011-11-02 11:46:04 -07:00
Charles L. Dorian
cefee3c919 math: improved accuracy for Tan
R=rsc
CC=golang-dev
https://golang.org/cl/5298087
2011-11-02 14:01:21 -04:00
Brad Fitzpatrick
bd43eac303 bufio: return nil line from ReadLine on error, as documented
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5316069
2011-11-02 08:30:50 -07:00
Dmitriy Vyukov
ee24bfc058 runtime: unify mutex code across OSes
The change introduces 2 generic mutex implementations
(futex- and semaphore-based). Each OS chooses a suitable mutex
implementation and implements few callbacks (e.g. futex wait/wake).
The CL reduces code duplication, extends some optimizations available
only on Linux/Windows to other OSes and provides ground
for futher optimizations. Chan finalizers are finally eliminated.

(Linux/amd64, 8 HT cores)
benchmark                      old      new
BenchmarkChanContended         83.6     77.8 ns/op
BenchmarkChanContended-2       341      328 ns/op
BenchmarkChanContended-4       382      383 ns/op
BenchmarkChanContended-8       390      374 ns/op
BenchmarkChanContended-16      313      291 ns/op

(Darwin/amd64, 2 cores)
benchmark                      old      new
BenchmarkChanContended         159      172 ns/op
BenchmarkChanContended-2       6735     263 ns/op
BenchmarkChanContended-4       10384    255 ns/op
BenchmarkChanCreation          1174     407 ns/op
BenchmarkChanCreation-2        4007     254 ns/op
BenchmarkChanCreation-4        4029     246 ns/op

R=rsc, jsing, hectorchu
CC=golang-dev
https://golang.org/cl/5140043
2011-11-02 16:42:01 +03:00
Nigel Tao
5e4e8f49c5 json: fix typo in scanner_test.go.
R=dsymonds
CC=golang-dev
https://golang.org/cl/5303092
2011-11-02 18:03:45 +11:00
Alex Brainman
b43cf81c8c net: implement LookupTXT for windows
R=rsc
CC=golang-dev
https://golang.org/cl/5318056
2011-11-02 17:11:40 +11:00
Andrew Gerrand
4d3c999086 builtin: document built-in error type
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5307080
2011-11-02 15:03:36 +09:00
Russ Cox
492098eb75 all: rename os.Error to error in various non-code contexts
R=adg
CC=golang-dev
https://golang.org/cl/5328062
2011-11-01 22:58:09 -04:00
Russ Cox
abd3260990 os: fixes for error (plan9)
The Plan 9 build stops in runtime,
but might as well fix these anyway.

R=adg
CC=golang-dev
https://golang.org/cl/5336045
2011-11-01 22:19:40 -04:00
Russ Cox
f7b7338ec2 net: update for error (linux)
R=adg
CC=golang-dev
https://golang.org/cl/5303091
2011-11-01 22:18:16 -04:00
Russ Cox
f1b64aa758 os, syscall: update for error
R=adg
CC=golang-dev
https://golang.org/cl/5333052
2011-11-01 22:12:41 -04:00
Russ Cox
eb6929299b src/pkg/[n-z]*: gofix -r error -force=error
R=golang-dev, bsiegert, iant
CC=golang-dev
https://golang.org/cl/5294074
2011-11-01 22:05:34 -04:00
Russ Cox
c2049d2dfe src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5322051
2011-11-01 22:04:37 -04:00
Russ Cox
451a1fa46d exec: introduce ExitError
The existing code uses *os.Waitmsg as an os.Error,
but *os.Waitmsg is really just a stringer.

Introduce an explicit error type for the real error.

Not to be submitted until just before error goes in;
the gofix for error updates type assertions
        err.(*os.Waitmsg)
to
        err.(*exec.ExitError)

The seemingly redundant String method will become
an Error method when error goes in, and will no longer
be redundant.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5331044
2011-11-01 21:49:44 -04:00
Russ Cox
c93b6a1756 exp/ebnf: manual fixup for error
(The definition of ErrorList is in another file, so gofix
has no hope of getting this right.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5330043
2011-11-01 21:49:33 -04:00
Russ Cox
08a073a180 os: use error, io.EOF
R=r
CC=golang-dev
https://golang.org/cl/5298073
2011-11-01 21:49:08 -04:00
Russ Cox
c06cf03f0b io: use error, add EOF, avoid os
R=r, r
CC=golang-dev
https://golang.org/cl/5311068
2011-11-01 21:48:52 -04:00
Russ Cox
c14f71c788 runtime: update for error
R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/5306075
2011-11-01 21:48:27 -04:00
Russ Cox
e67d3c44f7 exp/types: add error type to universe
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5327051
2011-11-01 21:47:33 -04:00
Russ Cox
e4ae30f5f5 errors: new package
The only function is errors.New, at least for now.

R=r, gustavo, adg, r
CC=golang-dev
https://golang.org/cl/5321061
2011-11-01 21:46:59 -04:00
Russ Cox
b4e35629ed http: avoid name error in test
R=adg
CC=golang-dev
https://golang.org/cl/5316070
2011-11-01 21:45:37 -04:00
Andrew Balholm
22ee5ae25a html: stop at scope marker node when generating implied </a> tags
A <a> tag generates implied end tags for any open <a> elements.
But it shouldn't do that when it is inside a table cell the the open <a>
is outside the table.
So stop the search for an open <a> when we reach a scope marker node.

Pass tests1.dat, test 78:
<a href="blah">aba<table><tr><td><a href="foo">br</td></tr>x</table>aoe

| <html>
|   <head>
|   <body>
|     <a>
|       href="blah"
|       "abax"
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <a>
|                 href="foo"
|                 "br"
|       "aoe"

Also pass test 79:
<table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe

R=nigeltao
CC=golang-dev
https://golang.org/cl/5320063
2011-11-02 11:47:05 +11:00
Nigel Tao
90b76c0f3e html: refactor the blacklist for the "render and re-parse" test.
R=andybalholm
CC=golang-dev, mikesamuel
https://golang.org/cl/5331056
2011-11-02 09:42:25 +11:00
Mike Solomon
f753e3facd textproto: prevent long lines in HTTP headers from causing HTTP 400 responses.
This fixes the issue without an extra copy in the average case.

R=golang-dev, ality, bradfitz
CC=golang-dev
https://golang.org/cl/5272049
2011-11-01 10:31:29 -07:00
Russ Cox
2e79e8e549 rpc: avoid infinite loop on input error
Fixes #1828.
Fixes #2179.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5305084
2011-11-01 00:29:41 -04:00
Russ Cox
7b04471dfa gopack: change archive file name length back to 16
This CL grew the archive file name length from 16 to 64:

        changeset:   909:58574851d792
        user:        Russ Cox <rsc@golang.org>
        date:        Mon Oct 20 13:53:56 2008 -0700

Back then, every x.go file in a package became an x.6 file
in the archive.  It was important to be able to allow the
use of long Go source file names, hence the increase in size.

Today, all Go source files compile into a single _go_.6 file
regardless of their names, so the archive file name length
no longer needs to be long.  The longer name causes some
problems on Plan 9, where the native archive format is the
same but with 16-byte names, so revert back to 16.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5333050
2011-11-01 00:29:16 -04:00
Russ Cox
4853c51770 os: do not interpret 0-length read as EOF
Fixes #2402.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5298081
2011-11-01 00:17:05 -04:00
Andrew Balholm
9db3f78c39 html: process </td> tags; foster parent at most one node per token
Correctly close table cell when </td> is read.

Because of reconstructing the active formatting elements, more than one
node may be created when reading a single token.
If both nodes are foster parented, they will be siblings, but the first
node should be the parent of the second.

Pass tests1.dat, test 77:
<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe

| <html>
|   <head>
|   <body>
|     <a>
|       href="blah"
|       "aba"
|       <a>
|         href="foo"
|         "br"
|       <a>
|         href="foo"
|         "x"
|       <table>
|         <tbody>
|           <tr>
|             <td>
|     <a>
|       href="foo"
|       "aoe"

R=nigeltao
CC=golang-dev
https://golang.org/cl/5305074
2011-11-01 11:42:54 +11:00
Scott Lawrence
cae23f036a template: fix error checking on execute without parse
Fixed error checking in exec.go to give a sensible error message when
execution is attempted before a successful parse (rather than an
outright panic).

R=r
CC=golang-dev
https://golang.org/cl/5306065
2011-10-31 16:07:17 -07:00
Russ Cox
92926f5472 pkg: minor cleanup
remove some redundant .String()
change variable name to make it os.Error-proof

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5302075
2011-10-31 17:53:39 -04:00
Russ Cox
d0eaa58b5a runtime/pprof: document OS X being broken
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5307078
2011-10-31 17:50:25 -04:00
Scott Lawrence
a7e473be95 time: add RFC1123 with numeric timezone format
Fixes #841.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5322058
2011-10-31 12:59:06 -07:00
Charles L. Dorian
739c442e42 math: Improved accuracy for Sin and Cos.
Fixes #1564.

R=rsc, dchest
CC=golang-dev
https://golang.org/cl/5320056
2011-10-31 14:26:05 -04:00
Alexander Reece
48c75c5f9c json: Properly handle nil slices.
Marshal nil slices as null and parse null value as a nil slice.
Fixes #2278.

R=rsc
CC=golang-dev
https://golang.org/cl/5257053
2011-10-31 13:59:23 -04:00
Andrey Mirtchovski
d1f48db1cc syscall: fix Await msg on Plan 9
Plan 9's await() returns '' for nil exit status but programs, most notably gotest,
see this as an error return.

R=rsc
CC=golang-dev
https://golang.org/cl/5305079
2011-10-31 13:34:59 -04:00
Luuk van Dijk
50110c9f83 gc: clean up printing.
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.

fixes #2361

R=rsc
CC=golang-dev
https://golang.org/cl/5316043
2011-10-31 18:09:40 +01:00
Fazlul Shahriar
5842336089 net: Plan 9 fixes
Makes all tests pass.

R=rsc
CC=golang-dev
https://golang.org/cl/5320041
2011-10-31 11:47:44 -04:00
Marcel van Lohuizen
eef7809193 exp/norm: fixed bug that creeped in with moving to the new
regexp, which caused the last line of a test block to be ignored.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5177052
2011-10-31 10:58:04 +01:00
Dave Cheney
0f6b80c694 exp/ssh: fix length header leaking into channel data streams.
The payload of a data message is defined as an SSH string type,
which uses the first four bytes to encode its length. When channelData
and channelExtendedData were added I defined Payload as []byte to
be able to use it directly without a string to []byte conversion. This
resulted in the length data leaking into the payload data.

This CL fixes the bug, and restores agl's original fast path code.

Additionally, a bug whereby s.lock was not released if a packet arrived
for an invalid channel has been fixed.

Finally, as they were no longer used, I have removed
the channelData and channelExtedendData structs.

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5330053
2011-10-29 14:22:30 -04:00
Andrew Balholm
604e10c34d html: adjust bookmark in "adoption agency" algorithm
In the adoption agency algorithm, the formatting element is sometimes
removed from the list of active formatting elements and reinserted at a later index.
In that case, the bookmark showing where it is to be reinserted needs to be moved,
so that its position relative to its neighbors remains the same
(and also so that it doesn't become out of bounds).

Pass tests1.dat, test 70:
<DIV> abc <B> def <I> ghi <P> jkl </B>

| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|         <p>
|           <b>
|             " jkl "

Also pass tests through test 76:
<test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->

R=nigeltao
CC=golang-dev
https://golang.org/cl/5322052
2011-10-29 10:51:59 +11:00
Andrew Balholm
03f163c7f2 html: don't run "adoption agency" on elements that aren't in scope.
Pass tests1.dat, test 55:
<!DOCTYPE html><font><table></font></table></font>

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <font>
|       <table>

Also pass tests through test 69:
<DIV> abc <B> def <I> ghi <P> jkl

R=nigeltao
CC=golang-dev
https://golang.org/cl/5309074
2011-10-28 16:04:58 +11:00
Russ Cox
0e81e508be fmt: handle os.Error values
Handling os.Error is no different than handling fmt.Stringer
here, so the code is redundant now, but it will be necessary
once error goes in.

Adding it now will make gofix fix it.

R=r
CC=golang-dev
https://golang.org/cl/5331045
2011-10-27 21:20:44 -07:00
Russ Cox
853c84631f template: do not use error as stringer
R=r
CC=golang-dev
https://golang.org/cl/5305069
2011-10-27 21:17:47 -07:00
Russ Cox
c0a0fd6cf4 gob: split uses of gobError, remove unnecessary embedding
Will make gofix for error run more smoothly.
The overloading of gobError appears to be unintentional.

R=r
CC=golang-dev
https://golang.org/cl/5308060
2011-10-27 20:20:59 -07:00
Russ Cox
c1178aae86 strconv: use better errors than os.EINVAL, os.ERANGE
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5327052
2011-10-27 19:46:31 -07:00
Russ Cox
01e9a227cc crypto/tls: add Error method to alert
alerts get used as both values and errors.
Rather than introduce an alertError wrapper,
this CL just adds an Error method, which will
satisfy the error interface when the time comes.

R=agl, bradfitz
CC=golang-dev
https://golang.org/cl/5294073
2011-10-27 19:42:32 -07:00
Russ Cox
29fb5d3e0f xml: simplify test
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5320051
2011-10-27 19:40:41 -07:00
Russ Cox
134d6e4fc4 go/build: avoid os.Error in tests
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5308061
2011-10-27 19:39:40 -07:00
Russ Cox
2b0c49f2e5 go/doc: remove os.NewError anti-heuristic
It will be obsolete when error happens.

Submitting this now will make the error transition earlier,
at the cost of making a locally-built godoc viewing
/pkg/syscall or /pkg/os have some functions appear
under the Error type as constructors.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5305067
2011-10-27 19:39:25 -07:00
Russ Cox
7f91a39d3d encoding/binary: fix type in test
Was working only accidentally.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5303082
2011-10-27 19:38:57 -07:00
Russ Cox
6715551768 crypto/openpgp/error: use Error in names of error impl types
Will make gofix for error work better.
There is no other indication in this file that
these are actually error implementations.

(They are only used elsewhere.)

R=bradfitz
CC=golang-dev
https://golang.org/cl/5305068
2011-10-27 19:38:32 -07:00
Russ Cox
785baa86f1 html: fix print argument in test
R=nigeltao
CC=golang-dev
https://golang.org/cl/5302069
2011-10-27 18:04:29 -07:00
Russ Cox
6808da0163 runtime: lock the main goroutine to the main OS thread during init
We only guarantee that the main goroutine runs on the
main OS thread for initialization.  Programs that wish to
preserve that property for main.main can call runtime.LockOSThread.
This is what programs used to do before we unleashed
goroutines during init, so it is both a simple fix and keeps
existing programs working.

R=iant, r, dave, dvyukov
CC=golang-dev
https://golang.org/cl/5309070
2011-10-27 18:04:12 -07:00
Russ Cox
32f3770ec5 pkg: remove .String() from some print arguments
I found these by adding a check to govet, but the check
produces far too many false positives to be useful.
Even so, these few seem worth cleaning up.

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5311067
2011-10-27 18:03:52 -07:00
Andrew Balholm
053549ca1b html: allow whitespace text nodes in <head>
Pass tests1.dat, test 50:
<!DOCTYPE html><script> <!-- </script> --> </script> EOF

| <!DOCTYPE html>
| <html>
|   <head>
|     <script>
|       " <!-- "
|     " "
|   <body>
|     "-->  EOF"

Also pass tests through test 54:
<!DOCTYPE html><title>U-test</title><body><div><p>Test<u></p></div></body>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5311066
2011-10-28 09:06:30 +11:00
Russ Cox
fd31d9fd7b go/parser: test and fix := scoping bug
R=iant
CC=golang-dev, gri
https://golang.org/cl/5327048
2011-10-27 12:22:06 -07:00
Andrew Balholm
833fb4198d html: parse <style> elements inside <head> element.
Also correctly handle EOF inside a <style> element.

Pass tests1.dat, test 49:
<!DOCTYPE html><style> EOF

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

R=nigeltao
CC=golang-dev
https://golang.org/cl/5321057
2011-10-27 10:26:11 +11:00
Andrew Balholm
bd07e4f259 html: close <option> element when opening <optgroup>
Pass tests1.dat, test 34:
<!DOCTYPE html>A<option>B<optgroup>C<select>D</option>E

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     "A"
|     <option>
|       "B"
|     <optgroup>
|       "C"
|       <select>
|         "DE"

Also passes tests 35-48. Test 48 is:
</ COM--MENT >

R=nigeltao
CC=golang-dev
https://golang.org/cl/5311063
2011-10-27 09:45:53 +11:00
Russ Cox
6323a40f31 gofix: test import insertion, deletion
Small change to go/ast, go/parser, go/printer so that
gofix can delete the blank line left from deleting an import.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/5321046
2011-10-26 14:04:07 -07:00
Adam Langley
4403e6b6d8 crypto/rsa: change public exponent from 3 to 65537
Although there's still no concrete security reason not to use 3, I
think Bleichenbacher has convinced me that it's a useful defense and
it's what everyone else does.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5307060
2011-10-26 10:41:24 -04:00
Alex Brainman
c3733b29d4 net: document why we do not use SO_REUSEADDR on windows
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5302058
2011-10-26 22:25:20 +11:00
Andrew Gerrand
f777be8f83 redo CL 5302057 / dac58d9c9e4a
««« original CL description
http: remove Connection header in ReverseProxy

Fixes #2342

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5302057
»»»

R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5296055
2011-10-26 15:27:29 +09:00
Russ Cox
c945f77f41 exp/norm: use rune
Nothing terribly interesting here. (!)

Since the public APIs are all in terms of UTF-8,
the changes are all internal only.

R=mpvl, gri, r
CC=golang-dev
https://golang.org/cl/5309042
2011-10-25 22:26:12 -07:00
Russ Cox
b50a847c3c csv, gob, json, mail, mime, xml: use rune
Nothing terribly interesting here.

R=golang-dev, r, borman
CC=golang-dev
https://golang.org/cl/5315043
2011-10-25 22:23:54 -07:00
Russ Cox
9f6d036f33 bufio, io: use rune
ReadRune, WriteRune change signature.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5314043
2011-10-25 22:23:34 -07:00
Russ Cox
7630a107bb unicode, utf8, utf16: use rune
Everything changes.

R=r
CC=golang-dev
https://golang.org/cl/5310045
2011-10-25 22:23:15 -07:00
Russ Cox
cfa036ae3a old/regexp, old/template, template: use rune
Nothing terribly interesting here.

R=r, gri
CC=golang-dev
https://golang.org/cl/5308042
2011-10-25 22:22:42 -07:00
Russ Cox
4911622055 exp/template/html: use rune
Nothing terribly interesting here.

R=mikesamuel, nigeltao, r
CC=golang-dev
https://golang.org/cl/5307044
2011-10-25 22:22:26 -07:00
Russ Cox
8f5718176f bytes, strings: use rune
Various rune-based APIs change.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5306044
2011-10-25 22:22:09 -07:00
Russ Cox
0e513317b1 big: update for fmt interface changes
Nothing terribly interesting here.

R=gri
CC=golang-dev
https://golang.org/cl/5305046
2011-10-25 22:21:49 -07:00
Russ Cox
4e4eca2618 fmt: use rune
Lots of internal edits.

Formatter and Scanner interfaces change
(clients to be checked by govet).

R=r
CC=golang-dev
https://golang.org/cl/5305045
2011-10-25 22:21:33 -07:00
Russ Cox
28c06182c0 exp/winfsnotify: fix govet-found bug
R=golang-dev, hectorchu
CC=golang-dev
https://golang.org/cl/5304044
2011-10-25 22:21:14 -07:00
Russ Cox
3e52dadfd7 regexp: use rune
Public API of syntax tree changes.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5302046
2011-10-25 22:20:57 -07:00
Russ Cox
5be33e9543 godoc, exp/ebnf, exp/types, go/scanner, scanner: use rune
API question: is a scanner token an int or a rune?

Since the rune is the common case and the token values
are the special (negative) case, I chose rune.  But it could
easily go the other way.

R=gri
CC=golang-dev
https://golang.org/cl/5301049
2011-10-25 22:20:20 -07:00
Russ Cox
db33959797 cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here.

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5300043
2011-10-25 22:20:02 -07:00
Russ Cox
6ed3fa6553 gc: introduce rune
R=ken, r
CC=golang-dev
https://golang.org/cl/5293046
2011-10-25 22:19:39 -07:00
Russ Cox
f4568882eb exp/types: add rune to universe
R=gri
CC=golang-dev
https://golang.org/cl/5295045
2011-10-25 22:19:09 -07:00
Andrew Gerrand
5abb29d1b8 undo CL 5302057 / dac58d9c9e4a
need a clean base from weekly.2011-10-25 for rune change

««« original CL description
http: remove Connection header in ReverseProxy

Fixes #2342

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5302057
»»»

R=rsc
CC=golang-dev
https://golang.org/cl/5294068
2011-10-26 14:16:34 +09:00
Brad Fitzpatrick
7c5d90dfbd http: remove Connection header in ReverseProxy
Fixes #2342

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5302057
2011-10-25 22:11:01 -07:00
Andrew Balholm
05ed18f4f6 html: improve parsing of lists
Make a <li> tag close the previous <li> element.
Make a </ul> tag close <li> elements.

Pass tests1.dat, test 33:
<!DOCTYPE html><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->

| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <li>
|       "hello"
|     <li>
|       "world"
|       <ul>
|         "how"
|         <li>
|           "do"
|       "you"
|   <!-- do -->

R=nigeltao
CC=golang-dev
https://golang.org/cl/5321051
2011-10-26 14:02:30 +11:00
Andrew Balholm
6e318bda6c html: improve parsing of tables
When foster parenting, merge adjacent text nodes.
Properly close table row at </tr> tag.

Pass tests1.dat, test 32:
<!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->

| <!-- - -->
| <html>
|   <head>
|   <body>
|     <font>
|       <div>
|         "helloexcite!"
|         <b>
|           "me!"
|         <table>
|           <tbody>
|             <tr>
|               <th>
|                 <i>
|                   "please!"
|             <!-- X -->

R=nigeltao
CC=golang-dev
https://golang.org/cl/5323048
2011-10-26 11:36:46 +11:00
Ian Lance Taylor
7959aeb0f9 syscall: correct name of mksyscall script in comment
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5310055
2011-10-25 12:49:51 -07:00
Hector Chu
2572ca2ff2 runtime: include bootstrap m in mcpu accounting
R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5307052
2011-10-25 08:35:20 +01:00
Brad Fitzpatrick
d72267ae23 http: doc typo
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5303067
2011-10-24 19:29:44 -07:00
David Anderson
85b9f3573e syscall: use uintptr for Mount flags.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5308044
2011-10-24 19:28:50 -07:00
Nigel Tao
18b025d530 html: remove the Tokenizer.ReturnComments option.
The original intention was to simplify the parser, in making it skip
all comment tokens. However, checking that the Go html package is
100% compatible with the WebKit HTML test suite requires parsing the
comments. There is no longer any real benefit for the option.

R=gri, andybalholm
CC=golang-dev
https://golang.org/cl/5321043
2011-10-25 11:28:07 +11:00
Dave Cheney
5791233461 exp/ssh: introduce Session to replace Cmd for interactive commands
This CL replaces the Cmd type with a Session type representing
interactive channels. This lays the foundation for supporting
other kinds of channels like direct-tcpip or x11.

client.go:
* replace chanlist map with slice.
* generalize stdout and stderr into a single type.
* unexport ClientChan to clientChan.

doc.go:
* update ServerConfig/ServerConn documentation.
* update Client example for Session.

message.go:
* make channelExtendedData more like channelData.

session.go:
* added Session which replaces Cmd.

R=agl, rsc, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5302054
2011-10-24 19:13:55 -04:00
Andrew Balholm
2f3f3aa2ed html: dump attributes when running parser tests.
The WebKit test data shows attributes as though they were child nodes:

<a X>0<b>1<a Y>2
dumps as:
| <html>
|   <head>
|   <body>
|     <a>
|       x=""
|       "0"
|       <b>
|         "1"
|     <b>
|       <a>
|         y=""
|         "2"

So we need to do the same when dumping a tree to compare with it.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5322044
2011-10-25 09:33:15 +11:00
Brad Fitzpatrick
2b5aa28383 http: add package comment
Fixes #2378

R=rsc
CC=golang-dev
https://golang.org/cl/5312052
2011-10-24 13:59:31 -07:00
Alex Brainman
c1d0f0e76c net: do not set SO_REUSEADDR for windows
Fixes #2307.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5306049
2011-10-24 09:11:01 +11:00
Andrew Balholm
2aa589c843 html: implement foster parenting
Implement the foster-parenting algorithm for content that is inside a table
but not in a cell.

Also fix a bug in reconstructing the active formatting elements.

Pass test 30 in tests1.dat:
<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y

R=nigeltao
CC=golang-dev
https://golang.org/cl/5309052
2011-10-23 18:36:01 +11:00
Nigel Tao
2f352ae48a html: parse <select> tags.
The additional test case in parse_test.go is:
<select><b><option><select><option></b></select>X

R=andybalholm
CC=golang-dev
https://golang.org/cl/5293051
2011-10-22 20:18:12 +11:00
Robert Griesemer
696ced50fe big: usable zero Rat values without need for explicit initialization
- no explicit API change, but new(big.Rat) now creates a big.Rat value
  of 0 that is immediately usable, in sync. w/ the conventions elsewhere
- various cleanups along the way

R=r
CC=golang-dev
https://golang.org/cl/5301056
2011-10-21 14:11:36 -07:00
Rob Pike
d481d7c854 fmt: simplify the code some more by storing the field in the pp structure.
R=rsc
CC=golang-dev
https://golang.org/cl/5293058
2011-10-21 13:59:27 -07:00
Robert Griesemer
4854bd9ced big: implemented Rat.Inv
Also:
- changed semantics of return values for [Int|Rat].SetString
  if an error occured (returned value is nil); will expose
  hidden errors where return values are not checked
- added more tests
- various cleanups throughout

Fixes #2384.

R=r
CC=golang-dev
https://golang.org/cl/5312044
2011-10-21 13:26:00 -07:00
Brad Fitzpatrick
2cab897ce0 http: Transport: with TLS InsecureSkipVerify, skip hostname check
Fixes #2386

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5312045
2011-10-21 08:14:38 -07:00
Dave Cheney
8bfb217123 exp/ssh: server cleanups
server.go/channel.go:
* rename Server to ServerConfig to match Client.
* rename ServerConnection to ServeConn to match Client.
* add Listen/Listener.
* ServerConn.Handshake(), general cleanups.

client.go:
* fix bug where fmt.Error was not assigned to err

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5265049
2011-10-21 11:04:28 -04:00
Dave Cheney
792a55f5db exp/ssh: add experimental ssh client
Requires CL 5285044

client.go:
* add Dial, ClientConn, ClientChan, ClientConfig and Cmd.

doc.go:
* add Client documentation.

server.go:
* adjust for readVersion change.

transport.go:
* return an os.Error not a bool from readVersion.

R=rsc, agl, n13m3y3r
CC=golang-dev
https://golang.org/cl/5162047
2011-10-20 15:44:45 -04:00
Robert Griesemer
e8a426aebe go/ast: use single-element map in test
Avoids test failure due to undefined map iteration order.

R=rsc, iant, iant
CC=golang-dev
https://golang.org/cl/5297048
2011-10-20 12:37:13 -07:00
Ian Lance Taylor
22dd0ba90d go/ast, go/token: actually run tests; fix go/ast test
R=gri
CC=golang-dev
https://golang.org/cl/5292048
2011-10-20 10:30:01 -07:00
Hector Chu
9e1a2adf07 exp/winfsnotify: fix test
R=alex.brainman, mattn.jp
CC=golang-dev
https://golang.org/cl/5311047
2011-10-20 08:10:58 +01:00
Nigel Tao
64306c9fd0 html: parse and render comment nodes.
The first additional test case in parse_test.go is:
<!--><div>--<!-->

The second one is unrelated to the comment change, but also passes:
<p><hr></p>

R=andybalholm
CC=golang-dev
https://golang.org/cl/5299047
2011-10-20 11:45:30 +11:00
Gustavo Niemeyer
526d0818cc fmt: don't panic formatting nil interfaces
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5296044
2011-10-19 18:26:08 -02:00
Russ Cox
b4d6b71e16 unicode: sort tables.go
Makes tables.go output consistent across maketable runs.
(It was already inconsistent across architectures; the new
map iteration order just make it inconsistent across runs.)

R=r
CC=golang-dev
https://golang.org/cl/5303046
2011-10-19 16:02:22 -04:00
Russ Cox
bb8c4ed22a exp/types: fix crash in parseBasicType on unknown type
R=gri
CC=golang-dev
https://golang.org/cl/5302044
2011-10-19 12:49:01 -04:00
Adam Langley
ec0b5533c9 crypto/x509: fix names in certificate generation.
I had a brain fart in af84b15fbae2 and messed up the names in
generated certificates.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5315046
2011-10-19 12:19:13 -04:00
Brad Fitzpatrick
314afb417a http: comment tweaks
It hasn't been primitive in a while.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5287041
2011-10-19 08:48:26 -07:00
Brad Fitzpatrick
cf0952d352 syscall: update ztypes_linux_386 for terminal changes
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/5299045
2011-10-19 08:45:38 -07:00