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

3910 Commits

Author SHA1 Message Date
Robert Griesemer
e656a184cb go/ast cleanup: base File/PackageExports on FilterFile/FilterPackage code
R=r, rsc
CC=golang-dev
https://golang.org/cl/4927046
2011-08-23 16:03:42 -07:00
Robert Griesemer
cde06f541f go/ast: adjustments to filter function
CL 4938041 made some incorrect changes to the filter
function which caused a different doc/codelab/wiki/index.html
file to be generated.

Added FilterFileExports and FilterPackageExports function.
Same as the existing FileExpors/PackageExports functions
but using shared code. The old functions will be removed
in the next CL.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4932048
2011-08-23 14:17:18 -07:00
Russ Cox
33e9d24ad9 runtime: fix void warnings
Add -V flag to 6c command line to keep them fixed.

R=ken2
CC=golang-dev
https://golang.org/cl/4930046
2011-08-23 13:13:27 -04:00
Robert Griesemer
f6d536bea4 go/parser: fix type switch scoping
Introduce extra scope for the variable declared by a
TypeSwitchGuard so that it doesn't conflict with vars
declared by the initial SimpleStmt of a type switch.

This is a replacement for CL 4896053 which caused
a build breakage.

Also:
- explicitly detect type switches (as opposed to detecting
  expression switches and then do extra testing for type switches)
- fix all outstanding TODOs in parser.go
- ran all tests

R=rsc
CC=golang-dev
https://golang.org/cl/4914044
2011-08-23 09:22:41 -07:00
Brad Fitzpatrick
f0ef4f4746 http: add MaxBytesReader to limit request body size
This adds http.MaxBytesReader, similar to io.LimitReader,
but specific to http, and for preventing a class of DoS
attacks.

This also makes the 10MB ParseForm limit optional (if
not already set by a MaxBytesReader), documents it,
and also adds "PUT" as a valid verb for parsing forms
in the request body.

Improves issue 2093 (DoS protection)
Fixes #2165 (PUT form parsing)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4921049
2011-08-23 12:17:21 +04:00
Russ Cox
03e9ea5b74 runtime: simplify stack traces
Make the stack traces more readable for new
Go programmers while preserving their utility for old hands.

- Change status number [4] to string.
- Elide frames in runtime package (internal details).
- Swap file:line and arguments.
- Drop 'created by' for main goroutine.
- Show goroutines in order of allocation:
  implies main goroutine first if nothing else.

There is no option to get the extra frames back.
Uncomment 'return 1' at the bottom of symtab.c.

$ 6.out
throw: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
       /Users/rsc/g/go/src/pkg/runtime/x.go:22 +0x8a

goroutine 2 [select (no cases)]:
main.sel()
       /Users/rsc/g/go/src/pkg/runtime/x.go:11 +0x18
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:19 +0x23

goroutine 3 [chan receive]:
main.recv(0xf8400010a0, 0x0)
       /Users/rsc/g/go/src/pkg/runtime/x.go:15 +0x2e
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:20 +0x50

goroutine 4 [chan receive (nil chan)]:
main.recv(0x0, 0x0)
       /Users/rsc/g/go/src/pkg/runtime/x.go:15 +0x2e
created by main.main
       /Users/rsc/g/go/src/pkg/runtime/x.go:21 +0x66
$

$ 6.out index
panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:25 +0xb9
$

$ 6.out nil
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x22ca]

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:28 +0x211
$

$ 6.out panic
panic: panic

goroutine 1 [running]:
main.main()
        /Users/rsc/g/go/src/pkg/runtime/x.go:30 +0x101
$

R=golang-dev, qyzhai, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4907048
2011-08-22 23:26:39 -04:00
Joel Sing
bf2d403de8 syscall: openbsd amd64 syscall support
Add support for syscalls on openbsd amd64. This is based on the
existing freebsd amd64 implementation.

R=mikioh.mikioh, rsc, yourcomputerpal
CC=golang-dev
https://golang.org/cl/4798060
2011-08-22 23:24:32 -04:00
Joel Sing
a9fe3a0ce3 os: disable Hostname test on OpenBSD
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4901054
2011-08-22 23:24:16 -04:00
Nigel Tao
9969803f6c exp/template/html: differentiate URL-valued attributes (such as href)
from others (such as title) during escaping.

R=r, mikesamuel, dsymonds
CC=golang-dev
https://golang.org/cl/4919042
2011-08-23 13:22:26 +10:00
Robert Griesemer
d8594f3d3c go/ast: generalize ast.FilterFile
ast.FilterFile(src, ast.IsExported) has the same
effect as ast.FileExports(src) with this change.

1st step towards removing FileExports - it is
just a special case of FilterFile with this CL.

Added corresponding test.

