]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agohttp: always include Content-Length header, even for 0
Dave Grijalva [Mon, 19 Sep 2011 18:41:09 +0000 (11:41 -0700)]
http: always include Content-Length header, even for 0

fixes #2221

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

13 years agosync/atomic: replace MFENCE with LOCK XADD
Dmitriy Vyukov [Mon, 19 Sep 2011 18:09:00 +0000 (11:09 -0700)]
sync/atomic: replace MFENCE with LOCK XADD
MFENCE was introduced only on the Pentium4 (SSE2),
while XADD was introduced on the 486.
Fixes #2268.

R=golang-dev, rsc
CC=fshahriar, golang-dev
https://golang.org/cl/5056045

13 years agosuffixarray: generate less garbage during construction
Eric Eisner [Mon, 19 Sep 2011 18:03:43 +0000 (11:03 -0700)]
suffixarray: generate less garbage during construction

Minorly improves runtime by about 2-3%

R=gri, jeff
CC=golang-dev
https://golang.org/cl/5052045

13 years agohttp: prevent DumpRequest from adding implicit headers
Brad Fitzpatrick [Mon, 19 Sep 2011 17:22:53 +0000 (10:22 -0700)]
http: prevent DumpRequest from adding implicit headers

Fixes #2272

R=rsc
CC=golang-dev
https://golang.org/cl/5043051

13 years agojson: clearer Unmarshal doc
Russ Cox [Mon, 19 Sep 2011 17:19:07 +0000 (13:19 -0400)]
json: clearer Unmarshal doc

R=r
CC=golang-dev
https://golang.org/cl/5056049

13 years agogc: disallow invalid map keys
Russ Cox [Mon, 19 Sep 2011 17:11:24 +0000 (13:11 -0400)]
gc: disallow invalid map keys

The algtype-based test broke when algtype
got a bit more fine-grained, so replace with
an explicit check for the invalid key types.

R=ken2
CC=golang-dev
https://golang.org/cl/5071041

13 years agohttp: check explicit wrong Request.ContentLength values
Brad Fitzpatrick [Mon, 19 Sep 2011 16:01:32 +0000 (09:01 -0700)]
http: check explicit wrong Request.ContentLength values

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

