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

7289 Commits

Author SHA1 Message Date
Joel Sing
5af6ce541f net: add multicast stubs for openbsd
Add multicast stubs and sync with recent changes.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4838058
2011-08-16 17:28:16 -04:00
Joel Sing
1bc245181e net, syscall: move multicast address handling
Multicast address handling is not consistent across all BSDs. Move
the multicast address handling code into OS dependent files. This
will be needed for OpenBSD support.

R=mikioh.mikioh, golang-dev
CC=golang-dev
https://golang.org/cl/4809074
2011-08-16 17:26:51 -04:00
Mikio Hara
c20ced956e net: return correct local address for an accepted TCP connection
Fixes #2127.

R=rsc
CC=golang-dev
https://golang.org/cl/4873043
2011-08-16 16:53:09 -04:00
Dmitriy Vyukov
a2677cf363 runtime: fix GC bitmap corruption
The corruption can occur when GOMAXPROCS
is changed from >1 to 1, since GOMAXPROCS=1
does not imply there is only 1 goroutine running,
other goroutines can still be not parked after
the change.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4873050
2011-08-16 16:53:02 -04:00
Julian Phillips
01dd57b312 cgo: omit duplicate symbols in writeDefs
When the C API being used includes multiple names for the same
underlying symbol (e.g. multiple #define's for the same variable), then
cgo will generate the same placeholder variables for each name.  This
then prevents the code from compiling due to multiple declarations of
the same variable - so change cgo to only create one instance of the
variable for the underlying symbol.

R=rsc
CC=golang-dev
https://golang.org/cl/4826055
2011-08-16 14:56:23 -04:00
Lucio De Re
f12e543255 5l, 6l, 8l: add varargck for %Z
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4837044
2011-08-16 14:22:12 -04:00
Lucio De Re
c8c6e1961d 5c, 6c, 6l: fix Plan 9 build warnings
src/cmd/5c/reg.c:
. Added USED() attribute.

src/cmd/6c/cgen.c:
. Revised code around "REGARG" to resemble use in "8c" and
  consequently remove a warning.

src/cmd/6l/asm.c:
. Added USED() attributes.
. Removed an unnecessary assignment.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4836045
2011-08-16 14:22:08 -04:00
Lucio De Re
93ecb5bb1b ld: make addaddrplus4 static
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4835043
2011-08-16 14:22:02 -04:00
Dmitriy Vyukov
53573c02b8 rpc: make Server.Mutex unexported
Currently it's possible to write:
var s rpc.Server
...
// reuse for my own purposes
s.Lock()
...
s.Unlock()
which is seemingly not intended.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4888049
2011-08-16 18:34:56 +10:00
Dmitriy Vyukov
381f6a2eeb syscall: make LazyDLL/LazyProc.Mutex unexported
They are seemingly not intended to be a part
of the public interface.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4873052
2011-08-16 18:33:48 +10:00
Rob Pike
00dd2b4ab9 builtin: correct description of a closed channel.
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/4896046
2011-08-16 16:03:30 +10:00
Rob Pike
43d6389397 builtin: tweak a couple of descriptions.
R=golang-dev, adg, dsymonds
CC=golang-dev
https://golang.org/cl/4875050
2011-08-16 15:24:00 +10:00
Robert Griesemer
0310935058 godoc: show all top-level decls for (fake) package builtin
R=r, adg
CC=golang-dev
https://golang.org/cl/4904045
2011-08-15 19:05:52 -07:00
Robert Griesemer
91fadbca17 godoc: fix escaping in templates
- HTML-escape URL paths
- URL-escape URL parameters

R=bradfitz
CC=golang-dev
https://golang.org/cl/4890041
2011-08-15 15:15:54 -07:00
Sugu Sougoumarane
9f677f91d1 rpc: implement ServeRequest to synchronously serve a single request.
This is useful for applications that want to micromanage the rpc service.
Moved part of ServeCodec into a new readRequest function.
Renamed existing readRequest to readRequestHeader, and reordered
its parameters to align with the new readRequest and service.call.

R=golang-dev, r, rsc, sougou
CC=golang-dev, msolomon
https://golang.org/cl/4889043
2011-08-16 08:06:22 +10:00
Rob Pike
de1f856d66 builtin: add documentation for builtins
Do this by adding a fake package called builtin. At the moment, godoc will
not present this documentation because the function names are all lower case,
but there are plans to address this.
The print and println functions are undocumented here. I could be talked
into doing them but I'd rather not promote their use.

R=dsymonds, n13m3y3r, r, gri, rsc
CC=golang-dev
https://golang.org/cl/4907041
2011-08-16 07:51:44 +10:00
Gustavo Niemeyer
b0fc8a9d57 build: don't print anything on version.bash -save
R=rsc
CC=golang-dev
https://golang.org/cl/4904044
2011-08-15 14:25:54 -03:00
Gustavo Niemeyer
220c74984a build: support versioning without hg
CL 4873048 introduced the ability to build without hg and
getting an "unknown" version.  While this approach works
to avoid the hg dependency, it also means that every
exported tree that is built without hg or .hg will have not
only missing information, but will also be compatible to
one another.  Considering that it is a common practice to
remove the VCS data in distributions, I suggest we don't
take this approach to avoid its consequences.

This CL fixes the same problem in a different way: if a
VERSION file at the top of the tree exists, use it at
all times.  If it doesn't, fall back to using information
from hg necessarily, and fail if that's not possible.  The
error message when VERSION and hg are not available
instructs users to handle it properly.

The VERSION file can be generated with
"src/version.bash -save" while hg is still around.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/4897043
2011-08-15 14:19:30 -03:00
Gustavo Niemeyer
a2bb0159d6 reflect: panic on Invalid Interface call
This was initially pushed as part of CL 4876046, found
when logic in exp/template was using the method on
an Invalid value.

R=rsc
CC=golang-dev
https://golang.org/cl/4890043
2011-08-15 14:14:15 -03:00
Andrew Gerrand
241a262fe5 build: don't require hg for build
R=golang-dev, dsymonds, n13m3y3r
CC=golang-dev
https://golang.org/cl/4873048
2011-08-15 21:19:07 +10:00
Gustavo Niemeyer
175849295c runtime: fix pseudo-randomness on some selects
Fixes #2152.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/4888044
2011-08-15 03:51:51 -03:00
Rob Pike
d7440ce21a old/template: copy code from template
First step of moving exp/template into template: save the old code.
Code is unedited except for target name in Makefile.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4893042
2011-08-15 15:16:57 +10:00
Gustavo Niemeyer
e3df71f50b exp/template: support field syntax on maps
While using exp/template in practice, the syntax for
indexing values using the "index" action was found to be
very inconvenient for frequent use when handling dynamic
data from maps such as the ones used with json and yaml,
that use a type like map[string]interface{}.

For these kinds of maps, the default handling of fields as
{{.Field}} makes the task of handling the several references
significantly more pleasant and elegant, and is equivalent
to what's currently done in the "template" package and in
other external packages (e.g. mustache).

Even with this change, the index action is still relevant
as it allows indexing maps in other scenarios where keys
wouldn't be valid field names.

R=golang-dev, r, gustavo
CC=golang-dev
https://golang.org/cl/4898043
2011-08-15 00:56:01 -03:00
Gustavo Niemeyer
e3f3a5411a exp/template: don't panic on range of nil interface
This avoids a non-obvious panic when range is used on a
nil interface, and fixes it by behaving as if the range
was empty.

The new behavior is equivalent to the outcome of iterating
on a nil map or slice, and is useful because it allows
generic structures such as used in json (map[string]interface{})
to behave correctly if a key generally set to a list or map
isn't present.

R=golang-dev, r, gustavo
CC=golang-dev
https://golang.org/cl/4876046
2011-08-15 00:22:28 -03:00
Robert Hencke
8a439334ad exp/norm: fix incorrect prints found by govet.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4895042
2011-08-14 14:02:48 +10:00
Andrew Gerrand
6e66b16abe goinstall: report all newly-installed public packages
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4875048
2011-08-14 10:52:20 +10:00
David Symonds
5e48e648f1 exp/template: rename filter: url -> urlquery.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046
2011-08-13 14:00:16 +10:00
Robert Griesemer
c71b676724 godoc: position URLs (containing file names) must be quoted and URL escaped
Since the posLink_url also adds a non-URL attribute, the quoting and  URL-escaping
must happen inside posLink_url (otherwise the non-URL attribute becomes part or the
URL portion of the tag.

R=r
CC=golang-dev
https://golang.org/cl/4888041
2011-08-12 16:28:55 -07:00
Robert Griesemer
5c45e56898 godoc: remove last vestiges of old template system
- rename template funcs for better consistency and
  sort them into groups of related functionality
- try to be more consistent with html vs url escaping

R=r
CC=golang-dev
https://golang.org/cl/4887041
2011-08-12 15:43:10 -07:00
Robert Griesemer
5233c50321 godoc: first round of template cleanups
- simplified pipelines
- simplified templates by using template variables
- converted most old-style formatters into new-style funcs
- fixed some escaping bugs (use of url escaping where it was missing)

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4868044
2011-08-12 10:06:32 -07:00
Marcel van Lohuizen
4abbdc0399 exp/norm: generate trie struct in triegen.go for better encapsulation.
R=r, r
CC=golang-dev
https://golang.org/cl/4837071
2011-08-12 18:00:31 +02:00
Marcel van Lohuizen
58a92bd1ef exp/norm: generate trie struct in triegen.go for better encapsulation.
R=r, r
CC=golang-dev
https://golang.org/cl/4837071
2011-08-12 17:44:14 +02:00
Joel Sing
8c46e47b61 crypto, exec, path, time: add support for OpenBSD
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4837048
2011-08-12 14:44:16 +10:00
Mike Samuel
595e9d5034 exp/template/html: New package with a toy template transformation.
func Reverse(*Template) *Template
returns a template that produces the reverse of the original
for any input.

Changes outside exp/template/html include:
- Adding a getter for a template's FuncMap so that derived templates
  can inherit function definitions.
- Exported one node factory function, newIdentifier.
  Deriving tempaltes requires constructing new nodes, but I didn't
  export all of them because I think shallow copy functions might
  be more useful for this kind of work.
- Bugfix: Template's Name() method ignores the name field so
  template.New("foo") is a nil dereference instead of "foo".

Caveats: Reverse is a toy.  It is not UTF-8 safe, and does not
preserve order of calls to funcs in FuncMap.

For context, see http://groups.google.com/group/golang-nuts/browse_thread/thread/e8bc7c771aae3f20/b1ac41dc6f609b6e?lnk=gst

R=rsc, r, nigeltao, r
CC=golang-dev
https://golang.org/cl/4808089
2011-08-12 14:34:29 +10:00
David Symonds
fe59d86dd6 exp/template: fix implementation of printValue.
R=r
CC=golang-dev
https://golang.org/cl/4878042
2011-08-12 13:29:56 +10:00
Rob Pike
3cca9e0b00 utf8: rename some internal constants to remove leading underscores.
How quaint.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4874045
2011-08-12 11:50:46 +10:00
Rob Pike
b1d1da405a exp/template: add builtin len function
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4868045
2011-08-12 11:47:44 +10:00
Robert Griesemer
2e394c51d9 godoc: moving to new template package
- first step; rough conversion of all template files
- there is plenty of opportunity for cleanups/simplifications (next CLs)
- html and text output as before

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4852048
2011-08-11 13:24:13 -07:00
Nigel Tao
bca65e395e html: parse more malformed tags.
This continues the work in revision 914a659b44ff, now passing more test
cases. As before, the new tokenization tests match html5lib's behavior.

Fixes #2124.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/4867042
2011-08-11 18:49:09 +10:00
Rob Pike
6ca968c791 exp/template: find the String method by taking the address if we need to.
Also simplify nil handling in printing.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4869042
2011-08-11 14:36:51 +10:00
Gustavo Niemeyer
f3625e7087 exp/template: rename Parse*File and Parse*Files for clarity
IMPORTANT: Previous usage of *Files will continue to compile
fine but misbehave since the interface is compatible.

The following functions have been renamed:

    ParseFiles => ParseGlob
    ParseFile => ParseFiles
    ParseSetFiles => ParseSetGlob
    ParseSetFile => ParseSetFiles
    ParseTemplateFiles => ParseTemplateGlob
    ParseTemplateFile => ParseTemplateFiles

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4867041
2011-08-10 23:28:48 -05:00
Alex Brainman
c8ee9c60d2 runtime: better checks for syscall.NewCallback parameter
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4859042
2011-08-11 12:23:55 +10:00
Russ Cox
c02423902d build: allow builds without cgo
R=bradfitz, dsymonds, fshahriar
CC=golang-dev
https://golang.org/cl/4859043
2011-08-10 21:36:48 -04:00
Rob Pike
39fa2a5bf2 exp/template: truth for interface values.
Also protect against invalid (zero Value) reflect.Values.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/4810094
2011-08-11 08:27:16 +10:00
Dave Grijalva
8f3c7497ac http: corrects undocumented side effects in http.DefaultTransport's RoundTrip method
Fixes #2140.

The http.DefaultTransport's RoundTrip method leaves the http.Request object
in an altered state after performing the round trip.  This patch removes
the header from the Request before returning to the client.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4857041
2011-08-10 14:16:13 -07:00
Brad Fitzpatrick
31fa584906 http: fix ParseMultipartForm after MultipartReader error
Addresses part of issue 2093
Thanks to espians....@

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/4808087
2011-08-10 08:08:53 -07:00
Marcel van Lohuizen
849b54a2f9 exp/norm: added trie lookup code and associated tests.
- triegen.go: Factored out trie generation code from maketables.go
  (only renamed printTrieTables to printTables and made it a method).
- maketesttables.go: new tool to generate data for the trie unit test.
- Makefile: changed accordingly.
- trie.go: trie lookup code.
- trietest_data.go: generated by maketesttables.go.
- trie_test.go: unit test for trie.go.

R=r
CC=golang-dev
https://golang.org/cl/4844053
2011-08-10 15:36:27 +02:00
Marcel van Lohuizen
00cb627b87 exp/norm: added trie lookup code and associated tests.
- triegen.go: Factored out trie generation code from maketables.go
  (only renamed printTrieTables to printTables and made it a method).
- maketesttables.go: new tool to generate data for the trie unit test.
- Makefile: changed accordingly.
- trie.go: trie lookup code.
- trietest_data.go: generated by maketesttables.go.
- trie_test.go: unit test for trie.go.

R=r
CC=golang-dev
https://golang.org/cl/4844053
2011-08-10 15:34:12 +02:00
Russ Cox
83c734601c json: fix []unmarshaler case
Now that reflect has v.Addr(), we can use it.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4860041
2011-08-10 09:26:51 -04:00
Rob Pike
c9cf04a9f6 time: allow the input to have fractional seconds even if
the format string does not specify its presence.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4839059
2011-08-10 23:24:45 +10:00
Alex Brainman
9c774c3f26 runtime: correct seh installation during callbacks
Every time we enter callback from Windows, it is
possible that go exception handler is not at the top
of per-thread exception handlers chain. So it needs
to be installed again. At this moment this is done
by replacing top SEH frame with SEH frame as at time
of syscall for the time of callback. This is incorrect,
because, if exception strike, we won't be able to call
any exception handlers installed inside syscall,
because they are not in the chain. This changes
procedure to add new SEH frame on top of existing
chain instead.

I also removed m sehframe field, because I don't
think it is needed. We use single global exception
handler everywhere.

R=golang-dev, r
CC=golang-dev, hectorchu
https://golang.org/cl/4832060
2011-08-10 17:17:28 +10:00
Nigel Tao
37afff2978 html: parse malformed tags missing a '>', such as <p id=0</p>.
The additional token_test.go cases matches html5lib behavior.

Fixes #2124.

R=gri
CC=golang-dev
https://golang.org/cl/4844055
2011-08-10 13:39:07 +10:00
Wei Guangjing
1ac7a69701 ld: add one empty symbol into pe to make dumpbin works.
Fixes #2139.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/4838056
2011-08-10 11:09:06 +10:00
Brad Fitzpatrick
d24a9785eb http: configurable and default request header size limit
This addresses the biggest DoS in issue 2093

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4841050
2011-08-09 10:55:14 -07:00
Yasuhiro Matsumoto
29df7bb7ec http: add test to serve content in index.html
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4798071
2011-08-09 10:25:53 -07:00
Rob Pike
1adda4601a exp/template: do not take address of interface variable to find methods.
Also allow struct values as "with" targets.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4809086
2011-08-09 17:07:29 +10:00
Rob Pike
7506ee7584 exp/template: remove reflect from the API
It means keeping two sets of maps, but things look cleaner from
the outside.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4839056
2011-08-09 16:49:36 +10:00
Rob Pike
c66917d2b6 exp/template: split the parse tree into a separate package exp/template/parse
Mostly a mechanical change, with a few cleanups to make the split easier.
The external interface to exp/template is unaffected.

In another round I will play with the function map setup to see if I can
avoid exposing reflect across the boundary, but that will require some
structural changes I did not want to mix into this CL.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4849049
2011-08-09 15:42:53 +10:00
Kyle Consalus
476150f4bf crypto/x509, go/scanner, index/suffixarray: Removed []interface{}/vector uses.
Changed some []interface{} uses to slices of the concrete types; removed use of IntVector.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/4810085
2011-08-08 14:32:37 -07:00
Robert Griesemer
5987a4ad29 scanner: correct error position for illegal UTF-8 encodings
- added corresponding test cases
- re-grouped tests for better readability

Fixes #2138.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4815091
2011-08-08 13:54:32 -07:00
John Asmuth
ffc0830c75 container/vector: removed last instances of vector outside of container/vector itself from the core libs
R=gri
CC=golang-dev
https://golang.org/cl/4810078
2011-08-08 11:27:09 -07:00
Joel Sing
68fea34be3 syscall: move bsd mmap syscall
The mmap system call varies across BSDs. Move mmap and munmap into
the operating system dependent files. This will be needed to add
syscall support for OpenBSD.

R=rsc
CC=golang-dev
https://golang.org/cl/4822056
2011-08-08 09:56:45 -04:00
Joel Sing
f6fab25582 net: add support for openbsd
R=rsc
CC=golang-dev
https://golang.org/cl/4816060
2011-08-08 09:56:42 -04:00
Joel Sing
21ac258e07 runtime: openbsd amd64 runtime support
Add support for the go runtime on openbsd/amd64. This is based on
the existing freebsd runtime.

Threads are implemented using OpenBSD's rthreads, which are currently
disabled by default, however can be enabled via the kern.rthreads
sysctl.

For now, cgo is disabled.

R=rsc
CC=golang-dev
https://golang.org/cl/4815067
2011-08-08 09:56:38 -04:00
Joel Sing
604b91a43e os: add support for openbsd
R=rsc
CC=golang-dev
https://golang.org/cl/4798061
2011-08-08 09:56:36 -04:00
Rob Pike
9c2ebab826 exp/template: document that comments may span newlines.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4855045
2011-08-08 23:42:49 +10:00
Dmitriy Vyukov
54e9406ffb runtime: add more specialized type algorithms
The change adds specialized type algorithms
for slices and types of size 8/16/32/64/128.
It significantly accelerates chan and map operations
for most builtin types as well as user structs.

benchmark                   old,ns/op   new,ns/op
BenchmarkChanUncontended          226          94
(on Intel Xeon E5620, 2.4GHz, Linux 64 bit)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4815087
2011-08-08 09:35:32 -04:00
David Symonds
a09ba8b638 exp/template: url filter.
R=r
CC=golang-dev
https://golang.org/cl/4837063
2011-08-08 16:29:57 +10:00
David Symonds
ec010fddb5 exp/template: fix Must example.
R=r
CC=golang-dev
https://golang.org/cl/4839052
2011-08-08 15:38:37 +10:00
Rob Pike
3c10403784 time: parse and format fractional seconds
R=golang-dev, rogpeppe, r, dsymonds, bradfitz, fvbommel
CC=golang-dev
https://golang.org/cl/4830065
2011-08-08 07:50:17 +10:00
Robert Griesemer
4c268b335f gofmt: update test script so 'make test' succeeds
R=r, rsc
CC=golang-dev
https://golang.org/cl/4832055
2011-08-06 12:30:54 -07:00
Alex Brainman
be269b2f6d time: fix windows build
R=golang-dev, mattn.jp, dsymonds
CC=golang-dev
https://golang.org/cl/4849042
2011-08-05 17:19:17 +10:00
Rob Pike
88233e89db asn1: fix build
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4830061
2011-08-05 15:10:06 +10:00
Rob Pike
bfaa175e09 time: add nanoseconds to the Time structure.
R=golang-dev, dsymonds, bradfitz, kevlar, rsc, r
CC=golang-dev
https://golang.org/cl/4851041
2011-08-05 13:44:02 +10:00
Alex Brainman
5da14d1697 net: implement windows LookupMX and LookupAddr
Also sort SRV records before returning from LookupSRV.

R=rsc
CC=golang-dev
https://golang.org/cl/4817049
2011-08-05 10:27:51 +10:00
Mikio Hara
ba9833269d net: fix /proc/net/igmp,igmp6 reading bug on linux
Fixes #2130.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/4846044
2011-08-05 09:20:13 +10:00
Rob Pike
5b1f159fb5 exp/norm: fix build by adding a test placeholder
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4838050
2011-08-05 08:25:49 +10:00
Marcel van Lohuizen
b35d49fca1 exp/norm: maketables tool for generating tables for normalization.
R=r, bsiegert, r, alex.brainman
CC=golang-dev
https://golang.org/cl/4662080
2011-08-04 23:15:19 +02:00
Dmitriy Vyukov
d770aadee5 runtime: faster chan creation on Linux/FreeBSD/Plan9
The change removes chan finalizer (Lock destructor)
if it is not required on the platform.

benchmark                    old ns/op    new ns/op    delta
BenchmarkChanCreation          1132.00       381.00  -66.34%
BenchmarkChanCreation-2        1215.00       243.00  -80.00%
BenchmarkChanCreation-4        1084.00       186.00  -82.84%
BenchmarkChanCreation-8        1415.00       154.00  -89.12%
BenchmarkChanCreation-16       1386.00       144.00  -89.61%
(on 2 x Intel Xeon E5620, 8 HT cores, 2.4 GHz, Linux)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4841041
2011-08-04 08:31:03 -04:00
Yasuhiro Matsumoto
62d4b8ebd2 http: correct path to serve index.html.
calling filepath.FromSlash(x) make invalid character to serve file.
Fixes #2128

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4810064
2011-08-04 08:20:53 -04:00
David Symonds
4143491c4a http: add more MPEG-4 MIME types to sniffer, and disable MP4 sniffing.
R=rsc
CC=golang-dev
https://golang.org/cl/4808056
2011-08-04 22:10:17 +10:00
Rob Pike
583f72434f fmt: call UpdateMemStats in malloc counter
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4830059
2011-08-04 16:32:14 +10:00
David Symonds
bb8e36b4a1 gob: avoid a couple of init-time allocations.
R=r
CC=golang-dev
https://golang.org/cl/4806049
2011-08-04 16:22:22 +10:00
Rob Pike
19e80b0818 gob: add UpdateMemStats calls to malloc counter
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4808071
2011-08-04 15:56:25 +10:00
Rob Pike
ee9168d507 gob: don't invoke GobEncoder on zero values.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4801076
2011-08-04 14:39:44 +10:00
Mikio Hara
946cb0ece1 net: joined group addresses for a specific interface for darwin, freebsd, linux
This CL enables to list the multicast, joined group addresses
for a specific interface by using Interface.MulticastAddrs
method.

R=rsc
CC=golang-dev
https://golang.org/cl/4808062
2011-08-04 00:22:52 -04:00
Mikio Hara
dc7f82559d syscall: update routing message support for BSD variants
R=rsc
CC=golang-dev
https://golang.org/cl/4826056
2011-08-04 00:22:48 -04:00
Hector Chu
6500065543 runtime: remove unnecessary locking
R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/4819051
2011-08-04 00:22:39 -04:00
Dmitriy Vyukov
a496c9eaa6 runtime: correct Note documentation
Reflect the fact that notesleep() can be called
by exactly one thread.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4816064
2011-08-03 15:51:55 -04:00
David Symonds
11e254e62c ld: fail linking if the top-level package is not main.
This makes {5,6,8}l conform to the spec more tightly.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4826063
2011-08-02 07:45:04 -04:00
Rob Pike
3dbe10c453 exp/template: return nil value from helpers on error, even methods.
R=rsc
CC=golang-dev
https://golang.org/cl/4835046
2011-08-01 20:02:52 -07:00
Andrew Gerrand
b0ef0294d2 go/build: use GOBIN as binary path for GOROOT
Fixes #2106.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4836047
2011-08-01 19:17:23 -07:00
Roger Peppe
6ed27d4770 exp/template: make index function on maps return zero value when key not present.
R=r
CC=golang-dev
https://golang.org/cl/4808065
2011-08-01 09:03:35 -07:00
Roger Peppe
5c5ce6d24d exp/template: ensure that a valid Set is returned even on error.
R=r
CC=golang-dev
https://golang.org/cl/4838044
2011-08-01 09:02:06 -07:00
Dave Cheney
317911c9ff 5g: fix set but not used error
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4816061
2011-07-31 19:54:47 -07:00
Alex Brainman
8800f7cb55 http: correct format flags when printing errors during tests
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4809065
2011-08-01 11:50:50 +10:00
Lucio De Re
05f734c8b4 cmd/ld/pe.c: Corrected mismatched print formats and variables.
R=golang-dev, alex.brainman
CC=golang-dev, rsc
https://golang.org/cl/4839041
2011-08-01 11:12:50 +10:00
Nigel Tao
1d0c141d7d html: parse doctype tokens; merge adjacent text nodes.
The test case input is "<!DOCTYPE html><span><button>foo</span>bar".
The correct parse is:
| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <span>
|       <button>
|         "foobar"

R=gri
CC=golang-dev
https://golang.org/cl/4794063
2011-08-01 10:26:46 +10:00
Alex Brainman
9d7e39340d syscall: delay load of dll functions until they are called
Before this change, syscall package would load
all dlls used anywhere in the go tree on startup.
For example, this program:

package main

import "fmt"

func main() {
       fmt.Printf("Hello world\n")
}

would load these dlls

kernel32.dll
advapi32.dll
shell32.dll
wsock32.dll
ws2_32.dll
dnsapi.dll
iphlpapi.dll

Most of these dlls are network related and are not used
in this program. Now the same program loads only

kernel32.dll
shell32.dll

This decreases start times somewhat.

This also relaxes the rules of which dlls can be included
in the standard library. We could now include system calls
that are not available on all versions of Windows, because
we could decide if we should call them during runtime.

R=rsc, vcc.163
CC=golang-dev
https://golang.org/cl/4815046
2011-07-31 20:07:04 +10:00
Andrew Gerrand
ffccc026cb exp/norm: correct package doc comment
Fixes #2118.

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/4815073
2011-07-30 18:02:09 -07:00
Robert Griesemer
7162f39fc3 exp/template: fix endless loop
No progress was made in indirect() if the reflect.Value
was an non-nil and non-empty interface.

R=r, r
CC=golang-dev
https://golang.org/cl/4810060
2011-07-30 17:11:52 -07:00
Hector Chu
9bc58accce runtime: fix scheduling race
Affects programs using cgo or runtime.LockOSThread.

Fixes #2100.

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/4810059
2011-07-29 17:39:02 -04:00
Kyle Lemons
31442a6737 xml: Header: fix close tag and newline
R=rsc
CC=golang-dev
https://golang.org/cl/4830043
2011-07-29 14:09:07 -04:00
Joel Sing
2d7ddfa64d libmach: stubs for openbsd
Add libmach stubs for openbsd.

R=rsc
CC=golang-dev
https://golang.org/cl/4815065
2011-07-29 13:48:00 -04:00
Russ Cox
124172e2cf godoc: allow form feed in text files
Now recognizes misc/emacs/go-mode-load.el as text.

Fixes #2115.

R=gri
CC=golang-dev
https://golang.org/cl/4801061
2011-07-29 13:47:54 -04:00
Joel Sing
ffa14e849c 6l: OpenBSD support
Add linker support for OpenBSD ELF-64.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4815066
2011-07-29 13:47:41 -04:00
Dmitriy Vyukov
91f0f18100 runtime: fix data race in findfunc()
The data race can lead to reads of partially
initialized concurrently mutated symbol data.
The change also adds a simple sanity test
for Caller() and FuncForPC().

R=rsc
CC=golang-dev
https://golang.org/cl/4817058
2011-07-29 13:47:24 -04:00
Joel Sing
eb2b3f5dc7 syscall: move bsd pipe syscall
Not all BSDs have the same pipe() syscall implementation - move the Darwin/FreeBSD specific implementation into their respective OS syscall files. This will be needed to add OpenBSD syscall support.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4823057
2011-07-29 13:47:20 -04:00
Andrew Gerrand
e0b6f4721f archive/zip: more efficient reader and bug fix
Fixes #2090.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4815068
2011-07-29 10:47:00 -07:00
Dmitriy Vyukov
4e5086b993 runtime: improve Linux mutex
The implementation is hybrid active/passive spin/blocking mutex.
The design minimizes amount of context switches and futex calls.
The idea is that all critical sections in runtime are intentially
small, so pure blocking mutex behaves badly causing
a lot of context switches, thread parking/unparking and kernel calls.
Note that some synthetic benchmarks become somewhat slower,
that's due to increased contention on other data structures,
it should not affect programs that do any real work.

On 2 x Intel E5620, 8 HT cores, 2.4GHz
benchmark                     old ns/op    new ns/op    delta
BenchmarkSelectContended         521.00       503.00   -3.45%
BenchmarkSelectContended-2       661.00       320.00  -51.59%
BenchmarkSelectContended-4      1139.00       629.00  -44.78%
BenchmarkSelectContended-8      2870.00       878.00  -69.41%
BenchmarkSelectContended-16     5276.00       818.00  -84.50%
BenchmarkChanContended           112.00       103.00   -8.04%
BenchmarkChanContended-2         631.00       174.00  -72.42%
BenchmarkChanContended-4         682.00       272.00  -60.12%
BenchmarkChanContended-8        1601.00       520.00  -67.52%
BenchmarkChanContended-16       3100.00       372.00  -88.00%
BenchmarkChanSync                253.00       239.00   -5.53%
BenchmarkChanSync-2             5030.00      4648.00   -7.59%
BenchmarkChanSync-4             4826.00      4694.00   -2.74%
BenchmarkChanSync-8             4778.00      4713.00   -1.36%
BenchmarkChanSync-16            5289.00      4710.00  -10.95%
BenchmarkChanProdCons0           273.00       254.00   -6.96%
BenchmarkChanProdCons0-2         599.00       400.00  -33.22%
BenchmarkChanProdCons0-4        1168.00       659.00  -43.58%
BenchmarkChanProdCons0-8        2831.00      1057.00  -62.66%
BenchmarkChanProdCons0-16       4197.00      1037.00  -75.29%
BenchmarkChanProdCons10          150.00       140.00   -6.67%
BenchmarkChanProdCons10-2        607.00       268.00  -55.85%
BenchmarkChanProdCons10-4       1137.00       404.00  -64.47%
BenchmarkChanProdCons10-8       2115.00       828.00  -60.85%
BenchmarkChanProdCons10-16      4283.00       855.00  -80.04%
BenchmarkChanProdCons100         117.00       110.00   -5.98%
BenchmarkChanProdCons100-2       558.00       218.00  -60.93%
BenchmarkChanProdCons100-4       722.00       287.00  -60.25%
BenchmarkChanProdCons100-8      1840.00       431.00  -76.58%
BenchmarkChanProdCons100-16     3394.00       448.00  -86.80%
BenchmarkChanProdConsWork0      2014.00      1996.00   -0.89%
BenchmarkChanProdConsWork0-2    1207.00      1127.00   -6.63%
BenchmarkChanProdConsWork0-4    1913.00       611.00  -68.06%
BenchmarkChanProdConsWork0-8    3016.00       949.00  -68.53%
BenchmarkChanProdConsWork0-16   4320.00      1154.00  -73.29%
BenchmarkChanProdConsWork10     1906.00      1897.00   -0.47%
BenchmarkChanProdConsWork10-2   1123.00      1033.00   -8.01%
BenchmarkChanProdConsWork10-4   1076.00       571.00  -46.93%
BenchmarkChanProdConsWork10-8   2748.00      1096.00  -60.12%
BenchmarkChanProdConsWork10-16  4600.00      1105.00  -75.98%
BenchmarkChanProdConsWork100    1884.00      1852.00   -1.70%
BenchmarkChanProdConsWork100-2  1235.00      1146.00   -7.21%
BenchmarkChanProdConsWork100-4  1217.00       619.00  -49.14%
BenchmarkChanProdConsWork100-8  1534.00       509.00  -66.82%
BenchmarkChanProdConsWork100-16 4126.00       918.00  -77.75%
BenchmarkSyscall                  34.40        33.30   -3.20%
BenchmarkSyscall-2               160.00       121.00  -24.38%
BenchmarkSyscall-4               131.00       136.00   +3.82%
BenchmarkSyscall-8               139.00       131.00   -5.76%
BenchmarkSyscall-16              161.00       168.00   +4.35%
BenchmarkSyscallWork             950.00       950.00   +0.00%
BenchmarkSyscallWork-2           481.00       480.00   -0.21%
BenchmarkSyscallWork-4           268.00       270.00   +0.75%
BenchmarkSyscallWork-8           156.00       169.00   +8.33%
BenchmarkSyscallWork-16          188.00       184.00   -2.13%
BenchmarkSemaSyntNonblock         36.40        35.60   -2.20%
BenchmarkSemaSyntNonblock-2       81.40        45.10  -44.59%
BenchmarkSemaSyntNonblock-4      126.00       108.00  -14.29%
BenchmarkSemaSyntNonblock-8      112.00       112.00   +0.00%
BenchmarkSemaSyntNonblock-16     110.00       112.00   +1.82%
BenchmarkSemaSyntBlock            35.30        35.30   +0.00%
BenchmarkSemaSyntBlock-2         118.00       124.00   +5.08%
BenchmarkSemaSyntBlock-4         105.00       108.00   +2.86%
BenchmarkSemaSyntBlock-8         101.00       111.00   +9.90%
BenchmarkSemaSyntBlock-16        112.00       118.00   +5.36%
BenchmarkSemaWorkNonblock        810.00       811.00   +0.12%
BenchmarkSemaWorkNonblock-2      476.00       414.00  -13.03%
BenchmarkSemaWorkNonblock-4      238.00       228.00   -4.20%
BenchmarkSemaWorkNonblock-8      140.00       126.00  -10.00%
BenchmarkSemaWorkNonblock-16     117.00       116.00   -0.85%
BenchmarkSemaWorkBlock           810.00       811.00   +0.12%
BenchmarkSemaWorkBlock-2         454.00       466.00   +2.64%
BenchmarkSemaWorkBlock-4         243.00       241.00   -0.82%
BenchmarkSemaWorkBlock-8         145.00       137.00   -5.52%
BenchmarkSemaWorkBlock-16        132.00       123.00   -6.82%
BenchmarkContendedSemaphore      123.00       102.00  -17.07%
BenchmarkContendedSemaphore-2     34.80        34.90   +0.29%
BenchmarkContendedSemaphore-4     34.70        34.80   +0.29%
BenchmarkContendedSemaphore-8     34.70        34.70   +0.00%
BenchmarkContendedSemaphore-16    34.80        34.70   -0.29%
BenchmarkMutex                    26.80        26.00   -2.99%
BenchmarkMutex-2                 108.00        45.20  -58.15%
BenchmarkMutex-4                 103.00       127.00  +23.30%
BenchmarkMutex-8                 109.00       147.00  +34.86%
BenchmarkMutex-16                102.00       152.00  +49.02%
BenchmarkMutexSlack               27.00        26.90   -0.37%
BenchmarkMutexSlack-2            149.00       165.00  +10.74%
BenchmarkMutexSlack-4            121.00       209.00  +72.73%
BenchmarkMutexSlack-8            101.00       158.00  +56.44%
BenchmarkMutexSlack-16            97.00       129.00  +32.99%
BenchmarkMutexWork               792.00       794.00   +0.25%
BenchmarkMutexWork-2             407.00       409.00   +0.49%
BenchmarkMutexWork-4             220.00       209.00   -5.00%
BenchmarkMutexWork-8             267.00       160.00  -40.07%
BenchmarkMutexWork-16            315.00       300.00   -4.76%
BenchmarkMutexWorkSlack          792.00       793.00   +0.13%
BenchmarkMutexWorkSlack-2        406.00       404.00   -0.49%
BenchmarkMutexWorkSlack-4        225.00       212.00   -5.78%
BenchmarkMutexWorkSlack-8        268.00       136.00  -49.25%
BenchmarkMutexWorkSlack-16       300.00       300.00   +0.00%
BenchmarkRWMutexWrite100          27.10        27.00   -0.37%
BenchmarkRWMutexWrite100-2        33.10        40.80  +23.26%
BenchmarkRWMutexWrite100-4       113.00        88.10  -22.04%
BenchmarkRWMutexWrite100-8       119.00        95.30  -19.92%
BenchmarkRWMutexWrite100-16      148.00       109.00  -26.35%
BenchmarkRWMutexWrite10           29.60        29.40   -0.68%
BenchmarkRWMutexWrite10-2        111.00        61.40  -44.68%
BenchmarkRWMutexWrite10-4        270.00       208.00  -22.96%
BenchmarkRWMutexWrite10-8        204.00       185.00   -9.31%
BenchmarkRWMutexWrite10-16       261.00       190.00  -27.20%
BenchmarkRWMutexWorkWrite100    1040.00      1036.00   -0.38%
BenchmarkRWMutexWorkWrite100-2   593.00       580.00   -2.19%
BenchmarkRWMutexWorkWrite100-4   470.00       365.00  -22.34%
BenchmarkRWMutexWorkWrite100-8   468.00       289.00  -38.25%
BenchmarkRWMutexWorkWrite100-16  604.00       374.00  -38.08%
BenchmarkRWMutexWorkWrite10      951.00       951.00   +0.00%
BenchmarkRWMutexWorkWrite10-2   1001.00       928.00   -7.29%
BenchmarkRWMutexWorkWrite10-4   1555.00      1006.00  -35.31%
BenchmarkRWMutexWorkWrite10-8   2085.00      1171.00  -43.84%
BenchmarkRWMutexWorkWrite10-16  2082.00      1614.00  -22.48%

R=rsc, iant, msolo, fw, iant
CC=golang-dev
https://golang.org/cl/4711045
2011-07-29 12:44:06 -04:00
Russ Cox
bed7e3ed78 gc: fix pprof deadlock
Fixes #2051.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4834041
2011-07-28 21:03:40 -04:00
Russ Cox
032ffb2e90 gc: more graceful errors during struct definition
Fixes #2110.

R=ken2
CC=golang-dev
https://golang.org/cl/4823060
2011-07-28 20:41:18 -04:00
Rob Pike
33a4da89d3 exp/template: fix build
TBR=gri

R=gri
CC=golang-dev
https://golang.org/cl/4815070
2011-07-28 16:46:32 -07:00
Russ Cox
71ba47ac9e build: fix noclobber
I got it backwards last time, and somehow
that was leaking into the parent shell?

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4826054
2011-07-28 19:38:14 -04:00
Rob Pike
1b4dff0f69 exp/template: simplify the helper functions
- create a pair of "Must" functions, one for templates, one for sets
- regularize the return values of the parsers so they can be wrapped by Must
- delete all the old Must functions and methods.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/4826052
2011-07-28 16:19:16 -07:00
Russ Cox
28a23675cd 5g, 6g, 8g: shift, opt fixes
Fixes #1808.

R=ken2
CC=golang-dev
https://golang.org/cl/4813052
2011-07-28 18:22:12 -04:00
Russ Cox
8c23c1ab87 5g: defer vs optimizer bug
Fixes #1924.

R=ken2
CC=golang-dev
https://golang.org/cl/4802063
2011-07-28 16:28:23 -04:00
Andrew Balholm
3de6228aea http: make serveFile redirects relative to work with StripPrefix
serveFile was using absolute redirects, which didn't work under StripPrefix.
Now it uses relative redirects.

R=golang-dev, rsc, bradfitz
CC=golang-dev, kevlar
https://golang.org/cl/4789042
2011-07-28 11:43:16 -07:00
Russ Cox
08bfb39515 6g, 8g: divide corner case
Fixes #1772.

R=ken2
CC=golang-dev
https://golang.org/cl/4798062
2011-07-28 14:18:22 -04:00
Russ Cox
fe206e63ca build: handle spaces in $USER
Fixes #2107.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4830042
2011-07-28 13:04:52 -04:00
Russ Cox
e0d6f95069 build: update all-qemu.bash
nothing but GOARCH=arm makes sense.
http/cgi uses network too.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4800053
2011-07-28 13:04:30 -04:00
Russ Cox
4389192669 gc: shift type bug
Fixes #1664.

R=ken2
CC=golang-dev
https://golang.org/cl/4798056
2011-07-28 13:03:30 -04:00
Roger Peppe
ca68b2810d exp/template: make Set.ParseFile etc resolve functions in the Set
Fixes #2114

R=r
CC=golang-dev
https://golang.org/cl/4823056
2011-07-28 09:59:20 -07:00
Russ Cox
db9229def8 cgo: add GoBytes, fix gmp example
Fixes #1640.
Fixes #2007.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4815063
2011-07-28 12:39:50 -04:00
Russ Cox
2f8190a8f8 gc: line number + type checking nits
Fixes #1910.
Fixes #1979.
Fixes #1990.
Fixes #1993.
Fixes #2089.

R=ken2
CC=golang-dev
https://golang.org/cl/4828046
2011-07-28 12:31:16 -04:00
Roger Peppe
3041f2a37c exp/template: make Set.MustParse* methods return the set.
This brings them into line with the Template.MustParse* methods
and makes it possible to use them in global variable initializations.

R=r
CC=golang-dev
https://golang.org/cl/4798059
2011-07-28 08:41:06 -07:00
Alex Brainman
fa249cae38 ld: remove cseekend and redo pe writing
Simplify code and add more checks.

Fixes #2105.

R=rsc
CC=golang-dev
https://golang.org/cl/4794060
2011-07-28 14:30:52 +10:00
Rob Pike
5a52c6ad29 rpc and exp/template: simplify tests for exported items
Fix code to count mallocs - needed to call UpdateMemStats.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4823055
2011-07-27 21:26:16 -07:00
Benny Siegert
a65f4ccb89 image/tiff: Do not panic when RowsPerStrip is missing.
The RowsPerStrip tag is mandatory according to the spec. However,
Mac OS sometimes (?) omits it. I managed to create such an image
by applying "tiffutil -none" on a compressed image.

If RowsPerStrip is 0, there was a division by zero in the decoder.
Assume that the image is a single strip in this case.

R=nigeltao, bradfitz
CC=golang-dev
https://golang.org/cl/4815061
2011-07-28 11:15:59 +10:00
Russ Cox
890bdc5339 gc: top-level closure bug
Fixes #2055.

R=ken2
CC=golang-dev
https://golang.org/cl/4816059
2011-07-27 19:31:11 -04:00
Russ Cox
f91eb3c2f9 gc: composite literal double eval bug
Fixes #2086.

R=ken2
CC=golang-dev
https://golang.org/cl/4803055
2011-07-27 18:55:30 -04:00
Rob Pike
5ea413e2a0 unicode: fix case-mapping for roman numerals!!
Hurray!
Also fix the mystical U+0345 COMBINING GREEK YPOGEGRAMMENI,
so everyone is satisfied.
Also add a -local flag to use local files for faster turnaround
when debugging.

R=rsc
CC=golang-dev
https://golang.org/cl/4825054
2011-07-27 15:54:23 -07:00
John Asmuth
2f4632febc container/vector: removed some uses of container/vector in other pkgs
R=gri
CC=golang-dev
https://golang.org/cl/4823054
2011-07-27 15:23:42 -07:00
Robert Griesemer
d7a0e0e6a2 godoc: app engine configuration and updated documentation
Also: Fixed an error message in zip.go.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4816053
2011-07-27 15:14:12 -07:00
Russ Cox
1bd4b6371a gc: use more Go-like names for methods
Fixes #991.

R=ken2
CC=golang-dev
https://golang.org/cl/4819049
2011-07-27 17:56:13 -04:00
Russ Cox
112267d55e gc: diagnose (x) := 0
Fixes #1756.

R=ken2
CC=golang-dev
https://golang.org/cl/4810057
2011-07-27 17:39:30 -04:00
Russ Cox
db3088a37c build: fix for noclobber users
Fixes #2020.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4814056
2011-07-27 17:38:39 -04:00
Russ Cox
a84abbe508 gc: zero-width struct, zero-length array fixes
Fixes #1774.
Fixes #2095.
Fixes #2097.

R=ken2
CC=golang-dev
https://golang.org/cl/4826046
2011-07-27 16:47:45 -04:00
Russ Cox
dec8009fe8 gc: iota outside const
Fixes #1662.

R=ken2
CC=golang-dev
https://golang.org/cl/4828045
2011-07-27 14:45:27 -04:00
Russ Cox
49b70d01c0 gc: echo literal in error message
Fixes #1192.

R=ken2
CC=golang-dev
https://golang.org/cl/4794062
2011-07-27 14:36:21 -04:00
Russ Cox
100a034120 runtime: higher goroutine arg limit, clearer error
Fixes #591.

R=ken2
CC=golang-dev
https://golang.org/cl/4803054
2011-07-27 12:41:46 -04:00
David Symonds
c913cb8ba5 reflect: rename new TestVariadic to TestVariadicType.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4825050
2011-07-27 13:44:57 +10:00
David Symonds
fc1cf58809 reflect: doc fixes for obsolete types.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4802061
2011-07-27 13:29:44 +10:00
Rob Pike
2fc962697a goinstall: generate makefiles using exp/template
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4809052
2011-07-26 14:45:36 -07:00
Rob Pike
7e1101d470 rpc: convert /debug/rpc handler to exp/template
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4819048
2011-07-26 14:44:51 -07:00
Robert Griesemer
e21f69338b http: set content type for fileserver directory listings
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4815062
2011-07-26 11:30:11 -07:00
Russ Cox
12a5774cde gc, runtime: fix range+panic line number bugs
Fixes #1856.

R=ken2
CC=golang-dev
https://golang.org/cl/4810054
2011-07-26 00:52:46 -04:00
Russ Cox
cce10dacc6 gc: fix select line number
Fixes #1393.

R=ken2
CC=golang-dev
https://golang.org/cl/4811054
2011-07-26 00:52:17 -04:00
Russ Cox
bf899befdb gc: disallow [...][...]int{{1,2,3}}
Fixes #1600.

R=ken2
CC=golang-dev
https://golang.org/cl/4819045
2011-07-26 00:52:02 -04:00
Mikio Hara
e5437ab065 runtime: fix freebsd build
Fixes #2078.

R=rsc
CC=golang-dev
https://golang.org/cl/4800052
2011-07-26 00:49:32 -04:00
Russ Cox
55dfdb64ab build: remove rm dreg
Undo CL 4254056 now that enough time has elapsed
that people with old trees have all built and removed
those files (which are no longer generated in that location).

Fixes #1581.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4802059
2011-07-26 00:30:39 -04:00
David Symonds
e527d49e55 http: implement MP4 sniffing.
R=rsc
CC=golang-dev
https://golang.org/cl/4809044
2011-07-26 13:28:20 +10:00
Alex Brainman
003d5411ae net: fix memory corruption in windows *netFD.ReadFrom
We must keep memory used by syscall.WSARecvFrom away from
garbage collector until after overlapped call is completed.

Fixes #2094.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4817050
2011-07-26 11:55:52 +10:00
Andrew Gerrand
83305fecfe goinstall: abort and warn when using any url scheme, not just 'http://'
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4801053
2011-07-26 04:16:34 +10:00
Lucio De Re
75c918c1ae ld: fix build on Plan 9
ld/data.c:
. Format specifier with corresponding cast to cater for all
  architectures (llux and vlong).

ld/ldelf.c:
ld/ldmacho.c:
. Missing "pn" argument in diag() calls.

ld/ldpe.c:
. Dropped "sym->sectnum" in diag() call.
. Typo in a comment.

ld/lib.h:
. Added varargck pragma for "O".

R=rsc
CC=golang-dev
https://golang.org/cl/4749042
2011-07-25 13:45:50 -04:00
Lucio De Re
12995e2d35 gc: fix mkbuiltin for Plan 9 build
. Replaced Posix #includes with u.h and libc.h.
. Replaced fprintf(stderr,...); exit(1); with sysfatal() calls.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4823047
2011-07-25 13:45:37 -04:00
Wei Guangjing
ee14fbdf34 build: fixes for mingw-w64
R=rsc
CC=golang-dev
https://golang.org/cl/4742042
2011-07-25 13:39:01 -04:00
Wei Guangjing
0871af25aa ld: don't skip first 2 symbols in ldpe.
some object files don't has file name symbol.

R=golang-dev, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/4814051
2011-07-25 12:25:44 -04:00
Yuval Pavel Zholkover
2aa2ceb873 runtime: Plan 9, skip calling runtime·ldt0setup.
R=golang-dev
CC=alex.brainman, golang-dev
https://golang.org/cl/4816049
2011-07-25 12:25:41 -04:00
Dmitriy Vyukov
33ff947cac runtime: fix compilation of send select cases
Fixes #2102.

R=fullung, rsc
CC=golang-dev
https://golang.org/cl/4825043
2011-07-25 12:25:37 -04:00
Alex Brainman
770543107d syscall: remove unused windows code and comments
R=golang-dev, vcc.163, rsc
CC=golang-dev
https://golang.org/cl/4826042
2011-07-25 12:25:23 -04:00
Ian Lance Taylor
3a07d516b4 runtime: remove rnd calls that pass a second argument of 1
When rnd is called with a second argument of 1, it simply
returns the first argument anyway.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4820045
2011-07-24 22:03:17 -07:00
Russ Cox
a1e7cd97d5 exp/regexp: implement regexp API using exp/regexp/syntax
Still need to write tests for new syntax
and fix bugs that the tests find, but this
is a good check point.

All tests pass.

Compared against existing regexp:

benchmark                                old ns/op    new ns/op    delta
regexp.BenchmarkLiteral                       1869          620  -66.83%
regexp.BenchmarkNotLiteral                    9489         7823  -17.56%
regexp.BenchmarkMatchClass                   10372         8386  -19.15%
regexp.BenchmarkMatchClass_InRange           10800         7750  -28.24%
regexp.BenchmarkReplaceAll                   13492         8519  -36.86%
regexp.BenchmarkAnchoredLiteralShortNonMatch   747          339  -54.62%
regexp.BenchmarkAnchoredLiteralLongNonMatch    599          335  -44.07%
regexp.BenchmarkAnchoredShortMatch            2137          917  -57.09%
regexp.BenchmarkAnchoredLongMatch             2029          917  -54.81%

R=r, r
CC=golang-dev, sam.thorogood
https://golang.org/cl/4820046
2011-07-24 17:00:28 -04:00
Andrew Gerrand
fc2480da3c goinstall: write to goinstall.log in respective GOPATH
goinstall: report every newly installed package to the dashboard

This makes "goinstall -a" work on systems with GOROOTs that are
not user-writable, as is the case with Debian's Go packages.

This also makes goinstall.log the canonical list of installed
packages, in that only packages new to goinstall.log are reported to
the dashboard.

A side-effect is that writing to goinstall.log is now mandatory.
(A bug in the original implementation meant this was the case, anyway.)

The principal benefit of this change is that multiple packages from the
same repository can now be reported to the dashboard.  It is also less
likely for a user to report multiple installations of the same package
to the dashboard (they would need to remove the package from
goinstall.log first).

R=rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/4786041
2011-07-24 13:43:08 +10:00
Andrew Balholm
d56c8132e8 unicode: fix doc comment for Range32
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4811050
2011-07-24 10:51:19 +10:00
Florian Uekermann
480ef72c23 sort: fixed bug in (Float64Slice) Less; NaN less than anything else
Previously comparisons with NaN led to contradictory results if it was
compared to anything not NaN, since Less always returned false, thus
breaking monotonicity of ordering.
This fix makes NaN less than anything else and adds NaN and (+-)Inf to
testcases.

Fixes #2092.

R=golang-dev, r, rsc, r
CC=golang-dev
https://golang.org/cl/4805051
2011-07-23 15:47:06 -04:00
Quan Yong Zhai
47410a2490 runtime: replace byte-at-a-time zeroing loop with memclr
R=golang-dev, r, r, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4813043
2011-07-23 15:46:58 -04:00
Russ Cox
ba134539c5 runtime: faster entersyscall/exitsyscall
Replace cas with xadd in scheduler.
Suggested by Dmitriy in last code review.
Verified with Promela model.

When there's actual contention for the atomic word,
this avoids the looping that compare-and-swap requires.

benchmark                            old ns/op    new ns/op    delta
runtime_test.BenchmarkSyscall               32           26  -17.08%
runtime_test.BenchmarkSyscall-2            155           59  -61.81%
runtime_test.BenchmarkSyscall-3            112           52  -52.95%
runtime_test.BenchmarkSyscall-4             94           48  -48.57%
runtime_test.BenchmarkSyscallWork          871          872   +0.11%
runtime_test.BenchmarkSyscallWork-2        481          477   -0.83%
runtime_test.BenchmarkSyscallWork-3        338          335   -0.89%
runtime_test.BenchmarkSyscallWork-4        263          256   -2.66%

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4800047
2011-07-23 12:22:55 -04:00
Wei Guangjing
7ce1a4bdc0 ld: fixes .bss for ldpe
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4794056
2011-07-23 12:21:13 -04:00
Rob Pike
2d972ad493 exp/template: construct sets from plain template files
This is the last piece (I hope) of the set creation code.
These helpers create sets from files containing individual
template definitions, free of {{define}} clauses. This
design is helpful if the templates live one per file,
undecorated.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4801052
2011-07-23 18:10:30 +10:00
Robert Griesemer
3ddaa95d71 fix build: clean up file end in an attempt to fix build
R=r, iant
CC=golang-dev
https://golang.org/cl/4809050
2011-07-22 22:45:14 -07:00
Robert Griesemer
dcef981217 godoc/httpzip.go: use correct path in Readdir
Fixes a problem where Readdir would always return
empty directories (Readdir is only called by godoc
if the usual directory handler is commented out
in godoc.go, and if a zip file system is provided;
thus, this bug never manifested itself in godoc).

Also:
- better choice of variable/field names
- simplified error handling a bit
- better comments

R=bradfitz
CC=golang-dev
https://golang.org/cl/4813047
2011-07-22 22:24:04 -07:00
Brad Fitzpatrick
8fdc2851e4 zip: add a test for the previous >65k files fix
This surprisingly takes 30 seconds on my fast machine
so disabling by default. Need to optimize the Writer
at some point.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4815048
2011-07-22 18:30:07 -07:00
Russ Cox
a667e44e75 lib9: use $PWD in getwd
This makes the full file paths recorded by 6g
prefer $PWD over the actual directory name
(relevant when $PWD gets to the current directory
via symlinks).  It's what everyone else does, and
what people expect.

R=iant, r, mattn.jp
CC=golang-dev
https://golang.org/cl/4824041
2011-07-22 21:21:17 -04:00
Wei Guangjing
4e5e12e305 ld: fixes ldpe link with SXREF global values.
R=golang-dev, mattn.jp, rsc
CC=golang-dev
https://golang.org/cl/4794052
2011-07-22 21:21:08 -04:00
Russ Cox
b9b204d55d ld: detect all import cycles
Fixes #2052.

R=r
CC=golang-dev
https://golang.org/cl/4812053
2011-07-22 21:18:03 -04:00
Russ Cox
07c103f6e6 sort: remove testing cycle
import cycle:
        "testing"
        imports "flag"
        imports "sort"
        imports "testing"

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4811048
2011-07-22 21:17:46 -04:00
Robert Griesemer
e62e595e7a godoc/zip.go: fix another zip file system bug
Don't report that a directory was found just because we found
the list index where the directory would be if it were there...

R=iant
CC=golang-dev
https://golang.org/cl/4812051
2011-07-22 15:21:50 -07:00
Robert Griesemer
fa497796f5 go/parser: report illegal label declarations at ':' rather than guessing the start
Also:
- Add parser.SpuriousError flag. If set, the parser reports all (including
  spurious) errors rather then at most one error per line.
- Add -e flag to gofmt and gotype: If set, gofmt and gotype report all
  (including spurious) errors rather than at most one error per line.
- Updated the respective documentation.

Fixes #2088.

R=rsc
CC=golang-dev
https://golang.org/cl/4803047
2011-07-22 09:55:37 -07:00
Rob Pike
3d552700ce goyacc: cleanups
- remove calls to print
- make units compile again
- make units.y closer to gofmt style

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4802052
2011-07-22 17:58:38 +10:00
Rob Pike
f0d8af200c exp/template: trivial cleanup in test
Clean up glitch created by flurry of editing.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4808052
2011-07-22 17:52:46 +10:00
Rob Pike
54045e6bcd pkg/http: fix a couple of error messages
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4805048
2011-07-22 17:11:44 +10:00
Andrew Gerrand
38e5128243 archive/zip: handle zip files with more than 65535 files
R=r
CC=golang-dev
https://golang.org/cl/4812048
2011-07-22 14:57:17 +10:00
Russ Cox
226fb099d9 runtime: add UpdateMemStats, use in tests
Drops mallocrep1.go back to a reasonable
amount of time.  (154 -> 0.8 seconds on my Mac)

Fixes #2085.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/4811045
2011-07-22 00:55:01 -04:00
Rob Pike
222450addb exp/template: add globbing helpers to load groups of files into sets.
Also make the Set.Parse methods variadic so you can parse static lists of files without loops.

R=rsc, dsymonds, r
CC=golang-dev
https://golang.org/cl/4802051
2011-07-22 13:55:45 +10:00
David Symonds
99e5d48e59 http: clarify use of w.conn.body in Write when sniffing.
R=gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/4794047
2011-07-22 13:52:21 +10:00
Rob Pike
3e79c958c4 exp/template: plain actions with declarations should produce no output.
This is already the behavior for pipelines producing values for if, with, and range.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4808050
2011-07-22 10:51:40 +10:00
Roger Peppe
47647b9865 exp/template: fix action variable declarations inside range
R=r
CC=golang-dev
https://golang.org/cl/4807043
2011-07-22 09:53:25 +10:00
Robert Griesemer
e109a2bb8c big: minor comment adjustments
R=mtj, r
CC=golang-dev
https://golang.org/cl/4814044
2011-07-21 15:01:58 -07:00
Michael T. Jones
12c736158a big: refine printf formatting and optimize string conversion
Now handles standard precision specifications, standard interactions of
redundant specifications (such as precision and zero-fill), handles the
special case of precision specified but equal to zero, and generates the
output without recursive calls to format/printf to be clearer and faster.

R=gri, mtj, gri
CC=golang-dev
https://golang.org/cl/4703050
2011-07-21 14:29:08 -07:00
Russ Cox
301d8a6d4a http: fix chunking bug during content sniffing
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/4807044
2011-07-21 14:29:14 -04:00
Russ Cox
22853098a9 gc: select functions are no longer special
R=ken2
CC=golang-dev
https://golang.org/cl/4794049
2011-07-21 14:10:39 -04:00
Dmitriy Vyukov
6b2ec06587 runtime: faster select
Make selectsend() accept pointer to the element,
it makes it possible to make Scase fixed-size
and allocate/free Select, all Scase's and all SudoG at once.
As a consequence SudoG freelist die out.

benchmark                       old,ns/op  new,ns/op
BenchmarkSelectUncontended	     1080        558
BenchmarkSelectUncontended-2	      675        264
BenchmarkSelectUncontended-4	      459        205
BenchmarkSelectContended	     1086        560
BenchmarkSelectContended-2	     1775       1672
BenchmarkSelectContended-4	     2668       2149
(on Intel Q6600, 4 cores, 2.4GHz)

benchmark                       old ns/op    new ns/op    delta
BenchmarkSelectUncontended         517.00       326.00  -36.94%
BenchmarkSelectUncontended-2       281.00       166.00  -40.93%
BenchmarkSelectUncontended-4       250.00        83.10  -66.76%
BenchmarkSelectUncontended-8       107.00        47.40  -55.70%
BenchmarkSelectUncontended-16       67.80        41.30  -39.09%
BenchmarkSelectContended           513.00       325.00  -36.65%
BenchmarkSelectContended-2         699.00       628.00  -10.16%
BenchmarkSelectContended-4        1085.00      1092.00   +0.65%
BenchmarkSelectContended-8        3253.00      2477.00  -23.85%
BenchmarkSelectContended-16       5313.00      5116.00   -3.71%
(on Intel E5620, 8 HT cores, 2.4 GHz)

R=rsc, ken
CC=golang-dev
https://golang.org/cl/4811041
2011-07-21 13:57:13 -04:00
Russ Cox
17d9093bf2 undo CL 4808044 / 1bd754e69ce7
ServeMux depends on having a URL
in order to mux.  It might be that the right
fix is to have CONNECT handlers just not
look at URL.

««« original CL description
http: do not parse req.URL for CONNECT

CONNECT's argument is not a URL.

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

»»»

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/4798046
2011-07-21 13:25:55 -04:00
Yasuhiro Matsumoto
bf5ec12dd5 http: do not parse req.URL for CONNECT
CONNECT's argument is not a URL.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4808044
2011-07-21 11:33:59 -04:00
Dmitriy Vyukov
c3a86dab36 testing: output benchmark name before executing it
It makes it clear what benchmark is currently running.
Especially useful in case of hangup or crash.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4816043
2011-07-21 11:31:07 -04:00
Dmitriy Vyukov
d2ab2b9f42 sync: improve Once fast path
Use atomic.LoadUint32(&done) instead of
atomic.AddInt32(&done, 0) on fast path.

benchmark            old ns/op    new ns/op    delta
BenchmarkOnce            13.40         7.26  -45.82%
BenchmarkOnce-2          22.90         4.04  -82.36%
BenchmarkOnce-4          25.60         2.16  -91.56%
BenchmarkOnce-8          25.80         1.38  -94.65%
BenchmarkOnce-16         24.40         1.33  -94.55%

(on HP Z600, 2 x Intel Xeon E5620, 8 HT cores, 2.4 GHz)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4787041
2011-07-21 11:30:14 -04:00
Dmitriy Vyukov
d6ed1b70ad runtime: replace centralized ncgocall counter with a distributed one
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4809042
2011-07-21 11:29:08 -04:00
David Symonds
6c46afdf41 http: disable sniffer for now.
Something is broken, and investigation is underway.
In the meantime, godoc is broken, so disable sniffing for now
by reverting to the pre-sniffer state.

R=r
CC=golang-dev
https://golang.org/cl/4809046
2011-07-21 22:20:09 +10:00
Gustavo Niemeyer
14eba969d8 ld: fix freebsd build reverting .interp move
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4794046
2011-07-21 03:48:56 -03:00
Michael T. Jones
8cdee891d7 fmt: handle precision 0 format stings in standard way
The C-stdlib heritage of printf/fprintf/sprintf has two odd
aspects for precisions of zero with integers. First, the zero
can be specified in any of these ways, "%4.0d", "%.0d" and
"%.d" which was not previously supported here. Secondly, the
seemingly universal interpretation of precision for integers
is that precision==0 and value==0 means print nothing at all.
The code here now handles this for integers just as the code
in big/int.c does the same for the Int type. New tests are
added to fmt_test.go to verify these changes.

R=r, r
CC=golang-dev
https://golang.org/cl/4717045
2011-07-21 16:46:51 +10:00
Rob Pike
0f7a1951b8 exp/template: A template can be in one set only.
This simplifies the API and makes it easier to make the template
invocation statically secure, at the cost of some minor flexibility.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4794045
2011-07-21 14:22:01 +10:00
Nigel Tao
5f134f9b5b html: sync html/testdata/webkit with upstream WebKit.
As $GOROOT/src/pkg/html/testdata/webkit/README says, we're pulling from
$WEBKITROOT/LayoutTests/html5lib/resources.

R=r
CC=golang-dev
https://golang.org/cl/4810043
2011-07-21 12:50:45 +10:00
Nigel Tao
5a141064ed html: parse misnested formatting tags according to the HTML5 spec.
This is the "adoption agency" algorithm.

The test case input is "<a><p>X<a>Y</a>Z</p></a>". The correct parse is:
| <html>
|   <head>
|   <body>
|     <a>
|     <p>
|       <a>
|         "X"
|       <a>
|         "Y"
|       "Z"

R=gri
CC=golang-dev
https://golang.org/cl/4771042
2011-07-21 11:20:54 +10:00
Rob Pike
d11c0f1dbb gob: send empty but non-nil maps.
Fixes #2082.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4798042
2011-07-21 10:27:11 +10:00
Robert Griesemer
4c03bf9c59 godoc: fix zip file directory lookup
Also: remove left-over println calls.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4807042
2011-07-20 16:22:13 -07:00
Andrew Balholm
816c972ff0 html: handle character entities without semicolons
Fix the TODO: unescape("&notit;") should be "¬it;"

Also accept digits in entity names.

R=nigeltao
CC=golang-dev, rsc
https://golang.org/cl/4781042
2011-07-21 09:10:49 +10:00
David Symonds
78c89d21bc http: sniffing algorithm.
This follows draft-ietf-websec-mime-sniff-03 in its intent,
though not its algorithmic specification.

R=rsc
CC=golang-dev
https://golang.org/cl/4746042
2011-07-21 08:38:35 +10:00
Mike Solomon
7911965fe9 io/ioutil: improve performance of ioutil.Discard
Fixes #2084.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4817041
2011-07-20 14:34:49 -07:00
Brad Fitzpatrick
bf768294ed os: point readers at the exec package
R=golang-dev, evan, rsc
CC=golang-dev
https://golang.org/cl/4802046
2011-07-20 11:38:18 -07:00
Dmitriy Vyukov
102b5b34a7 runtime: apply minor tweaks to channels
Remove complicated PRNG algorithm
(argument is limited by uint16 and can't be <= 1).
Do not require chansend/chanrecv selgen to be bumped with CAS.

R=rsc, ken
CC=golang-dev
https://golang.org/cl/4816041
2011-07-20 14:28:55 -04:00
Dmitriy Vyukov
90f3cb13fb runtime: improve performance of sync channels
1. SudoG always contains a pointer to the element
(thus no variable size, and less copying).
2. chansend/chanrecv allocate SudoG on the stack.
3. Copying of elements and gorotuine notifications
are moved out of critical sections.

benchmark                        old ns/op    new ns/op    delta
BenchmarkSelectUncontended          515.00       514.00   -0.19%
BenchmarkSelectUncontended-2        291.00       281.00   -3.44%
BenchmarkSelectUncontended-4        213.00       189.00  -11.27%
BenchmarkSelectUncontended-8         78.30        79.00   +0.89%
BenchmarkSelectContended            518.00       514.00   -0.77%
BenchmarkSelectContended-2          655.00       631.00   -3.66%
BenchmarkSelectContended-4         1026.00      1051.00   +2.44%
BenchmarkSelectContended-8         2026.00      2128.00   +5.03%
BenchmarkSelectNonblock             175.00       173.00   -1.14%
BenchmarkSelectNonblock-2            85.10        87.70   +3.06%
BenchmarkSelectNonblock-4            60.10        43.30  -27.95%
BenchmarkSelectNonblock-8            37.60        25.50  -32.18%
BenchmarkChanUncontended            109.00       114.00   +4.59%
BenchmarkChanUncontended-2           54.60        57.20   +4.76%
BenchmarkChanUncontended-4           27.40        28.70   +4.74%
BenchmarkChanUncontended-8           14.60        15.10   +3.42%
BenchmarkChanContended              108.00       114.00   +5.56%
BenchmarkChanContended-2            621.00       617.00   -0.64%
BenchmarkChanContended-4            759.00       677.00  -10.80%
BenchmarkChanContended-8           1635.00      1517.00   -7.22%
BenchmarkChanSync                   299.00       256.00  -14.38%
BenchmarkChanSync-2                5055.00      4624.00   -8.53%
BenchmarkChanSync-4                4998.00      4680.00   -6.36%
BenchmarkChanSync-8                5019.00      4760.00   -5.16%
BenchmarkChanProdCons0              316.00       274.00  -13.29%
BenchmarkChanProdCons0-2           1280.00       617.00  -51.80%
BenchmarkChanProdCons0-4           2433.00      1332.00  -45.25%
BenchmarkChanProdCons0-8           3651.00      1934.00  -47.03%
BenchmarkChanProdCons10             153.00       152.00   -0.65%
BenchmarkChanProdCons10-2           626.00       581.00   -7.19%
BenchmarkChanProdCons10-4          1440.00      1323.00   -8.12%
BenchmarkChanProdCons10-8          2036.00      2017.00   -0.93%

R=rsc, ken
CC=golang-dev
https://golang.org/cl/4790042
2011-07-20 11:51:25 -04:00
Gustavo Niemeyer
ba2e3af177 ld: remove overlap of ELF sections on dynamic binaries
The dynamic ELF sections were pointing to the proper data,
but that data was already owned by the rodata and text sections.
Some ELF references explicitly prohibit multiple sections from
owning the same data, and strip behaves accordingly.

The data for these sections was moved out and their ranges are
now owned by their respective sections.  This change makes strip
happy both with and without -s being provided at link time.

A test was added in debug/elf to ensure there are no regressions
on this area in the future.

Fixes #1242.
Fixes #2022.

NOTE: Tested on Linux amd64/386/arm only.

R=rsc
CC=golang-dev
https://golang.org/cl/4808043
2011-07-20 12:47:02 -03:00
Russ Cox
971459e826 net/textproto: fix build
R=bradfitz
CC=golang-dev
https://golang.org/cl/4815041
2011-07-20 11:41:41 -04:00
Russ Cox
27a3dcd0d2 net/textproto: avoid 1 copy in ReadLine, ReadContinuedLine
Fixes #2083.

R=msolo, bradfitz
CC=golang-dev
https://golang.org/cl/4812042
2011-07-20 11:11:57 -04:00
Marcel van Lohuizen
df07b6d14a exp/norm: API for normalization library.
R=r, r, mpvl, rsc
CC=golang-dev
https://golang.org/cl/4678041
2011-07-20 19:46:05 +10:00
Rob Pike
62f618a22c sync/atomic: delete workaround
Load seems to work on arm now.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4795042
2011-07-20 08:39:24 +10:00
Robert Griesemer
8930ce2dc1 godoc: implement http.FileSystem for zip files
R=rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/4750047
2011-07-19 08:22:20 -07:00
Lucio De Re
b546f50716 runtime: make goc2c build on Plan 9
pkg/runtime/Makefile:
. Adjusted so "goc2c.c" is built using the Plan 9 libraries.

pkg/runtime/goc2c.c:
. Added/subtracted #include headers to correspond to Plan 9
  toolkit.
. Changed fprintf(stderr,...)/exit() combinations to
  sysfatal() calls, adjusted the "%u" format to "%ud".
. Added exits(0) at the end of main().
. Made main() a void-returning function and removed the
  "return 0" at the end of it.

Tested on UBUNTU and Plan 9 only.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4626093
2011-07-19 11:04:33 -04:00
Russ Cox
025abd530e runtime: faster entersyscall, exitsyscall
Uses atomic memory accesses to avoid the need to acquire
and release schedlock on fast paths.

benchmark                            old ns/op    new ns/op    delta
runtime_test.BenchmarkSyscall               73           31  -56.63%
runtime_test.BenchmarkSyscall-2            538           74  -86.23%
runtime_test.BenchmarkSyscall-3            508          103  -79.72%
runtime_test.BenchmarkSyscall-4            721           97  -86.52%
runtime_test.BenchmarkSyscallWork          920          873   -5.11%
runtime_test.BenchmarkSyscallWork-2        516          481   -6.78%
runtime_test.BenchmarkSyscallWork-3        550          343  -37.64%
runtime_test.BenchmarkSyscallWork-4        632          263  -58.39%

(Intel Core i7 L640 2.13 GHz-based Lenovo X201s)

Reduced a less artificial server benchmark
from 11.5r 12.0u 8.0s to 8.3r 9.1u 1.0s.

R=dvyukov, r, bradfitz, r, iant, iant
CC=golang-dev
https://golang.org/cl/4723042
2011-07-19 11:01:17 -04:00
Wei Guangjing
9f636598ba cgo: windows amd64 port
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4725041
2011-07-19 10:47:33 -04:00
Dmitriy Vyukov
0b200b4d09 sync/atomic: fix LoadInt32 on ARM
R0 is clobbered after cas,
while R1 preserves its value.

R=golang-dev
CC=golang-dev
https://golang.org/cl/4782042
2011-07-19 22:10:07 +10:00
Rob Pike
3bbeef5201 sync/atomic: attempt to get the arm build green.
Disable the LoadInt32 and LoadUint32 tests, since they fail.
These should be fixed but we want to get through the rest of the build
to see if something else unrelated is broken.  The arm build has been
bad for a long time.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4780041
2011-07-19 17:06:13 +10:00
Tarmigan Casebolt
a0d3be1689 goinstall, dashboard: Google Code now supports git
R=golang-dev, adg, rsc, tarmigan+golang
CC=golang-dev
https://golang.org/cl/4760055
2011-07-19 16:58:18 +10:00
Rob Pike
423ab2333a 5l: fix arm linker bug introduced by 4742041
Should fix the arm build.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/4777041
2011-07-19 15:44:25 +10:00
Alex Brainman
42effdf096 go/build: fixes for windows paths
R=golang-dev, mattn.jp, adg
CC=golang-dev
https://golang.org/cl/4746047
2011-07-19 14:02:23 +10:00
Robert Griesemer
98f5fc5e86 archive/zip: support functions to get modified time in ns from MS-DOS time
R=rsc, r, bradfitz, r, adg
CC=golang-dev
https://golang.org/cl/4748056
2011-07-18 20:30:44 -07:00
Alex Brainman
208e6e6dfc exp/wingui: make sure it builds again
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4770041
2011-07-19 13:18:21 +10:00
Rob Pike
a5a94f5d57 gif: fix local color map and coordinates
R=nigeltao
CC=golang-dev
https://golang.org/cl/4759051
2011-07-19 11:47:15 +10:00
Robert Griesemer
95117d30a2 time: typo in documentation
R=r
CC=golang-dev
https://golang.org/cl/4763048
2011-07-18 17:54:32 -07:00
Hector Chu
47e6042f73 runtime: fix select pass 3
Fixes #2075

R=rsc, ken, r
CC=golang-dev
https://golang.org/cl/4748045
2011-07-18 16:15:01 -04:00
Russ Cox
bd77619142 runtime: track running goroutine count
Used to use mcpu+msyscall but that's
problematic for packing into a single
atomic word.  The running goroutine count
(where running == Go code or syscall)
can be maintained separately, always
manipulated under lock.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4767041
2011-07-18 15:50:55 -04:00
Dmitriy Vyukov
27753ff108 runtime: add per-M caches for MemStats
Avoid touching centralized state during
memory manager operations.

R=mirtchovski
CC=golang-dev, rsc
https://golang.org/cl/4766042
2011-07-18 14:56:22 -04:00
Dmitriy Vyukov
66d5c9b1e9 runtime: add per-M caches for MemStats
Avoid touching centralized state during
memory manager opreations.

R=rsc
CC=golang-dev
https://golang.org/cl/4766042
2011-07-18 14:52:57 -04:00
Ian Lance Taylor
257df1719d debug/proc: Remove.
The package was always GNU/Linux specific, and is no longer
used by anything now that exp/ogle has been removed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4757049
2011-07-18 09:55:09 -07:00
Dmitriy Vyukov
ee6e1a3ff7 sync: add fast paths to WaitGroup
benchmark                                        old ns/op    new ns/op    delta
BenchmarkWaitGroupUncontended                        93.50        33.60  -64.06%
BenchmarkWaitGroupUncontended-2                      44.30        16.90  -61.85%
BenchmarkWaitGroupUncontended-4                      21.80         8.47  -61.15%
BenchmarkWaitGroupUncontended-8                      12.10         4.86  -59.83%
BenchmarkWaitGroupUncontended-16                      7.38         3.35  -54.61%
BenchmarkWaitGroupAddDone                            58.40        33.70  -42.29%
BenchmarkWaitGroupAddDone-2                         293.00        85.80  -70.72%
BenchmarkWaitGroupAddDone-4                         243.00        51.10  -78.97%
BenchmarkWaitGroupAddDone-8                         236.00        52.20  -77.88%
BenchmarkWaitGroupAddDone-16                        215.00        43.30  -79.86%
BenchmarkWaitGroupAddDoneWork                       826.00       794.00   -3.87%
BenchmarkWaitGroupAddDoneWork-2                     450.00       424.00   -5.78%
BenchmarkWaitGroupAddDoneWork-4                     277.00       220.00  -20.58%
BenchmarkWaitGroupAddDoneWork-8                     440.00       116.00  -73.64%
BenchmarkWaitGroupAddDoneWork-16                    569.00        66.50  -88.31%
BenchmarkWaitGroupWait                               29.00         8.04  -72.28%
BenchmarkWaitGroupWait-2                             74.10         4.15  -94.40%
BenchmarkWaitGroupWait-4                            117.00         2.30  -98.03%
BenchmarkWaitGroupWait-8                            111.00         1.31  -98.82%
BenchmarkWaitGroupWait-16                           104.00         1.27  -98.78%
BenchmarkWaitGroupWaitWork                          802.00       792.00   -1.25%
BenchmarkWaitGroupWaitWork-2                        411.00       401.00   -2.43%
BenchmarkWaitGroupWaitWork-4                        210.00       199.00   -5.24%
BenchmarkWaitGroupWaitWork-8                        206.00       105.00  -49.03%
BenchmarkWaitGroupWaitWork-16                       334.00        54.40  -83.71%

R=rsc
CC=golang-dev
https://golang.org/cl/4672050
2011-07-18 12:35:55 -04:00
Russ Cox
92c6061b5c 5l: assume Linux binary, not Plan 9
R=bradfitz
CC=golang-dev
https://golang.org/cl/4767042
2011-07-18 12:30:10 -04:00
Brad Fitzpatrick
3745716bc3 http: let FileServer work when path doesn't begin with a slash
... as when it's over-stripped with StripPrefix.

R=golang-dev, andybalholm, rsc
CC=golang-dev
https://golang.org/cl/4759052
2011-07-18 09:04:48 -07:00
Russ Cox
caa5647408 ld: allow seek within write buffer
Reduces number of write+seek's from 88516 to 2080
when linking godoc with 6l.

Thanks to Alex Brainman for pointing out the
many small writes.

R=golang-dev, r, alex.brainman, robert.hencke
CC=golang-dev
https://golang.org/cl/4743043
2011-07-18 12:04:09 -04:00
Albert Strasheim
870fdd760a syscall: Parse and encode SCM_RIGHTS and SCM_CREDENTIALS.
R=rsc, agl, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4667066
2011-07-18 11:21:59 -04:00
Dmitriy Vyukov
c1f035ba4c runtime: fix data race in Plan9 sysalloc
Add mutex to protect brk limit.
Add mstats.sys update.

R=rsc
CC=golang-dev
https://golang.org/cl/4762045
2011-07-18 10:50:04 -04:00
Brad Fitzpatrick
e8689404a7 cgo: add missing semicolon in generated struct
This affected certain signatures needing padding
like:

//export Foo
func Foo() (int, C.long) { ... }

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4745047
2011-07-18 07:23:52 -07:00
Dave Cheney
c945d9c8a1 gc: fix silent sign truncation in pgen.c
Fixes #2076.

R=golang-dev, r, r, dsymonds, lucio.dere
CC=golang-dev
https://golang.org/cl/4744047
2011-07-18 21:09:28 +10:00
Rob Pike
9a5bb287e8 exp/template: dig into empty interfaces so a struct (say) stored in an empty
interface field can be unpacked. We don't have type assertions here so we
must be forthright.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4757047
2011-07-18 17:34:42 +10:00
Alex Brainman
3c4ca95da9 path/filepath: fixes for windows paths
- Clean and IsAbs to handle paths with drive letter properly.
- Clean to replace / with \.

R=golang-dev, adg
CC=golang-dev, mattn.jp
https://golang.org/cl/4758051
2011-07-18 17:08:12 +10:00
Nigel Tao
95323c59ea runtime: fix panic for make(chan [0]byte).
I suspect that this was introduced by
http://code.google.com/p/go/source/detail?r=6e4ee32fffd1

R=r
CC=golang-dev
https://golang.org/cl/4764045
2011-07-18 15:54:11 +10:00
David Symonds
a8e0035bd3 http: drain the pipe output in TestHandlerPanic to avoid logging deadlock.
R=r
CC=golang-dev
https://golang.org/cl/4756047
2011-07-18 12:59:16 +10:00
Rob Pike
08e47ebb7d fmt: fix a couple of documentation glitches.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4758050
2011-07-18 11:44:27 +10:00
Rob Pike
50d90451ff reflect: panic if Method index is out of range for a type.
Makes the code agree with the documentation.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4759050
2011-07-18 11:34:13 +10:00
Rob Pike
9d55c282e3 5c: attempt to fix build by silencing warnings about unused variables.
The story is more complicated; this is just a bandaid.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4755047
2011-07-18 11:08:55 +10:00
Quan Yong Zhai
cb051a3a1d gob: minor cleanup
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4754050
2011-07-18 10:48:31 +10:00
Rob Pike
f189308fb4 fmt: Scan(&int) was mishandling a lone zero.
It took it as an octal base prefix but assumed more digits were coming.
Fixes #2077.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4764044
2011-07-18 10:05:35 +10:00
Lucio De Re
8c5c3c504c cmd/5l/Makefile: directory prefix nit, "../5l/" is not needed.
R=golang-dev, r
CC=golang-dev, rsc
https://golang.org/cl/4755046
2011-07-18 08:46:47 +10:00
Brad Fitzpatrick
8b33c7b5be http: make tests quiet, fixing a test race
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4754044
2011-07-17 15:46:10 -07:00
Brad Fitzpatrick
6075206904 log: more locking
This didn't actually cause a bug, but looks wrong.

There was a lock but there was more shared mutable state not
guarded by it.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4760047
2011-07-17 15:46:00 -07:00
Rob Pike
c705701c69 exp/templates: variable scope persists until "end".
The previous CL doicumented and diagnosed the old situation.
This one changes it to something more traditional: any action
may declare a variable, and the block structure of scopes
applies only to control seequences.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4748047
2011-07-17 13:31:59 +10:00
Rob Pike
331840f509 exp/template: allow declaration of variables only inside control structures.
In simple pipelines the declaration has no scope.
Also document the scope.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4761044
2011-07-17 12:32:00 +10:00
Russ Cox
e07c6e6ee7 http: fixes for sniffing
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4753044
2011-07-15 12:07:37 -04:00
Lucio De Re
4c6280b0f1 6a, 6c, 6l: fix for Plan 9 build
6a/a.h:
. Dropped <u.h> and <libc.h>.
. Made definition of EOF conditional.

6a/a.y:
. Added <u.h> and <libc.h>.

6a/lex.c:
. Added <u.h> and <libc.h>.
. Dropped <ctype.h> (now in <u.h>).

6c/gc.h:
. Added varargck pragma for "lD".

6c/swt.c:
. Dropped unused "thestring" argument in Bprint() calls.

6l/Makefile:
. Dropped unneeded directory prefix.

6l/l.h:
. Dropped unneeded directory prefix.
. Added varargck pragma for "I" and "i".

6l/obj.c:
. Dropped unneeded assignment.
. Dropped unreachable goto statement.

6l/pass.c:
. Dropped assignments flagged as unused.

6l/prof.c:
. Replaced "#if 0" with "#ifdef NOTDEF".

6l/span.c:
. Dropped unused incrementation.
. Added USED() as required.
. Dropped unreachable "return" statement.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4747044
2011-07-15 11:58:39 -04:00
Lucio De Re
5ea4d73b17 5a, 5c, 5l: fix for Plan 9 build
5a/a.h:
. Removed <u.h> and <lib.h>.
. Made definition of EOF conditional.

5a/a.y:
. Added <u.h> and <lib.h>.

5a/lex.c:
. Added <u.h> and <lib.h>.
. Dropped <ctype.h> (now in <u.h>).

5c/peep.c:
. Removed unnecessary "return 0" statement.

5c/reg.c:
. Added compilation condition around unused code.

5c/swt.c:
. Removed unused "thestring" argument from Bprint() calls.

5l/asm.c:
. Added USED() statements as required.
. Adjusted a few format specifications.
. Added compilation condition around unused code.

5l/l.h:
. Dropped directory prefix from <../5l/5.out.h>.
. Added varargck pragma for "I" and "i".

5l/obj.c:
. Cascaded consecutive "if" statements.
. Dropped unnecessary incrementation and assignments.

5l/pass.c:
. Dropped unnecessary assignment.

5l/prof.c:
. #if 0 converted to #ifdef NOTDEF.

5l/span.c:
. Dropped unnecessary incrementation and assignments.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4752041
2011-07-15 11:58:28 -04:00
Lucio De Re
0490eb60bb 8l: nits
8l/Makefile:
. Dropped unnecessary prefix from "../8l/8.out.h"

8l/l.h:
. Dropped unnecessary prefix from "../8l/8.out.h"
. Dropped unused and inconsistent "I" vararg pragma.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4754041
2011-07-15 11:51:59 -04:00
Dmitriy Vyukov
491aa1579d runtime: native xadd for 386/amd64
benchmark                          old ns/op    new ns/op    delta
BenchmarkSemaUncontended               37.40        34.10   -8.82%
BenchmarkSemaUncontended-2             18.90        17.70   -6.35%
BenchmarkSemaUncontended-4             11.90        10.90   -8.40%
BenchmarkSemaUncontended-8              6.26         5.19  -17.09%
BenchmarkSemaUncontended-16             4.39         3.91  -10.93%
BenchmarkSemaSyntNonblock              38.00        35.30   -7.11%
BenchmarkSemaSyntNonblock-2            83.00        46.70  -43.73%
BenchmarkSemaSyntNonblock-4           124.00       101.00  -18.55%
BenchmarkSemaSyntNonblock-8           124.00       116.00   -6.45%
BenchmarkSemaSyntNonblock-16          148.00       114.00  -22.97%

(on HP Z600 2 x Xeon E5620, 8 HT cores, 2.40GHz)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4755041
2011-07-15 11:27:16 -04:00
Luuk van Dijk
8cf8806d31 gc: some enhancements to printing debug info.
R=rsc
CC=golang-dev
https://golang.org/cl/4710046
2011-07-15 16:00:05 +02:00
Russ Cox
e1b2e20217 http: sniffing placeholder
R=dsymonds
CC=golang-dev
https://golang.org/cl/4746041
2011-07-15 01:01:49 -04:00
Andrew Gerrand
5d929a9c92 go/build: less aggressive failure when GOROOT not found
R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4743041
2011-07-15 13:45:22 +10:00
Russ Cox
29125be5c7 runtime: make TestSideEffectOrder work twice
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4714045
2011-07-14 23:43:03 -04:00
Brad Fitzpatrick
fc7b42325a cgi: make test less flaky
Previously, during the anti-zombie test, a
CGI process had to finish within ~625ms.
Now it gets ~5.6 seconds.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4741041
2011-07-14 17:00:14 -07:00
Robert Griesemer
48f598a393 go/printer: simplify internal state
No formatting changes.

R=rsc
CC=golang-dev
https://golang.org/cl/4735042
2011-07-14 16:09:15 -07:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Russ Cox
58e19aa4cb go: require { } around else block
R=gri, ken, r
CC=golang-dev
https://golang.org/cl/4721044
2011-07-14 17:15:52 -04:00
Brad Fitzpatrick
3f53475c97 json: add omitempty struct tag option
Fixes #2032

R=rsc, dsymonds, r, r
CC=golang-dev
https://golang.org/cl/4709044
2011-07-14 11:54:55 -07:00
Robert Griesemer
8d73781f8b godoc: fix build (add Makefile change)
R=bradfitz
CC=golang-dev
https://golang.org/cl/4733041
2011-07-14 11:48:23 -07:00
Robert Griesemer
df68a61c9e godoc: support for file systems stored in .zip files
Instead of serving files of the underlying OS file system,
a .zip file may be provided to godoc containing the files
to serve; for instance:

   godoc -http=:6060 -zip=go.zip

using a .zip file created from a clean tree as follows:

   zip -r go.zip $GOROOT

R=rsc
CC=golang-dev
https://golang.org/cl/4670053
2011-07-14 11:34:53 -07:00
Luuk van Dijk
e8ff9a624f gc: fix closure bug
Fixes #2056.

R=rsc
CC=golang-dev
https://golang.org/cl/4709042
2011-07-14 18:13:39 +02:00
David Symonds
cbad580e9c json: escape < and > in any JSON string.
Angle brackets can trigger some browser sniffers, causing
some forms of JSON output to be interpreted as HTML.
Escaping angle brackets closes that security hole.

R=rsc
CC=golang-dev
https://golang.org/cl/4701047
2011-07-14 13:30:08 +10:00
Rob Pike
fc1f0bd5e9 exp/template: allow range actions to declare a key and element variable.
{{range $key, $element := pipeline}}
This CL is smaller than it looks due to some rearrangement and renaming.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4709047
2011-07-14 13:15:55 +10:00
Russ Cox
aec89c4c40 mime: fix build
R=bradfitz
CC=golang-dev
https://golang.org/cl/4695060
2011-07-13 20:04:12 -07:00
David Symonds
a16ad6fe0f exp/template: escape < and > in JS escaper.
Angle brackets can trigger some browser sniffers,
causing some output to be interpreted as HTML.
Escaping angle brackets closes that security hole.

R=r
CC=golang-dev
https://golang.org/cl/4714044
2011-07-14 12:02:58 +10:00
Rob Pike
dfffc7a5d5 exp/template: include function name in error returned by function or method call.
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/4711049
2011-07-14 11:32:06 +10:00
Rob Pike
19e207d24d exp/template: simplify method and function calls by using the value's Method
rather than the type's, so a method's invocation works the same as a function's.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/4704049
2011-07-14 11:00:23 +10:00
Mikio Hara
689a2ec8c3 json: allow using '$' and '-' as the struct field's tag
R=adg, rsc, bradfitz, mattn.jp, gustavo
CC=golang-dev
https://golang.org/cl/4625081
2011-07-13 17:41:33 -07:00
Rob Pike
125e8277d5 reflect: trivial addition: Value.NumMethod.
Just an oversight it was missing.

R=rsc, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/4695059
2011-07-14 10:38:15 +10:00
Yuval Pavel Zholkover
0bf36ce8fb os: Plan 9: add Process.Signal as a way to send notes.
Move the Signal interface from exec_posix.go to exec.go.
Remove some unsused code from file_plan9.go.

R=fshahriar, rsc
CC=golang-dev
https://golang.org/cl/4683044
2011-07-13 16:29:37 -07:00
Alex Brainman
dde435587d runtime: correct FixedStack value (fixes windows build)
Fixes #2068.

R=rsc
CC=golang-dev
https://golang.org/cl/4705046
2011-07-14 09:13:39 +10:00
Lucio De Re
3f2cc8ba7e cc: fixes for Plan 9 build
<ctype.h> has been moved into <u.h>, specifically to be able to
drop it from these modules.

Will someone check platforms other than UBUNTU/386, please?

R=bsiegert, rsc
CC=golang-dev
https://golang.org/cl/4648078
2011-07-13 16:01:29 -07:00
Brad Fitzpatrick
8ba48fb5ca fix build from e904b6784768 breakage
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4696047
2011-07-13 15:48:57 -07:00
Russ Cox
aebfd63cd9 syscall: add Flock on Linux
Fixes #2069.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4703048
2011-07-13 15:34:36 -07:00
Russ Cox
a16baf0777 syscall: change missing from windows net fixes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4701045
2011-07-13 15:34:21 -07:00
Robert Griesemer
f4acaa8ecd filepath/path: fix a comment
R=bradfitz
CC=golang-dev
https://golang.org/cl/4704047
2011-07-13 15:10:50 -07:00
Rob Pike
469e333106 exp/template: tweak behavior of booleans.
Russ suggested this technique, making the "and" and "or" functions handier.
But it's hacky, and I can be talked out of it.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4698044
2011-07-14 07:59:04 +10:00
Rob Pike
c3344d61bd exp/template: allow niladic methods inside chained field references.
Also really fix the bug about dot vs. receivers.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4705047
2011-07-14 07:52:07 +10:00
Yasuhiro Matsumoto
2012290c7e http: fix Content-Type of file extension.
ServeFile() pass empty string to serveFile(). serveFile() should get
file extension via joining root and filename.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4654089
2011-07-13 14:39:33 -07:00
Wei Guangjing
350504559e net: windows/amd64 port
R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/3790044
2011-07-13 12:44:21 -07:00
Matthew Horsnell
932db13e93 debug/elf: Read ELF Program headers.
NewFile has been fixed to read ELF Program headers into the structs.
Added test coverage.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4628062
2011-07-13 12:34:29 -07:00
Wei Guangjing
a6e60916c1 runtime: stdcall_raw stack 16byte align for Win64
R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4681049
2011-07-13 11:44:44 -07:00
Dmitriy Vyukov
86a659cad0 runtime: fix data race during Itab hash update/lookup
The data race is on newly published Itab nodes, which are
both unsafely published and unsafely acquired. It can
break on IA-32/Intel64 due to compiler optimizations
(most likely not an issue as of now) and on ARM due to
hardware memory access reorderings.

R=rsc
CC=golang-dev
https://golang.org/cl/4673055
2011-07-13 11:22:41 -07:00
Brad Fitzpatrick
dcdaeebdfb docs: fix wrong it's -> its
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4702046
2011-07-13 10:54:51 -07:00
Sam Thorogood
e3a773479d exp/regexp/syntax: add Prog.NumCap
R=rsc, r
CC=golang-dev
https://golang.org/cl/4662083
2011-07-13 10:15:00 -07:00
Robert Griesemer
4c986d86b1 exp/eval, exp/ogle: remove packages eval and ogle
An externally maintained version of exp/eval can
be found at: https://bitbucket.org/binet/go-eval/ .

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4695047
2011-07-13 09:40:53 -07:00
Bobby Powers
050d839df0 gob: register more slice types
Without explicitly registering slice types, gob fails to encode
map[string]interface{} instances where the value is a slice,
failing with a message such as:

  gob: type not registered for interface: []string

Fixes #2065.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/4672056
2011-07-13 17:12:17 +10:00
Nigel Tao
d360e0213d html: update section references in comments to the latest HTML5 spec.
R=r
CC=golang-dev
https://golang.org/cl/4699048
2011-07-13 16:53:02 +10:00
Rob Pike
7aa1a1a64d exp/template: doc and API changes suggested by rsc.
- template invocation is by string constant only.
- NewSet is gone.
- no global Funcs
- writer is now first arg to Execute

R=rsc, r
CC=golang-dev
https://golang.org/cl/4700043
2011-07-13 15:58:31 +10:00
Rob Pike
2e9388e321 exp/template: add Set.AddSet and Set.Union.
Document and test that Set.Parse can be called multiple times.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4703044
2011-07-13 13:50:05 +10:00
Rob Pike
41efecf51c exp/template: allow variables as template names.
Just an oversight it wasn't already there.
Thanks to islandberry@live.com for pointing out the omission.

R=golang-dev, dsymonds
CC=golang-dev, islandberry
https://golang.org/cl/4703043
2011-07-13 13:21:18 +10:00
David Anderson
f1df07bf6a 5l, 6l, 8l: Add a PT_LOAD PHDR entry for the PHDR.
Per the TIS ELF spec, if a PHDR entry is present in the
program header table, it must be part of the memory image of
the program. Failure to do this makes elflint complain, and
causes some tools that manipulate ELF to crash.

R=iant, rsc
CC=dave, golang-dev
https://golang.org/cl/4650067
2011-07-12 17:49:55 -07:00
Robert Griesemer
75780f99f4 csv: fix spelling errors in comments
Fixes #2066.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4699045
2011-07-12 17:45:29 -07:00
Quan Yong Zhai
fe9991e8b2 runtime: replace runtime.mcpy with runtime.memmove
faster string operations, and more

tested on linux/386

runtime_test.BenchmarkSliceToString                    642          532  -17.13%
runtime_test.BenchmarkStringToSlice                    636          528  -16.98%
runtime_test.BenchmarkConcatString                    1109          897  -19.12%

R=r, iant, rsc
CC=golang-dev
https://golang.org/cl/4674042
2011-07-12 17:30:40 -07:00
Wei Guangjing
f340b3de5a debug/pe: fixes ImportedSymbols for Win64.
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/4639086
2011-07-12 11:29:38 -07:00
Robert Hencke
67edf9cb87 gc: make size of struct{} and [0]byte 0 bytes
Fixes #1949.

R=iant, rsc
CC=golang-dev
https://golang.org/cl/4634124
2011-07-12 11:12:06 -07:00
Dmitriy Vyukov
86e7323bdf runtime: eliminate false sharing during stack growth
Remove static variable from runtime·oldstack().
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows (with CL 4657091 applied):
benchmark                                        old ns/op    new ns/op    delta
BenchmarkStackGrowth                               1183.00      1180.00   -0.25%
BenchmarkStackGrowth-2                             1249.00      1211.00   -3.04%
BenchmarkStackGrowth-4                              954.00       805.00  -15.62%
BenchmarkStackGrowth-8                              701.00       683.00   -2.57%
BenchmarkStackGrowth-16                             465.00       415.00  -10.75%

R=rsc
CC=golang-dev
https://golang.org/cl/4693042
2011-07-12 10:56:21 -07:00
Russ Cox
88e0c0517a runtime: fix comment (lost in shuffle)
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/4710041
2011-07-12 09:26:05 -07:00
Dmitriy Vyukov
c9152a8568 runtime: eliminate contention during stack allocation
Standard-sized stack frames use plain malloc/free
instead of centralized lock-protected FixAlloc.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark                                        old ns/op    new ns/op    delta
BenchmarkStackGrowth                               1045.00       949.00   -9.19%
BenchmarkStackGrowth-2                             3450.00       800.00  -76.81%
BenchmarkStackGrowth-4                             5076.00       513.00  -89.89%
BenchmarkStackGrowth-8                             7805.00       471.00  -93.97%
BenchmarkStackGrowth-16                           11751.00       321.00  -97.27%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4657091
2011-07-12 09:24:32 -07:00
Dmitriy Vyukov
daaf29cf93 sync: improve RWMutex performance
The new implementation features wait-free
fast path for readers which significantly improves
performance/scalability on read-mostly workloads.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark                              old ns/op    new ns/op    delta
BenchmarkRWMutexUncontended               179.00        96.60  -46.03%
BenchmarkRWMutexUncontended-2              89.10        49.10  -44.89%
BenchmarkRWMutexUncontended-4              44.70        24.70  -44.74%
BenchmarkRWMutexUncontended-8              23.30        12.90  -44.64%
BenchmarkRWMutexUncontended-16             16.80         8.75  -47.92%
BenchmarkRWMutexWrite100                   79.60        26.80  -66.33%
BenchmarkRWMutexWrite100-2                305.00        33.00  -89.18%
BenchmarkRWMutexWrite100-4                245.00       113.00  -53.88%
BenchmarkRWMutexWrite100-8                330.00       147.00  -55.45%
BenchmarkRWMutexWrite100-16               371.00       152.00  -59.03%
BenchmarkRWMutexWrite10                    78.30        29.80  -61.94%
BenchmarkRWMutexWrite10-2                 348.00       165.00  -52.59%
BenchmarkRWMutexWrite10-4                 447.00       199.00  -55.48%
BenchmarkRWMutexWrite10-8                 564.00       180.00  -68.09%
BenchmarkRWMutexWrite10-16                492.00       192.00  -60.98%
BenchmarkRWMutexWorkWrite100             1077.00      1037.00   -3.71%
BenchmarkRWMutexWorkWrite100-2            659.00       596.00   -9.56%
BenchmarkRWMutexWorkWrite100-4            509.00       361.00  -29.08%
BenchmarkRWMutexWorkWrite100-8            603.00       351.00  -41.79%
BenchmarkRWMutexWorkWrite100-16           750.00       607.00  -19.07%
BenchmarkRWMutexWorkWrite10               990.00       951.00   -3.94%
BenchmarkRWMutexWorkWrite10-2            1119.00      1070.00   -4.38%
BenchmarkRWMutexWorkWrite10-4            1300.00      1199.00   -7.77%
BenchmarkRWMutexWorkWrite10-8            1424.00      1291.00   -9.34%
BenchmarkRWMutexWorkWrite10-16           1981.00      1786.00   -9.84%

R=rsc
CC=golang-dev
https://golang.org/cl/4671051
2011-07-12 09:24:21 -07:00
Adam Langley
9f4c288c16 hash/crc32: add SSE4.2 support
Using the CRC32 instruction speeds up the Castagnoli computation by
about 20x on a modern Intel CPU.

R=rsc
CC=golang-dev
https://golang.org/cl/4650072
2011-07-12 09:29:24 -04:00
Alex Brainman
0f8678a747 go/build: include processing of .c files for cgo packages
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4696041
2011-07-12 17:27:07 +10:00
Nigel Tao
851ded9660 image: remove superfluous if condition.
DrawMask already returns early if r.Empty().

R=r
CC=golang-dev
https://golang.org/cl/4703041
2011-07-12 17:02:55 +10:00
Nigel Tao
caaa6764fa image: re-organize draw.go.
There are no behavioral changes, only some copy-and-pastes.

Before, drawFillOver was next to drawCopyOver.

After, drawFillOver is next to drawFillSrc, which is more similar to
drawFillOver than drawCopyOver is.

Similarly, drawCopyOver is now next to drawCopySrc, etc.

R=r
CC=golang-dev
https://golang.org/cl/4695045
2011-07-12 16:56:29 +10:00
Nigel Tao
8bd5089513 image: change Pix from []FooColor to []uint8.
Some benchmark numbers below. The image/draw fast-paths show dramatic
improvement, the generic slow-paths show a smaller slow-down.

BEFORE
png.BenchmarkEncodePaletted      200       8203800 ns/op      37.45 MB/s
png.BenchmarkEncodeRGBOpaque         100      26940440 ns/op      45.61 MB/s
png.BenchmarkEncodeRGBA       20      73821000 ns/op      16.65 MB/s
jpeg.BenchmarkEncodeRGBOpaque         50      35598640 ns/op      34.52 MB/s
draw.BenchmarkFillOver	     500	   4024226 ns/op
draw.BenchmarkFillSrc	   10000	    152736 ns/op
draw.BenchmarkCopyOver	     500	   3452824 ns/op
draw.BenchmarkCopySrc	   50000	     73218 ns/op
draw.BenchmarkNRGBAOver	     500	   3941234 ns/op
draw.BenchmarkNRGBASrc	    1000	   2484400 ns/op
draw.BenchmarkYCbCr	    1000	   2609005 ns/op
draw.BenchmarkGlyphOver	    2000	   1169575 ns/op
draw.BenchmarkRGBA	     200	   9031390 ns/op
draw.BenchmarkGenericOver	      50	  34636620 ns/op
draw.BenchmarkGenericMaskOver	     100	  16561150 ns/op
draw.BenchmarkGenericSrc	     100	  13873760 ns/op
draw.BenchmarkGenericMaskSrc	     100	  25198860 ns/op

AFTER
png.BenchmarkEncodePaletted      200       8206600 ns/op      37.43 MB/s
png.BenchmarkEncodeRGBOpaque         100      26129530 ns/op      47.03 MB/s
png.BenchmarkEncodeRGBA       20      75776750 ns/op      16.22 MB/s
jpeg.BenchmarkEncodeRGBOpaque         50      37192940 ns/op      33.04 MB/s
draw.BenchmarkFillOver	     500	   3008134 ns/op
draw.BenchmarkFillSrc	   10000	    154214 ns/op
draw.BenchmarkCopyOver	    1000	   2169988 ns/op
draw.BenchmarkCopySrc	   50000	     73095 ns/op
draw.BenchmarkNRGBAOver	    1000	   2491079 ns/op
draw.BenchmarkNRGBASrc	    2000	   1361244 ns/op
draw.BenchmarkYCbCr	    1000	   2554269 ns/op
draw.BenchmarkGlyphOver	    2000	   1042225 ns/op
draw.BenchmarkRGBA	     100	  10233340 ns/op
draw.BenchmarkGenericOver	      50	  38421560 ns/op
draw.BenchmarkGenericMaskOver	     100	  17521190 ns/op
draw.BenchmarkGenericSrc	     100	  16351200 ns/op
draw.BenchmarkGenericMaskSrc	     100	  26538190 ns/op

R=r
CC=golang-dev
https://golang.org/cl/4675076
2011-07-12 16:39:38 +10:00
Nigel Tao
6ec6f1ef62 image/draw: add benchmarks.
R=r
CC=golang-dev
https://golang.org/cl/4695043
2011-07-12 16:17:02 +10:00
Dmitriy Vyukov
013ad89c9b runtime: eliminate false sharing on runtime.goidgen
runtime.goidgen can be quite frequently modified and
shares cache line with the following variables,
it leads to false sharing.
50c6b0 b nfname
50c6b4 b nfunc
50c6b8 b nfunc$17
50c6bc b nhist$17
50c6c0 B runtime.checking
50c6c4 B runtime.gcwaiting
50c6c8 B runtime.goidgen
50c6cc B runtime.gomaxprocs
50c6d0 B runtime.panicking
50c6d4 B strconv.IntSize
50c6d8 B src/pkg/runtime/_xtest_.ss
50c6e0 B src/pkg/runtime/_xtest_.stop
50c6e8 b addrfree
50c6f0 b addrmem
50c6f8 b argv

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4673054
2011-07-12 01:25:14 -04:00
Dmitriy Vyukov
909f31872a runtime: eliminate false sharing on random number generators
Use machine-local random number generator instead of
racy global ones.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4674049
2011-07-12 01:23:58 -04:00
Dmitriy Vyukov
f9f21aa1fb runtime: fix data race on runtime·maxstring
The data race can lead to erroneous output of
"[invalid string]" instead of a string.

R=golang-dev
CC=golang-dev
https://golang.org/cl/4678049
2011-07-12 01:21:06 -04:00
Alex Brainman
8ed9fc600c 6l: change default output name to 6.out.exe on windows
R=golang-dev, vcc.163
CC=golang-dev
https://golang.org/cl/4670049
2011-07-12 14:22:48 +10:00
Brad Fitzpatrick
ce3c3953be http: support for periodic flushing in ReverseProxy
Fixes #2012

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4662091
2011-07-11 20:56:21 -07:00
Rob Pike
7c47741811 exp/template: make numbers adhere to Go's rules for ideal constants.
Without further type informatnion, 1.0 is a float and an integer
must fit in an int.

R=rsc
CC=golang-dev
https://golang.org/cl/4696042
2011-07-12 13:15:26 +10:00
Alex Brainman
05c89edcd3 go/build: make Nuke comment say what it does
R=rsc
CC=golang-dev
https://golang.org/cl/4697041
2011-07-12 13:08:22 +10:00
Brad Fitzpatrick
1722ec22cd cgi: close stdout reader pipe when finished
This causes the child, if still writing, to get an error or
SIGPIPE and most likely exit so our subsequent wait can
finish.

A more guaranteed fix would be putting a time limit on the
child's overall execution, but this fixes the problem
I was having.

Fixes #2059

R=rsc
CC=golang-dev
https://golang.org/cl/4675081
2011-07-11 15:59:27 -07:00
Brad Fitzpatrick
d53385fd0c os: don't permit Process.Signal after a successful Wait
R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4689043
2011-07-11 15:47:42 -07:00
Brad Fitzpatrick
d1f4e0d14e exec: closeAfterWait append bug
Wasn't actually eager closing the fds as a result of the
copy/paste bug. (GC was doing it instead)

R=rsc
CC=golang-dev
https://golang.org/cl/4671057
2011-07-11 14:46:46 -07:00
Evan Martin
2f69a73591 json: encode \r and \n in strings as e.g. "\n", not "\u000A"
This is allowed by the JSON spec and is shorter/easier to read.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4678046
2011-07-11 07:31:08 -07:00
Brad Fitzpatrick
f19b24a182 strconv: handle [-+]Infinity in atof
This is the form as returned by Postgres, as well
as JavaScript.

I've tried and failed to find authorative docs online
about the proper string serialization, if any.

R=golang-dev, gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/4650077
2011-07-11 07:25:45 -07:00
Rob Pike
d366c36945 exp/template: fix bug in argument evaluation.
Must keep dot and the receiver separate - variables broke that symmetry.
Also clean up function invocation and rename "data" to "dot" for clarity.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4678048
2011-07-11 18:06:24 +10:00
Alex Brainman
3c6a7b3fc5 go/build: use os.MkdirAll to create directories
Replaces "mkdir -p ..." command, as Windows mkdir command
does not support -p flag. Also, is simpler and faster then
launching new process.

R=golang-dev, mattn.jp, adg, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4626087
2011-07-11 15:40:41 +10:00
Rob Pike
7b79b3b244 exp/template: fields and methods on variables.
Not strictly necessary (you could achieve the same, clumsily,
via with blocks) but great to have: $x.Field, $y.Method.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4678047
2011-07-11 15:23:38 +10:00
Rob Pike
96bbcc4256 exp/template: documentation glitches and typos.
Also explain that len(v)==0 makes v a 'zero value'
in template execution.

R=golang-dev, dsymonds, adg, r
CC=golang-dev
https://golang.org/cl/4691041
2011-07-11 14:43:21 +10:00
Rob Pike
0027dc91b0 exp/template: simpler parse of char constants.
We can avoid the check against empty constants (''),
which UnquoteChar doesn't handle well, by leaving on
the trailing quote and seeing that's all we have left at the end.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4657090
2011-07-11 12:36:10 +10:00
Rob Pike
bf9531f80b exp/template: character constants.
Easier to implement than to justify leaving them out.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4662089
2011-07-11 11:46:22 +10:00
Rob Pike
e7030e7fef exp/template: static check for defined variables.
Worth catching at parse time rather than execution. Plus it's really easy.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4641100
2011-07-11 10:01:15 +10:00
Rob Pike
1fe9c9a78f exp/eval: delete binary
Mistakenly checked in.
Fixes #2058.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4670057
2011-07-11 09:36:17 +10:00
Rob Pike
e44853c969 flag: make -help nicer.
- suppress the print that -help is not defined.
- return a special error code if -help is set
- do not change behavior if an explict "help" flag is defined.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4641099
2011-07-11 09:35:50 +10:00
Rob Pike
abae847134 exp/template: add functions print and println.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4687041
2011-07-11 09:19:18 +10:00
Rob Pike
4acddca41b exp/template: package documentation
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4675072
2011-07-10 20:56:26 +10:00
Nigel Tao
87d9e7e166 image: change Pix[0] to mean top-left corner of an image's Rect instead
of the origin.

image/png and image/jpeg benchmarks show no significant changes.

The image/draw changes suggest to me that making a gofix for this is not
feasible. People are just going to have to make manual fixes.

R=r
CC=golang-dev
https://golang.org/cl/4681044
2011-07-10 14:29:47 +10:00
Andrew Gerrand
4d47600f46 archive/zip: add Writer
R=bradfitz, dchest, r, rsc
CC=golang-dev
https://golang.org/cl/4523077
2011-07-10 11:30:16 +10:00
Evan Martin
e45b3213cd multipart: use textproto to handle multiline header
R=bradfitz
CC=golang-dev
https://golang.org/cl/4686044
2011-07-09 15:18:31 -07:00
Andrew Balholm
b053400e37 http: update triv.go with gofix
Sample code in triv.go wouldn't compile because it didn't use the new
FileSystem interface.
This was discussed on golang-nuts on July 7.
https://groups.google.com/forum/#!topic/golang-nuts/NMhZk3Ft_Vc

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4684044
2011-07-09 15:10:39 -07:00
Rob Pike
3987b91213 exp/template: better template invocation
1) Make the value optional ({{template "foo"}})
2) Allow the template identifier to be a thing of type *Template.
The second makes it easy to drop templates in to a set dynamically
during invocation.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4671056
2011-07-10 07:32:01 +10:00
Rob Pike
e86d727e60 exp/template: vars as arguments to functions and methods.
That should be it, bugs aside.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4671055
2011-07-09 17:11:35 +10:00
Rob Pike
58baf64827 exp/template: variable evaluation.
Still need to do static checking of declarations during parse.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4667070
2011-07-09 12:05:39 +10:00
Rob Pike
bbf5eb5ba2 exp/template: delete upward evaluation.
It was an ill-advised carryover from the previous template package.
Also clean up function evaluation.
Also add a Name method to Template.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4657088
2011-07-09 08:59:56 +10:00
Rob Pike
d3d08e1e3a exp/template: forgot to allow . as a function argument
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4671053
2011-07-08 18:25:46 +10:00
Rob Pike
b8c664297b exp/template: parse variables and declarations
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4631099
2011-07-08 17:54:16 +10:00
Rob Pike
ee14989e43 exp/template: lex variables
Variables start with'$' and are declared with ':='.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4662084
2011-07-08 17:53:55 +10:00
Rob Pike
02039b6345 exp/template: add a tree-walking example to the test.
Also fix a comment formatting glitch.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4672054
2011-07-08 16:49:06 +10:00
Andrew Gerrand
ad58dc9d26 exp/template: the must-have MustParse functions
R=r
CC=golang-dev
https://golang.org/cl/4641096
2011-07-08 16:01:32 +10:00
Rob Pike
a852981d17 exp/template: allow fields and methods to be found in parent structs.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4657085
2011-07-08 15:22:05 +10:00
Andrew Gerrand
5bcbcab311 sort: rename helpers: s/Sort// in sort.Sort[Float64s|Ints|Strings]
Includes 'sorthelpers' gofix and updates to tree.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4631098
2011-07-08 10:52:50 +10:00
David Symonds
e67a2504a1 gob: export fields in structs in the package documentation.
R=r
CC=golang-dev
https://golang.org/cl/4648075
2011-07-08 10:51:56 +10:00
Brad Fitzpatrick
3236097ab0 cgi: don't depend on CGI.pm for tests
CGI.pm used to be part of the Perl core,
but some distros now bundle perl-core
and perl-modules separately.

It's not worth depending on.

R=golang-dev, mattn.jp
CC=golang-dev
https://golang.org/cl/4675063
2011-07-07 17:45:28 -07:00
Nigel Tao
b39afde805 image/draw: add draw tests where the destination image doesn't start
at (0, 0).

Also refactor the test to use the SubImage method rather than monkeying
with an image's Pix and Rect fields.

R=r
CC=golang-dev
https://golang.org/cl/4678045
2011-07-08 09:54:21 +10:00
Adam Langley
d1d466f620 crypto/x509: prevent chain cycles in Verify
It's possible to include a self-signed root certificate as an
intermediate and push Verify into a loop.

I already had a test for this so I thought that it was ok, but it
turns out that the test was void because the Verisign root certificate
doesn't contain the "IsCA" flag and so it wasn't an acceptable
intermediate certificate for that reason.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4657080
2011-07-07 18:06:50 -04:00
Nigel Tao
03f987c8ea image: tighten Paletted.Opaque to check only those palette entries
in the image, not all palette entries.

R=r
CC=golang-dev
https://golang.org/cl/4672049
2011-07-07 16:32:19 +10:00
Rob Pike
07c9a92564 os: fix documentation for FileInfo.Name.
It's the base name, not the full name.
Fixes #2047.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4680041
2011-07-07 16:05:38 +10:00
Rob Pike
238274ede0 exp/template: handle pointers and values in empty interfaces.
R=golang-dev, r, mattn.jp
CC=golang-dev
https://golang.org/cl/4664064
2011-07-07 14:51:35 +10:00
Rob Pike
8d538c6d3d exp/template: change the name from 'metacharacter' to 'delimiter',
because that's what they are.
No semantic change.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4675060
2011-07-07 10:56:33 +10:00
Gideon Jan-Wessel Redelinghuys
582d6e5848 crypto/openpgp: fixed dangerous use of for loop variable
In function readSignedMessage a pointer to for loop variable 'key' was incorrectly being assigned
to md.SignedBy. Changed so that md.SignedBy is pointing to the 'more correct' memory position.

R=golang-dev, r, agl
CC=golang-dev
https://golang.org/cl/4631088
2011-07-07 10:49:03 +10:00
Alex Brainman
e71fc0c1fe syscall: rearrange windows code so 386 and amd64 can share files
R=golang-dev, r
CC=golang-dev, vcc.163
https://golang.org/cl/4641093
2011-07-07 10:40:45 +10:00
Rob Pike
46ecd6f141 exp/template: index: forgot the always last-to-arrive uintptr.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4636087
2011-07-07 07:00:48 +10:00
Adam Langley
1aa571d38b asn1: support T61 and UTF8 string.
There is no end to the kitchen sink of string types in ASN.1.

Fixes #1953.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4672045
2011-07-06 16:25:44 -04:00
Adam Langley
502589e030 crypto/tls: fix generate_cert.go
Fixes #2030.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4635092
2011-07-06 16:22:21 -04:00
Ian Lance Taylor
7b0bb48056 json: fix test if rand returns 0.
Fixes test when run with gccgo using optimization, which
changes the order of the calls to rand.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4639101
2011-07-06 13:00:54 -07:00
Rob Pike
6732bd3526 exp/template: index function for arrays, slices, and maps.
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/4643072
2011-07-06 22:27:06 +10:00
Rob Pike
64228e36a4 exp/template: silence test noise (but add a flag to put it back)
Also delete a TODO and clean up a little evaluation code.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4643071
2011-07-06 17:46:36 +10:00
David Symonds
33705ddea1 exp/template: add a JavaScript escaper.
R=r
CC=golang-dev
https://golang.org/cl/4671048
2011-07-06 16:51:49 +10:00
Rob Pike
a33cc423b4 exp/template: allow an empty interface value to be the target of range, etc.
We extract the concrete value inside.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4677041
2011-07-06 16:40:46 +10:00
Rob Pike
381a555f40 exp/template: improve error message for non-exported field.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4636086
2011-07-06 15:56:39 +10:00
Rob Pike
a8e5db9449 maketables: update debugging data.
This is unused in the generation of the tables, but was incorrect if we ever needed it.
Also update the reference to the document.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4626097
2011-07-06 15:35:23 +10:00
David Symonds
9d5ed1744a exp/template: add missing dotNode case.
R=r
CC=golang-dev
https://golang.org/cl/4672044
2011-07-06 15:14:10 +10:00
Rob Pike
9495dd31d2 exp/template: fixes and updates.
- fix line numbers - forgot to update state.line during execution
- add a comment convention {{/* comment */}}
- set.Template returns the named template in the set
- set.Execute executes the named template in the set
- use a local methodByName so this package can be used with earlier release of reflect.
- use initial cap to detect exported names

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4668054
2011-07-06 14:46:41 +10:00
David Symonds
d45ba2c146 exp/template: remove debugging dreg.
R=r, gri
TBR=r
CC=golang-dev
https://golang.org/cl/4671047
2011-07-06 14:18:46 +10:00
Yasuhiro Matsumoto
1e6d946594 html: parse start tags that aren't explicitly otherwise dealt with.
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/4626080
2011-07-06 13:08:52 +10:00
Rob Pike
329990d525 exp/template: remove the need for a goroutine.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4626095
2011-07-06 11:02:53 +10:00
Rob Pike
4657d7d7db exp/template: remove the visibility of the token channel from the parser.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4675053
2011-07-06 10:13:53 +10:00
Luuk van Dijk
13d048a221 gc: fix %N for OGOTO nodes.
6g -W crashed on any source with a goto. this fixes that.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4675052
2011-07-06 00:02:03 +02:00
Rob Pike
eea5443572 exp/template: add templates to sets; boolean logic.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4670045
2011-07-05 17:05:15 +10:00
Andrew Gerrand
b7db4fef22 godoc: ignore directories that begin with '.'
Fixes #2017.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4675047
2011-07-05 17:00:18 +10:00
Rob Pike
5b1658232e exp/template: statically check that functions names have been defined.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4675046
2011-07-05 16:02:34 +10:00
Fazlul Shahriar
bedee318d5 os: fix build for Plan 9
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/4657074
2011-07-05 16:01:29 +10:00
Rob Pike
cc9fed7c1a exp/template: add an html escaping function.
R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/4626092
2011-07-05 15:58:54 +10:00
Nigel Tao
104f57ad39 image: add a test for filling sub-images.
R=r
CC=golang-dev
https://golang.org/cl/4626091
2011-07-05 14:42:31 +10:00
Rob Pike
b177c97803 exp/template: functions
Add the ability to attach functions to template and template sets.
Make variadic functions and methods work.
Still to come: static checking of function names during parse.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4643068
2011-07-05 14:23:51 +10:00
Andrew Gerrand
a342006207 goinstall: only report successfully-installed packages to the dashboard
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4657071
2011-07-04 16:05:11 +10:00
Rob Pike
13f889778e exp/template: add template sets, allowing templates to reference one another
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4673042
2011-07-04 15:15:47 +10:00
Rob Pike
72efdea20e exp/template: allow complex numbers, add 'with', 'define', and 'template' keywords.
Also simplify the handling of keywords.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4639096
2011-07-04 11:50:35 +10:00
Rob Pike
db0e358022 reflect: allow Len on String values.
It's probably just an oversight that it doesn't work,
perhaps caused by analogy with Cap.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4634125
2011-07-04 11:45:31 +10:00
Andrew Gerrand
8c7a73bbbb go/build: evaluate symlinks before comparing path to GOPATH
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/4645078
2011-07-04 10:26:03 +10:00
Andrew Gerrand
3cd8f27d79 godoc: search GOPATH for documentation
R=rsc, mattn.jp
CC=golang-dev
https://golang.org/cl/4627065
2011-07-02 14:07:06 +10:00
Andrew Gerrand
72a73198df goinstall: documentation for new remote repository behavior and tweaks
R=rsc, julian
CC=golang-dev
https://golang.org/cl/4642049
2011-07-02 14:05:43 +10:00
Adam Langley
acc284d847 crypto/openpgp: add ability to reserialize keys.
This changes Signature so that parsed signatures can be reserialized
exactly. With this ability we can add Serialize to Entity and also the
ability to sign other public keys.

R=bradfitz
CC=golang-dev
https://golang.org/cl/4627084
2011-07-01 13:53:12 -04:00
Paul Borman
00f7cd4b36 csv: new package
csv reader/writer based on RFC 4180

R=rsc, mattn.jp, r, dchest
CC=golang-dev
https://golang.org/cl/4629085
2011-07-01 12:16:56 -04:00