R=r
CC=golang-dev
https://golang.org/cl/4938041
2011-08-22 18:51:51 -07:00
Sebastien Binet
c7a742c510 go/ast: fix ast.MergePackageFiles to collect infos about imports
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4710047
2011-08-22 12:53:05 -07:00
Ian Lance Taylor
7bbe2c8998 runtime: Remove extraneous word in comment.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4938045
2011-08-22 12:40:45 -07:00
Rob Pike
93134e06ba gob: explain that Debug isn't useful unless it's compiled in.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4930044
2011-08-22 22:43:49 +10:00
Marcel van Lohuizen
d9c9c48797 exp/norm: added implemenation for []byte versions of methods.
R=r
CC=golang-dev
https://golang.org/cl/4925041
2011-08-22 12:52:04 +02:00
Marcel van Lohuizen
45b7084b92 exp/norm: a few minor fixes to support the implementation of norm.
maketables.go/tables.go
- Properly set combinesForward flag for JamoL and JamoV.
- Fixed Printf bug.
composition.go
- Make insertString use the same control flow as insert.
- Better Hangul and non-Hangul mixing.
forminfo.go
- Fixed bug in compBoundaryBefore that affected a few esoteric cases.
- Buffer overflow now tested in normalize_test.go (other CL).

R=r
CC=golang-dev
https://golang.org/cl/4924041
2011-08-22 12:11:29 +02:00
Rob Pike
8b614b4213 template/parse: give if, range, and with a common representation.
No external changes.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4940042
2011-08-22 17:09:00 +10:00
Jeff Hodges
07490c0f05 json: calculate Offset for Indent correctly
Fixes #2171

This is the real change.

R=adg
CC=golang-dev, r, rsc
https://golang.org/cl/4943041
2011-08-22 15:19:27 +10:00
Rob Pike
aca4293715 template/parse: remove Walk.
It was ill-conceived and can be resurrected if needed.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4930043
2011-08-22 14:19:37 +10:00
Rob Pike
ab1c164ecd container/heap/heap_test.go: remove container/vector
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4919044
2011-08-22 13:55:22 +10:00
Rob Pike
ab44a814c2 reflect: remove references to container/vector.
It's not even using vectors - the references are just examples.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4938043
2011-08-22 13:22:42 +10:00
Fazlul Shahriar
95aea24990 build: build more packages/commands for Plan 9
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4921041
2011-08-22 11:03:17 +10:00
Rob Pike
82189f654d template/parse: add a Walk method to Tree.
R=golang-dev, dsymonds, r
CC=golang-dev, mikesamuel
https://golang.org/cl/4918041
2011-08-19 14:19:56 +10:00
Alex Brainman
fd80efee10 net: fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/4873058
2011-08-19 13:00:09 +10:00
Brad Fitzpatrick
a986d98053 mime: ParseMediaType returns os.Error now, not a nil map
ParseMediaType previously documented that it always returned
a non-nil map, but also documented that it returned a nil map
to signal an error.

That is confusing, contradictory and not Go-like.

Now it returns (mediatype string, params map, os.Error).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4867054
2011-08-18 12:51:23 -07:00
Robert Griesemer
8843262599 undo CL 4896053 / c62cf48b7dc4: fix build
The subtle AST changes introduced with CL 4896053
broke type checking of type switches in gofix.
Coming up with a correct fix will take some time.
Undoing this change for now.

««« original CL description
go/parser: fix type switch scoping

The variable declared by a TypeSwitchGuard must be
visible in each TypeCaseClause and must not conflict
with other variables declared by the initial SimpleStmt
of a type switch.