13 years agocgo: cgo to use GOARCH from the environment, not runtime.GOARCH (otherwise it results...
Jaroslavas Počepko [Mon, 19 Sep 2011 15:50:59 +0000 (11:50 -0400)]
cgo: cgo to use GOARCH from the environment, not runtime.GOARCH (otherwise it results in necessity of having 8cgo and 6cgo)

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4978061

13 years agogc: handle complex CONVNOP
Russ Cox [Mon, 19 Sep 2011 15:50:53 +0000 (11:50 -0400)]
gc: handle complex CONVNOP

Fixes #2256.

R=ken2
CC=golang-dev
https://golang.org/cl/5044047

13 years ago8l: remove left over debugging
Dave Cheney [Mon, 19 Sep 2011 15:50:45 +0000 (11:50 -0400)]
8l: remove left over debugging

        This line was triggering a null dereference warning
        under clang-3.0. The line was added in a46819aa9150
        but compared to it's sibling in 6l it appears to be
        leftover debugging.

R=rsc
CC=golang-dev
https://golang.org/cl/5049042

13 years agojson: skip nil in UnmarshalJSON and (for symmetry) MarshalJSON
Russ Cox [Mon, 19 Sep 2011 15:50:41 +0000 (11:50 -0400)]
json: skip nil in UnmarshalJSON and (for symmetry) MarshalJSON

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/5050049

13 years agonet: use /etc/hosts first when looking up IP addresses using native Go's dns resolver
Andrey Mirtchovski [Mon, 19 Sep 2011 15:50:31 +0000 (11:50 -0400)]
net: use /etc/hosts first when looking up IP addresses using native Go's dns resolver

Previously /etc/hosts would be ignored altogether, this change returns matching results
from that file without talking to a DNS server.

R=rsc
CC=golang-dev
https://golang.org/cl/5061042

13 years agoexp/norm: Adopt regexp to exp/regexp semantics.
Marcel van Lohuizen [Mon, 19 Sep 2011 15:30:19 +0000 (17:30 +0200)]
exp/norm: Adopt regexp to exp/regexp semantics.

R=rsc
CC=golang-dev
https://golang.org/cl/5046041

13 years agoexp/ssh: fix constant in package documentation
Dave Cheney [Mon, 19 Sep 2011 14:32:11 +0000 (10:32 -0400)]
exp/ssh: fix constant in package documentation

R=agl
CC=golang-dev
https://golang.org/cl/5030054

13 years ago crypto/bcrypt: new package
Jeff Hodges [Mon, 19 Sep 2011 14:29:02 +0000 (10:29 -0400)]
crypto/bcrypt: new package

A port of Provos and Mazières's adapative hashing algorithm. See http://www.usenix.org/events/usenix99/provos/provos_html/node1.html

R=bradfitz, agl, rsc, dchest
CC=golang-dev
https://golang.org/cl/4964078

13 years ago crypto/blowfish: exposing the blowfish key schedule
Jeff Hodges [Mon, 19 Sep 2011 14:21:34 +0000 (10:21 -0400)]
crypto/blowfish: exposing the blowfish key schedule

Mostly useful for the coming crypto/bcrypt package

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

13 years agodoc: link to golang-france
Andrew Gerrand [Mon, 19 Sep 2011 05:36:06 +0000 (15:36 +1000)]
doc: link to golang-france

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5059046

13 years agotag release.r60.1
Andrew Gerrand [Mon, 19 Sep 2011 04:01:39 +0000 (14:01 +1000)]
tag release.r60.1

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5030045

13 years agodoc: update release.r60.1 notes
Andrew Gerrand [Mon, 19 Sep 2011 02:16:08 +0000 (12:16 +1000)]
doc: update release.r60.1 notes

R=dsymonds
CC=golang-dev
https://golang.org/cl/5045045

13 years agoexp/template/html: allow quotes on either side of conditionals and dynamic HTML names
Mike Samuel [Mon, 19 Sep 2011 02:10:15 +0000 (19:10 -0700)]
exp/template/html: allow quotes on either side of conditionals and dynamic HTML names

This addresses several use cases:

(1) <h{{.HeaderLevel}}> used to build hierarchical documents.
(2) <input on{{.EventType}}=...> used in widgets.
(3) <div {{" dir=ltr"}}> used to embed bidi-hints.

It also makes sure that we treat the two templates below the same:

<img src={{if .Avatar}}"{{.Avatar}}"{{else}}"anonymous.png"{{end}}>
<img src="{{if .Avatar}}{{.Avatar}}{{else}}anonymous.png{{end}}">

This splits up tTag into a number of sub-states and adds testcases.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5043042

13 years agoexp/template/html: normalize '<' in text and RCDATA nodes.
Mike Samuel [Sun, 18 Sep 2011 19:04:40 +0000 (12:04 -0700)]
exp/template/html: normalize '<' in text and RCDATA nodes.

The template

  <{{.}}

would violate the structure preservation property if allowed and not
normalized, because when {{.}} emitted "", the "<" would be part of
a text node, but if {{.}} emitted "a", the "<" would not be part of
a text node.

This change rewrites '<' in text nodes and RCDATA text nodes to
'&lt;' allowing template authors to write the common, and arguably more
readable:

    Your price: {{.P1}} < list price {{.P2}}

while preserving the structure preservation property.

It also lays the groundwork for comment elision, rewriting

    Foo <!-- comment with secret project details --> Bar

to

    Foo  Bar

R=nigeltao
CC=golang-dev
https://golang.org/cl/5043043

13 years agoexp/template/html: recognize whitespace at start of URLs.
Mike Samuel [Sun, 18 Sep 2011 18:55:14 +0000 (11:55 -0700)]
exp/template/html: recognize whitespace at start of URLs.

HTML5 uses "Valid URL potentially surrounded by spaces" for
attrs: http://www.w3.org/TR/html5/index.html#attributes-1

    <a href=" {{.}}">

should be escaped to filter out "javascript:..." as data.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5027045

13 years agoexp/ssh: new package.
Adam Langley [Sat, 17 Sep 2011 19:57:24 +0000 (15:57 -0400)]
exp/ssh: new package.

The typical UNIX method for controlling long running process is to
send the process signals. Since this doesn't get you very far, various
ad-hoc, remote-control protocols have been used over time by programs
like Apache and BIND.

Implementing an SSH server means that Go code will have a standard,
secure way to do this in the future.

R=bradfitz, borman, dave, gustavo, dsymonds, r, adg, rsc, rogpeppe, lvd, kevlar, raul.san
CC=golang-dev
https://golang.org/cl/4962064

13 years agoarchive/tar: document Header fields and Type flags
Mike Rosset [Sat, 17 Sep 2011 18:43:06 +0000 (11:43 -0700)]
archive/tar: document Header fields and Type flags

Documentation more along the lines of os.FileInfo
Fixes #2180.

R=golang-dev, dsymonds
CC=golang-dev, mike.rosset
https://golang.org/cl/4958055

13 years agoruntime: increase stack system space on windows/amd64
Hector Chu [Sat, 17 Sep 2011 10:39:29 +0000 (20:39 +1000)]
runtime: increase stack system space on windows/amd64

gotest src/pkg/exp/template/html was crashing because the exception handler overflowed the goroutine stack.

R=alex.brainman, golang-dev
CC=golang-dev
https://golang.org/cl/5031049

13 years agoruntime/pprof: enable test on windows
Hector Chu [Sat, 17 Sep 2011 08:00:32 +0000 (18:00 +1000)]
runtime/pprof: enable test on windows

R=alex.brainman
CC=golang-dev
https://golang.org/cl/5047045

13 years agoruntime: implement pprof support for windows
Hector Chu [Sat, 17 Sep 2011 07:57:59 +0000 (17:57 +1000)]
runtime: implement pprof support for windows

Credit to jp for proof of concept.

R=alex.brainman, jp, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/4960057

13 years agofilepath: fix Glob to return no error on nonmatching patterns
Michael Shields [Sat, 17 Sep 2011 03:30:54 +0000 (20:30 -0700)]
filepath: fix Glob to return no error on nonmatching patterns

filepath.Glob is documented to return nil if no files match
and an error only if the pattern is invalid.  This change
fixes it to work as documented and adds a regression test.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5040045

13 years agoCONTRIBUTORS: add googler Michael Shields
Rob Pike [Sat, 17 Sep 2011 03:30:17 +0000 (20:30 -0700)]
CONTRIBUTORS: add googler Michael Shields

R=golang-dev, dsymonds
CC=golang-dev, mshields
https://golang.org/cl/5042045

13 years agotest: match gccgo error messages for bug330.go.
Ian Lance Taylor [Sat, 17 Sep 2011 01:28:57 +0000 (18:28 -0700)]
test: match gccgo error messages for bug330.go.

bug330.go:11:6: error: expected numeric type
bug330.go:12:6: error: expected numeric type

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5031050

13 years agoreflect: fix comment
Robert Griesemer [Fri, 16 Sep 2011 22:07:13 +0000 (15:07 -0700)]
reflect: fix comment

R=r
CC=golang-dev
https://golang.org/cl/5039045

13 years agohttp/cgi: clean up environment.
Yasuhiro Matsumoto [Fri, 16 Sep 2011 17:36:54 +0000 (10:36 -0700)]
http/cgi: clean up environment.
clean up duplicate environment for CGI.
overriding former by latter.
On windows, When there are duplicated environments like following,

SCRIPT_FILENAME=c:/progra~1/php/php-cgi.exe
SCRIPT_FILENAME=/foo.php

CreateProcess use first entry.

If make cgi.Handle like following,

        cgih = cgi.Handler{
                Path: "c:/strawberry/perl/bin/perl.exe",
                Dir:  "c:/path/to/webroot",
                Root: "c:/path/to/webroot",
                Args: []string{"foo.php"},
                Env:  []string{"SCRIPT_FILENAME=foo.php"},
        }

http/cgi should behave "SCRIPT_FILENAME is foo.php".
But currently, http/cgi is set duplicate environment entries.
So, browser show binary dump of "php-cgi.exe" that is specified indented
SCRIPT_FILENAME in first entry.
This change clean up duplicates, and use latters.

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

13 years agoexp/norm: reverting to using strings.Repeat, as it doesn't look like exp/regexp
Marcel van Lohuizen [Fri, 16 Sep 2011 09:28:53 +0000 (11:28 +0200)]
exp/norm: reverting to using strings.Repeat, as it doesn't look like exp/regexp
is going to support returning multiple matches for a single repeated group.

R=r, rsc, mpvl
CC=golang-dev
https://golang.org/cl/5014045

13 years agoexp/norm: changed trie to produce smaller tables.
Marcel van Lohuizen [Fri, 16 Sep 2011 09:27:05 +0000 (11:27 +0200)]
exp/norm: changed trie to produce smaller tables.
Trie now uses sparse block when this makes sense.

R=r, r
CC=golang-dev
https://golang.org/cl/5010043

13 years agoexp/template/html: type fixed point computation in template
Mike Samuel [Fri, 16 Sep 2011 07:34:26 +0000 (00:34 -0700)]
exp/template/html: type fixed point computation in template

I found a simple test case that does require doing the fixed point TODO
in computeOutCtx.

I found a way though to do this and simplify away the escapeRange
hackiness that was added in https://golang.org/cl/5012044/

R=nigeltao
CC=golang-dev
https://golang.org/cl/5015052

13 years agotag weekly.2011-09-16
Andrew Gerrand [Fri, 16 Sep 2011 07:23:31 +0000 (17:23 +1000)]
tag weekly.2011-09-16

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5004052

13 years agoweekly.2011-09-16 weekly.2011-09-16
Andrew Gerrand [Fri, 16 Sep 2011 07:18:36 +0000 (17:18 +1000)]
weekly.2011-09-16

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5040042

13 years agonet: reuse channels during io
Alex Brainman [Fri, 16 Sep 2011 03:40:02 +0000 (13:40 +1000)]
net: reuse channels during io

R=golang-dev, bsiegert, rsc, hectorchu
CC=golang-dev
https://golang.org/cl/5016043

13 years agoexp/template/html: moved error docs out of package docs onto error codes
Mike Samuel [Fri, 16 Sep 2011 02:05:33 +0000 (19:05 -0700)]
exp/template/html: moved error docs out of package docs onto error codes

This replaces the errStr & errLine members of context with a single err
*Error, and introduces a number of const error codes, one per
escape-time failure mode, that can be separately documented.

The changes to the error documentation moved from doc.go to error.go
are cosmetic.

R=r, nigeltao
CC=golang-dev
https://golang.org/cl/5026041

13 years agogodoc: remove dependency of syscall
Robert Griesemer [Thu, 15 Sep 2011 23:47:01 +0000 (16:47 -0700)]
godoc: remove dependency of syscall

On app-engine, we cannot import syscall.
The respective constants are already defined
elsewhere for the same reason.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5036042

13 years agogodoc: use new index/suffixarray serialization code
Robert Griesemer [Thu, 15 Sep 2011 23:21:42 +0000 (16:21 -0700)]
godoc: use new index/suffixarray serialization code

When saving/restoring the fulltext index, the entire
respective suffixarray is now saved/restored (as opposed
to the indexed data only, and the suffixarray recreated).
This saves significant start-up time for large indexes,
at the cost of significantly larger index files.

R=r
CC=golang-dev
https://golang.org/cl/5037043

13 years agoindex/suffixarray: support for serialization
Robert Griesemer [Thu, 15 Sep 2011 23:21:21 +0000 (16:21 -0700)]
index/suffixarray: support for serialization

R=r
CC=golang-dev
https://golang.org/cl/5040041

13 years agotextproto: parse RFC 959 multiline responses correctly
Brad Fitzpatrick [Thu, 15 Sep 2011 21:29:59 +0000 (14:29 -0700)]
textproto: parse RFC 959 multiline responses correctly

Fixes #2218

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

13 years agohttp: MaxBytesReader doc cleanups
Brad Fitzpatrick [Thu, 15 Sep 2011 21:26:22 +0000 (14:26 -0700)]
http: MaxBytesReader doc cleanups

Comments from rsc after 4921049 was submitted.

R=rsc
CC=golang-dev
https://golang.org/cl/5034042

13 years agohttp: document that Response.Body is non-nil
Brad Fitzpatrick [Thu, 15 Sep 2011 21:09:53 +0000 (14:09 -0700)]
http: document that Response.Body is non-nil

Fixes #2208

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

13 years agoflag: make zero FlagSet useful
Russ Cox [Thu, 15 Sep 2011 21:04:51 +0000 (17:04 -0400)]
flag: make zero FlagSet useful

This makes it possible to use a FlagSet as a
field in a larger struct.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5036041

13 years agogodoc: use go/build to find files in a package
Russ Cox [Thu, 15 Sep 2011 20:49:06 +0000 (16:49 -0400)]
godoc: use go/build to find files in a package

Fixes #1156.
Fixes #2172.

R=gri
CC=golang-dev
https://golang.org/cl/5015044

13 years agobuild: add build comments to core packages
Russ Cox [Thu, 15 Sep 2011 20:48:57 +0000 (16:48 -0400)]
build: add build comments to core packages

The go/build package already recognizes
system-specific file names like

        mycode_darwin.go
        mycode_darwin_386.go
        mycode_386.s

However, it is also common to write files that
apply to multiple architectures, so a recent CL added
to go/build the ability to process comments
listing a set of conditions for building.  For example:

        // +build darwin freebsd openbsd/386

says that this file should be compiled only on
OS X, FreeBSD, or 32-bit x86 OpenBSD systems.

These conventions are not yet documented
(hence this long CL description).

This CL adds build comments to the multi-system
files in the core library, a step toward making it
possible to use go/build to build them.

With this change go/build can handle crypto/rand,
exec, net, path/filepath, os/user, and time.

os and syscall need additional adjustments.

R=golang-dev, r, gri, r, gustavo
CC=golang-dev
https://golang.org/cl/5011046

13 years agogo/build: change //build to // +build
Russ Cox [Thu, 15 Sep 2011 20:48:21 +0000 (16:48 -0400)]
go/build: change //build to // +build

New rules as discussed on CL 5011046.
Also apply to C and assembly files, not just Go files.

R=r, rogpeppe
CC=golang-dev
https://golang.org/cl/5015051

13 years agohttp/cgi: add openbsd environment configuration
Brad Fitzpatrick [Thu, 15 Sep 2011 19:41:00 +0000 (12:41 -0700)]
http/cgi: add openbsd environment configuration

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

13 years agohttp: fix WriteProxy documentation
Brad Fitzpatrick [Thu, 15 Sep 2011 17:28:55 +0000 (10:28 -0700)]
http: fix WriteProxy documentation

Fixes #2258

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

13 years agogo/build: fix build (revert test changes)
Russ Cox [Thu, 15 Sep 2011 16:34:34 +0000 (12:34 -0400)]
go/build: fix build (revert test changes)

R=adg
TBR=adg
CC=golang-dev
https://golang.org/cl/5024046

13 years agogo/build: handle cgo, //build comments
Russ Cox [Thu, 15 Sep 2011 16:11:41 +0000 (12:11 -0400)]
go/build: handle cgo, //build comments

R=adg
CC=golang-dev
https://golang.org/cl/5018044

13 years agoexp/template/html: pre-sanitized content
Mike Samuel [Thu, 15 Sep 2011 15:51:55 +0000 (08:51 -0700)]
exp/template/html: pre-sanitized content

Not all content is plain text.  Sometimes content comes from a trusted
source, such as another template invocation, an HTML tag whitelister,
etc.

Template authors can deal with over-escaping in two ways.

1) They can encapsulate known-safe content via
   type HTML, type CSS, type URL, and friends in content.go.
2) If they know that the for a particular action never needs escaping
   then they can add |noescape to the pipeline.
   {{.KnownSafeContent | noescape}}
   which will prevent any escaping directives from being added.

This CL defines string type aliases: HTML, CSS, JS, URI, ...
It then modifies stringify to unpack the content type.
Finally it modifies the escaping functions to use the content type and
decline to escape content that does not require it.

There are minor changes to escapeAction and helpers to treat as
equivalent explicit escaping directives such as "html" and "urlquery"
and the escaping directives defined in the contextual autoescape module
and to recognize the special "noescape" directive.

The html escaping functions are rearranged.  Instead of having one
escaping function used in each {{.}} in

    {{.}} : <textarea title="{{.}}">{{.}}</textarea>

a slightly different escaping function is used for each.
When {{.}} binds to a pre-sanitized string of HTML

    `one < <i>two</i> &amp; two < "3"`

we produces something like

     one < <i>two</i> &amp; two < "3" :
     <textarea title="one &lt; two &amp; two &lt; &#34;3&#34;">
       one &lt; &lt;i&gt;two&lt;/i&gt; &amp; two &lt; "3"
     </textarea>

Although escaping is not required in <textarea> normally, if the
substring </textarea> is injected, then it breaks, so we normalize
special characters in RCDATA and do the same to preserve attribute
boundaries.  We also strip tags since developers never intend
typed HTML injected in an attribute to contain tags escaped, but
do occasionally confuse pre-escaped HTML with HTML from a
tag-whitelister.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/4962067