Also:
- explicitly detect type switches (as opposed to detecting
  regular (expression switches) and then do extra testing
  for type switches
- fix all outstanding TODOs in parser.go

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

R=rsc
CC=golang-dev
https://golang.org/cl/4902052
2011-08-18 11:42:19 -07:00
Robert Griesemer
18248ced36 go/parser: fix type switch scoping
The variable declared by a TypeSwitchGuard must be
visible in each TypeCaseClause and must not conflict
with other variables declared by the initial SimpleStmt
of a type switch.

Also:
- explicitly detect type switches (as opposed to detecting
  regular (expression switches) and then do extra testing
  for type switches
- fix all outstanding TODOs in parser.go

R=rsc
CC=golang-dev
https://golang.org/cl/4896053
2011-08-18 10:28:58 -07:00
Wei Guangjing
acfb0a1584 runtime: ctrlhandler for windows amd64
R=rsc
CC=golang-dev
https://golang.org/cl/4825047
2011-08-18 12:37:42 -04:00
Mikio Hara
fca50820cc net: join and leave a IPv6 group address, on a specific interface
This CL changes both JoinGroup and LeaveGroup methods
to take an interface as an argument for enabling IPv6
group address join/leave, join a group address on a
specific interface.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/4815074
2011-08-18 12:22:02 -04:00
Alex Brainman
72e83483a7 runtime: speed up cgo calls
Allocate Defer on stack during cgo calls, as suggested
by dvyukov. Also includes some comment corrections.

benchmark                   old,ns/op   new,ns/op
BenchmarkCgoCall                  669         330
(Intel Xeon CPU 1.80GHz * 4, Linux 386)

R=dvyukov, rsc
CC=golang-dev
https://golang.org/cl/4910041
2011-08-18 12:17:09 -04:00
Rob Pike
4cf630da0f exp/template: remove else and end nodes from public view.
They are used internally and do not appear in the final parse tree.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4905052
2011-08-18 16:07:28 +10:00
Rob Pike
8380ff34ed http: remove a TODO due to new behavior of nil maps
R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/4907049
2011-08-18 11:01:43 +10:00
Mike Samuel
e4a89d7cca exp/template/html: defines a parse context for a subset of HTML.
This defines just enough context to distinguish HTML URI attributes
from parsed character data.

It does not affect any public module API as I thought I would get
early comment on style for defining enumerations and tables.

R=rsc, r, nigeltao, r
CC=golang-dev
https://golang.org/cl/4906043
2011-08-18 10:40:29 +10:00
Russ Cox
3770b0e60c gc: implement nil chan support
The spec has defined nil chans this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4897050
2011-08-17 15:54:17 -04:00
Russ Cox
65bde087ae gc: implement nil map support
The spec has defined nil maps this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4901052
2011-08-17 14:56:27 -04:00
Robert Griesemer
42e6c03fc5 go/parser: disallow for statements w/ illegal range clauses
R=rsc
CC=golang-dev
https://golang.org/cl/4908047
2011-08-17 10:45:30 -07:00
Fazlul Shahriar
0f7bc92bdb net: Plan 9 support
All tests enabled by default passes except those in timeout_test.go.

For TestLookupPort, add an entry for "bootps" in /lib/ndb/common
(Plan 9 calls it "bootp"). I've sent out a patch to fix this.

R=paulzhol, rsc, mikioh.mikioh
CC=ality, golang-dev
https://golang.org/cl/4779041
2011-08-17 13:28:29 -04:00
Robert Griesemer
b77c40a2b3 go/parser: do not accept type literals where not permitted in general
- Resolves a long-standing TODO.
- Replacement for CL 4908042 by befelemepeseveze@gmail.com

Fixes #2155.

R=rsc
CC=golang-dev
https://golang.org/cl/4904048
2011-08-17 10:27:32 -07:00
Kyle Lemons
ca6e1dbc22 xml: escape string chardata in xml.Marshal
Fixes #2150.

R=golang-dev, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4890042
2011-08-17 12:12:08 -04:00
Dave Cheney
9f06ccb48d asn1: add support for unmarshalling structs with int32 members
Also improve error message for unsupported integer types

R=agl, rsc
CC=golang-dev
https://golang.org/cl/4873049
2011-08-17 12:12:01 -04:00
Marcel van Lohuizen
b40bd5efb7 exp/norm: implementation of decomposition and composing functionality.
forminfo.go:
- Wrappers for table data.
- Per Form dispatch table.
composition.go:
- reorderBuffer type.  Implements decomposition, reordering, and composition.
- Note: decompose and decomposeString fields in formInfo could be replaced by
  a pointer to the trie for the respective form.  The proposed design makes
  testing easier, though.
normalization.go:
- Temporarily added panic("not implemented") methods to make the tests run.
  These will be removed again with the next CL, which will introduce the
  implementation.

R=r, rogpeppe, mpvl, rsc
CC=golang-dev
https://golang.org/cl/4875043
2011-08-17 18:12:39 +10:00
Mike Samuel
7dce257ac8 exp/template/html: rework Reverse(*Template) to do naive autoescaping
Replaces the toy func Reverse(*Template) with one that implements
naive autoescaping.

Now Escape(*Template) walks a template parse tree to find all
template actions and adds the |html command to them if it is not
already present.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4867049
2011-08-17 16:00:02 +10:00
Rob Pike
a22e77e6ae template: move exp/template into template.
(Leave exp/template/html where it is for now.)

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4899048
2011-08-17 14:55:57 +10:00
Rob Pike
73b7afbebd template: delete old template code.
It's already in old/template; make that build.
Update a couple of references to point to the old template.
They can be updated later.
Update goplay to use exp/template.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4902046
2011-08-17 14:34:48 +10:00
Rob Pike
ff0240da6d misc: fix a couple of template uses preparatory to the big switch.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4876057
2011-08-17 13:57:06 +10:00
Rob Pike
1d8f822c17 url: new package
This is just moving the URL code from package http into its own package,
which has been planned for a while.
Besides clarity, this also breaks a nascent dependency cycle the new template
package was about to introduce.

Add a gofix module, url, and use it to generate changes outside http and url.

Sadness about the churn, gladness about some of the naming improvements.

R=dsymonds, bradfitz, rsc, gustavo, r
CC=golang-dev
https://golang.org/cl/4893043
2011-08-17 13:36:02 +10:00
Aleksandar Dezelin
d72c96df2a net: Added function SetTimeout() to interface Listener.
Fixes #2148.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4905042
2011-08-16 18:36:51 -04:00
Robert Griesemer
182cf988e9 go/parser: use correct precedence when parsing range clauses
Fixes #2156.

R=rsc
CC=golang-dev
https://golang.org/cl/4899046
2011-08-16 15:19:23 -07:00
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
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
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
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
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
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
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
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
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