13 years agodoc: release.r60.1
Andrew Gerrand [Thu, 15 Sep 2011 09:26:12 +0000 (19:26 +1000)]
doc: release.r60.1

R=r
CC=golang-dev
https://golang.org/cl/5002041

13 years agogodoc: support for complete index serialization
Robert Griesemer [Thu, 15 Sep 2011 03:46:03 +0000 (20:46 -0700)]
godoc: support for complete index serialization

- now fulltext index information is saved/restored
- minor updates to appinit.go

R=rsc
CC=golang-dev
https://golang.org/cl/5024043

13 years agogo/token: support to serialize file sets
Robert Griesemer [Thu, 15 Sep 2011 03:45:45 +0000 (20:45 -0700)]
go/token: support to serialize file sets

R=rsc
CC=golang-dev
https://golang.org/cl/5024042

13 years agoexp/template/html: render templates unusable when escaping fails
Mike Samuel [Thu, 15 Sep 2011 03:40:50 +0000 (20:40 -0700)]
exp/template/html: render templates unusable when escaping fails

This moots a caveat in the proposed package documentation by
rendering useless any template that could not be escaped.

From https://golang.org/cl/4969078/
> If EscapeSet returns an error, do not Execute the set; it is not
> safe against injection.
r: [but isn't the returned set nil? i guess you don't overwrite the
r: original if there's a problem, but i think you're in your rights to
r: do so]

R=r
CC=golang-dev
https://golang.org/cl/5020043

13 years agoruntime: eliminate handle churn when churning channels on Windows
Hector Chu [Thu, 15 Sep 2011 00:23:21 +0000 (20:23 -0400)]
runtime: eliminate handle churn when churning channels on Windows

The Windows implementation of the net package churns through a couple of channels for every read/write operation.  This translates into a lot of time spent in the kernel creating and deleting event objects.

R=rsc, dvyukov, alex.brainman, jp
CC=golang-dev
https://golang.org/cl/4997044

13 years agodebug/elf: permit another case of SHT_NOBITS section overlap in test
Ian Lance Taylor [Wed, 14 Sep 2011 22:33:37 +0000 (15:33 -0700)]
debug/elf: permit another case of SHT_NOBITS section overlap in test

Lets test pass when using gccgo.

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

13 years agojson: if a field's tag is "-", never encode it.
David Symonds [Wed, 14 Sep 2011 22:09:43 +0000 (08:09 +1000)]
json: if a field's tag is "-", never encode it.

R=adg, r, edsrzf, rsc, r
CC=golang-dev
https://golang.org/cl/4962052

13 years agoexp/template/html: flesh out package documentation.
Mike Samuel [Wed, 14 Sep 2011 21:21:20 +0000 (14:21 -0700)]
exp/template/html: flesh out package documentation.

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/4969078

13 years agosrc: fix a couple of govet-discovered errors.
Rob Pike [Wed, 14 Sep 2011 20:29:31 +0000 (13:29 -0700)]
src: fix a couple of govet-discovered errors.

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

13 years agocrypto/tls: support SSLv3
Adam Langley [Wed, 14 Sep 2011 19:32:19 +0000 (15:32 -0400)]
crypto/tls: support SSLv3

It would be nice not to have to support this since all the clients
that we care about support TLSv1 by now. However, due to buggy
implementations of SSLv3 on the Internet which can't do version
negotiation correctly, browsers will sometimes switch to SSLv3. Since
there's no good way for a browser tell a network problem from a buggy
server, this downgrade can occur even if the server in question is
actually working correctly.

So we need to support SSLv3 for robustness :(

Fixes #1703.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5018045

13 years agoexp/template/html: check that modified nodes are not shared by templates
Mike Samuel [Wed, 14 Sep 2011 18:52:03 +0000 (11:52 -0700)]
exp/template/html: check that modified nodes are not shared by templates

R=nigeltao
CC=golang-dev
https://golang.org/cl/5012044

13 years agopath/filepath: document that Walk sorts its output
Rob Pike [Wed, 14 Sep 2011 18:18:43 +0000 (11:18 -0700)]
path/filepath: document that Walk sorts its output

R=golang-dev, cw
CC=golang-dev
https://golang.org/cl/5004045

13 years agoexp/norm: added normregtest to .hgignore.
Marcel van Lohuizen [Wed, 14 Sep 2011 18:03:21 +0000 (20:03 +0200)]
exp/norm: added normregtest to .hgignore.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5009045

13 years agotest: Add test for inheriting private method from anonymous field.
Ian Lance Taylor [Wed, 14 Sep 2011 17:31:51 +0000 (10:31 -0700)]
test: Add test for inheriting private method from anonymous field.

The spec says that all methods are inherited from an anonymous
field.  There is no exception for non-exported methods.

This is related to issue 1536.

R=rsc
CC=golang-dev
https://golang.org/cl/5012043

13 years agogo/printer: use panic/defer instead of goroutine
Robert Griesemer [Wed, 14 Sep 2011 15:49:21 +0000 (08:49 -0700)]
go/printer: use panic/defer instead of goroutine
for handling errors

Fixes #2249.

R=rsc
CC=golang-dev
https://golang.org/cl/4952071

13 years agogofmt: add else test
Russ Cox [Wed, 14 Sep 2011 15:29:18 +0000 (11:29 -0400)]
gofmt: add else test

R=gri
CC=golang-dev
https://golang.org/cl/4978065

13 years agowebsocket: rename websocket.WebSocketAddr to *websocket.Addr.
Russ Cox [Wed, 14 Sep 2011 15:29:11 +0000 (11:29 -0400)]
websocket: rename websocket.WebSocketAddr to *websocket.Addr.

R=ukai
CC=golang-dev
https://golang.org/cl/4999043

13 years agoruntime: track HeapIdle
Russ Cox [Wed, 14 Sep 2011 15:29:01 +0000 (11:29 -0400)]
runtime: track HeapIdle

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4995045

13 years agoimage/jpeg: fix build
Mikio Hara [Wed, 14 Sep 2011 15:14:03 +0000 (11:14 -0400)]
image/jpeg: fix build

R=golang-dev
CC=golang-dev
https://golang.org/cl/5020045

13 years agoimage/draw: unbreak build for image.NewXxx change.
Nigel Tao [Wed, 14 Sep 2011 12:09:46 +0000 (22:09 +1000)]
image/draw: unbreak build for image.NewXxx change.

TBR=rsc
CC=golang-dev
https://golang.org/cl/5016044

13 years agoimage: change the NewXxx functions to take a Rectangle instead of
Nigel Tao [Wed, 14 Sep 2011 11:39:49 +0000 (21:39 +1000)]
image: change the NewXxx functions to take a Rectangle instead of
taking (w, h int).

R=rsc, bsiegert, r
CC=golang-dev
https://golang.org/cl/4964073

13 years agoruntime: syscall to return both AX and DX for windows/386
Alex Brainman [Wed, 14 Sep 2011 06:19:45 +0000 (16:19 +1000)]
runtime: syscall to return both AX and DX for windows/386

Fixes #2181.

R=golang-dev, jp
CC=golang-dev
https://golang.org/cl/5000042

13 years agotemplate: add doc.go to Makefile
Mike Samuel [Wed, 14 Sep 2011 01:50:02 +0000 (18:50 -0700)]
template: add doc.go to Makefile

The template package is the only one that has a doc.go not mentioned
in its Makefile.

This doesn't seem to bother godoc, but seems like a bug to me.

$ for d in $(find pkg -name doc.go); do echo $d; grep doc.go $(dirname $d)/Makefile; done
pkg/fmt/doc.go
        doc.go\
pkg/go/doc/doc.go
        doc.go\
pkg/gob/doc.go
        doc.go\
pkg/html/doc.go
        doc.go\
pkg/old/template/doc.go
        doc.go\
pkg/sync/atomic/doc.go
        doc.go\
pkg/template/doc.go

R=r
CC=golang-dev
https://golang.org/cl/5003047

13 years agoexp/template/html: move transition functions to a separate file
Mike Samuel [Wed, 14 Sep 2011 00:53:55 +0000 (17:53 -0700)]
exp/template/html: move transition functions to a separate file

This CL moves code but makes no changes otherwise.

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/5012045

13 years agopath/filepath: new signature for Walk
Rob Pike [Wed, 14 Sep 2011 00:47:59 +0000 (17:47 -0700)]
path/filepath: new signature for Walk
This one uses a closure than an interface, and is much simpler to use.
It also enables a called function to return an error and (possibly)
halt processing.

Fixes #2237.

R=golang-dev, gri, rsc, r, cw, n13m3y3r
CC=golang-dev
https://golang.org/cl/5014043

13 years agoexp/template/html: escape {{template}} calls and sets of templates
Mike Samuel [Tue, 13 Sep 2011 23:57:39 +0000 (16:57 -0700)]
exp/template/html: escape {{template}} calls and sets of templates

This adds support for {{template "callee"}} calls.
It recognizes that calls can appear in many contexts.

{{if .ImageURL}}
    <img src="{{.ImageURL}}" alt="{{template "description"}}">
{{else}}
    <p>{{template "description"}}</p>
{{end}}

calls a template in two different contexts, first in an HTML attribute
context, and second in an HTML text context.

Those two contexts aren't very different, but when linking text
to search terms, the escaping context can be materially different:

<a href="/search?q={{template "tags"}}">{{template "tags"}}</a>

This adds API:
EscapeSet(*template.Set, names ...string) os.Error

takes a set of templates and the names of those which might be called
in the default context as starting points.

It changes the escape* functions to be methods of an object which
maintains a conceptual mapping of
(template names*input context) -> output context.

The actual mapping uses as key a mangled name which combines the
template name with the input context.

The mangled name when the input context is the default context is the
same as the unmangled name.

When a template is called in multiple contexts, we clone the template.

{{define "tagLink"}}
  <a href="/search?q={{template "tags"}}">{{template "tags"}}</a>
{{end}}
{{define "tags"}}
  {{range .Tags}}{{.}},{{end}}
{{end}}

given []string{ "foo", "O'Reilly", "bar" } produces

  <a href="/search?q=foo,O%27Reilly,bar">foo,O&#39;Reilly,bar</a>

This involves rewriting the above to something like

{{define "tagLink"}}
  <a href="/search?q={{template "tags$1"}}">{{template "tags"}}</a>
{{end}}
{{define "tags"}}
  {{range .Tags}}{{. | html}},{{end}}
{{end}}
{{define "tags$1"}}
  {{range .Tags}}{{. | urlquery}},{{end}}
{{end}}

clone.go provides a mechanism for cloning template "tags" to produce
"tags$1".

changes to escape.go implement the new API and context propagation
around the call graph.

context.go includes minor changes to support name mangling and
context_test.go tests those.

js.go contains a bug-fix.

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/4969072

13 years agohttp: Alphabetize imports.
Ian Lance Taylor [Tue, 13 Sep 2011 16:38:26 +0000 (09:38 -0700)]
http: Alphabetize imports.

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

13 years agoos: Fix comment in generated signal_unix.go file.
Ian Lance Taylor [Tue, 13 Sep 2011 16:38:08 +0000 (09:38 -0700)]
os: Fix comment in generated signal_unix.go file.

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

13 years agoexp/norm: Added regression test tool for the standard Unicode test set.
Marcel van Lohuizen [Tue, 13 Sep 2011 10:51:48 +0000 (12:51 +0200)]
exp/norm: Added regression test tool for the standard Unicode test set.

R=r
CC=golang-dev
https://golang.org/cl/4973064

13 years agonet: add a LookupTXT function.
Nigel Tao [Tue, 13 Sep 2011 03:05:33 +0000 (13:05 +1000)]
net: add a LookupTXT function.

This CL only supports Unix, not Plan 9 or Windows.

R=rsc
CC=golang-dev
https://golang.org/cl/4996048

13 years agotime: another attempt to fix windows build
Alex Brainman [Tue, 13 Sep 2011 02:42:24 +0000 (12:42 +1000)]
time: another attempt to fix windows build

R=bradfitz
CC=golang-dev
https://golang.org/cl/4967067

13 years agotime: fix Windows build after ceeedb519c4a
Brad Fitzpatrick [Tue, 13 Sep 2011 00:18:25 +0000 (17:18 -0700)]
time: fix Windows build after ceeedb519c4a

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4983060

13 years agoexp/template/html: tolerate '/' ambiguity in JS when it doesn't matter.
Mike Samuel [Mon, 12 Sep 2011 23:37:03 +0000 (16:37 -0700)]
exp/template/html: tolerate '/' ambiguity in JS when it doesn't matter.

Often, division/regexp ambiguity doesn't matter in JS because the next
token is not a slash.

For example, in

  <script>var global{{if .InitVal}} = {{.InitVal}}{{end}}</script>

When there is an initial value, the {{if}} ends with jsCtxDivOp
since a '/' following {{.InitVal}} would be a division operator.
When there is none, the empty {{else}} branch ends with jsCtxRegexp
since a '/' would start a regular expression.  A '/' could result
in a valid program if it were on a new line to allow semicolon
insertion to terminate the VarDeclaration.

There is no '/' though, so we can ignore the ambiguity.

There are cases where a missing semi can result in ambiguity that
we should report.

  <script>
  {{if .X}}var x = {{.X}}{{end}}
  /...{{.Y}}
  </script>

where ... could be /foo/.test(bar) or /divisor.  Disambiguating in
this case is hard and is required to sanitize {{.Y}}.

Note, that in the case where there is a '/' in the script tail but it
is not followed by any interpolation, we already don't care.  So we
are already tolerant of

<script>{{if .X}}var x = {{.X}}{{end}}/a-bunch-of-text</script>

because tJS checks for </script> before looking in /a-bunch-of-text.

This CL
- Adds a jsCtx value: jsCtxUnknown
- Changes joinContext to join contexts that only differ by jsCtx.
- Changes tJS to return an error when a '/' is seen in jsCtxUnknown.
- Adds tests for both the happy and sad cases.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4956077

13 years agoexp/template/html: fix bug /*/ is not a full JS block comment.
Mike Samuel [Mon, 12 Sep 2011 23:01:30 +0000 (16:01 -0700)]
exp/template/html: fix bug /*/ is not a full JS block comment.

Similar tests for CSS already catch this problem in tCSS.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4967065

13 years agocrypto/tls: handle non-TLS more robustly
Russ Cox [Mon, 12 Sep 2011 20:52:49 +0000 (16:52 -0400)]
crypto/tls: handle non-TLS more robustly

Fixes #2253.

R=agl
CC=golang-dev
https://golang.org/cl/4960066

13 years agogc: clean up if grammar
Russ Cox [Mon, 12 Sep 2011 19:52:29 +0000 (15:52 -0400)]
gc: clean up if grammar

Fixes #2248.

R=ken2
CC=golang-dev
https://golang.org/cl/4978064

13 years agogofmt: accept program fragments on standard input
Russ Cox [Mon, 12 Sep 2011 19:41:49 +0000 (15:41 -0400)]
gofmt: accept program fragments on standard input

This makes it possible to grab a block of code
in an editor and pipe it through gofmt, instead of
having to pipe in the entire file.

R=gri
CC=golang-dev
https://golang.org/cl/4973074

13 years agogodoc, suffixarray: switch to exp/regexp
Robert Griesemer [Mon, 12 Sep 2011 19:20:48 +0000 (12:20 -0700)]
godoc, suffixarray: switch to exp/regexp

R=rsc
CC=golang-dev
https://golang.org/cl/4983058

13 years agopath/filepath: fix Visitor doc
Gustavo Niemeyer [Mon, 12 Sep 2011 19:18:48 +0000 (16:18 -0300)]
path/filepath: fix Visitor doc

The path is not in fact relative to the root, but
joined to it.

R=golang-dev, adg, rsc, gustavo
CC=golang-dev
https://golang.org/cl/4977059

13 years agotime: make Weekday a method.
Rob Pike [Mon, 12 Sep 2011 18:47:55 +0000 (11:47 -0700)]
time: make Weekday a method.
Weekday is redundant information for a Time structure.
When parsing a time with a weekday specified, it can create an
incorrect Time value.
When parsing a time without a weekday specified, people
expect the weekday to be set.
Fix all three problems by computing the weekday on demand.

This is hard to gofix, since we must change the type of the node.
Since uses are rare and existing code will be caught by the compiler,
there is no gofix module here.

Fixes #2245.

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

13 years agoexp/regexp/syntax: fix invalid input parser crash
Russ Cox [Mon, 12 Sep 2011 18:03:53 +0000 (14:03 -0400)]
exp/regexp/syntax: fix invalid input parser crash

Reported by Kyle Lemons.

R=r
CC=golang-dev
https://golang.org/cl/4992045

13 years agowebsocket: Fix infinite recursion in WebSockAddr String()
Tarmigan Casebolt [Mon, 12 Sep 2011 17:48:56 +0000 (13:48 -0400)]
websocket: Fix infinite recursion in WebSockAddr String()

String() is already inherited from the embedded *url.URL

R=ukai, adg, rsc
CC=golang-dev
https://golang.org/cl/4992049

13 years agoexp/norm: fixed typo. Bug exposed by gomake testtables. Changes did not affect other...
Marcel van Lohuizen [Mon, 12 Sep 2011 08:21:35 +0000 (10:21 +0200)]
exp/norm: fixed typo. Bug exposed by gomake testtables. Changes did not affect other tests
as this part of Hangul is handled algorithmically.

R=r
CC=golang-dev
https://golang.org/cl/4951074

13 years agoexp/template/html: fix JS regexp escape of an empty string.
Nigel Tao [Mon, 12 Sep 2011 01:57:34 +0000 (11:57 +1000)]
exp/template/html: fix JS regexp escape of an empty string.

R=dsymonds
CC=golang-dev, mikesamuel
https://golang.org/cl/4972063

13 years agoimage/png: don't use a goroutine to decode. This was preventing
Nigel Tao [Fri, 9 Sep 2011 23:51:13 +0000 (09:51 +1000)]
image/png: don't use a goroutine to decode. This was preventing
decoding during an init function.

Fixes #2224.

R=rsc
CC=golang-dev
https://golang.org/cl/4964070

13 years agodoc: link to notable blog posts
Andrew Gerrand [Fri, 9 Sep 2011 23:35:25 +0000 (09:35 +1000)]
doc: link to notable blog posts

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4996041