1
0
mirror of https://github.com/golang/go synced 2024-09-25 15:10:11 -06:00
Commit Graph

9458 Commits

Author SHA1 Message Date
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
Rob Pike
6731d47f99 effective go: fix erroneous quoting of ampersands that cropped up
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4937047
2011-08-23 13:54:29 +10: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
Lucio De Re
45407bd559 ld: handle Plan 9 ar format
The Go version has 64 character long section names; originally,
in Plan 9, the limit was 16.  To provide compatibility, this
change allows the input length to be either the target length
or the earlier option.	The section name is extended with spaces
where required.

This has been tested to work without regressions in the
Go environment, testing the older alternative has not been
possible yet.

R=rsc
CC=golang-dev
https://golang.org/cl/4650071
2011-08-22 23:24:38 -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
be00d38a35 build: add openbsd
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4832047
2011-08-22 23:24:25 -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
Russ Cox
3554325937 ld: remove duplicate bss definitions
The EXTERN lines in elf.h already define these.
That's not a problem for most C compilers, but
apparently it is for some copies of the OS X linker.

Fixes #2167.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4936044
2011-08-22 23:23:57 -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
Robert Griesemer
d883f29309 godoc: add dummy playground.js to silence godoc warning at start-up
Fixes #2173.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4941044
2011-08-22 14:06:07 -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
18b21c720e effective go: extract and test a couple more examples.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4937045
2011-08-22 22:46:59 +10: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
Tarmigan Casebolt
8f37c8845c gofix: osopen: fixed=true when changing O_CREAT
R=rsc, r
CC=golang-dev
https://golang.org/cl/4921047
2011-08-22 15:40:15 +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
1696b5fe2a cmd/gc/lex: remove reference to container/vector in comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4921045
2011-08-22 14:07:27 +10:00
Rob Pike
8bf2ad757b cmd/hgpatch: remove container/vector
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4921044
2011-08-22 14:02:36 +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
97eb06233f test/chan/sieve2.go: remove container/vector.
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4918043
2011-08-22 13:29:17 +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
ebf2b92e9a effective_go: fix brace quotes.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4932044
2011-08-22 08:18:03 +10:00
Tarmigan Casebolt
e5ddcaeb7b gotry: add missing $
R=rsc, gri
CC=golang-dev
https://golang.org/cl/4935046
2011-08-21 13:17:02 -07:00
Tarmigan Casebolt
f7b9ac765b goinstall: error out with paths that end with '/'
R=adg, rsc, tarmigan+golang
CC=golang-dev
https://golang.org/cl/4807048
2011-08-21 20:28:29 +10:00
Rob Pike
d1a3edaee7 effective_go: convert to use tmpltohtml.
Also update the big example to the new template system.
There are a number of other examples that should be
extracted; this CL serves as an introduction to the
approach.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4923043
2011-08-21 09:46:19 +10:00
Rob Pike
1446ffc265 doc/tmpltohtml: update to new template package.
Trivial change: just fix the import.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4937043
2011-08-21 09:04:21 +10:00
Robert Griesemer
337254333f godoc: minor fixes
- templates should be read before any handlers are started
- for app engine use, must use underlying file system to read templates

R=r
CC=golang-dev
https://golang.org/cl/4928042
2011-08-20 12:39:38 -07:00
Robert Griesemer
72ddc87681 godoc: remove uses of container/vector
In the process, rewrite index.go to use slices instead
of vectors, rewrite for-loops into range loops, and
generally simplify code (this code was written before
the launch of go and showed its age).

Also, fix a wrong import in appinit.go.

No significant performance changes (improvements);
most of time is spent elsewhere (measured on an stand-
alone MacBook Pro with SSD disk, running standard
godoc settings: godoc -v -http=:7777 -index).

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4875056
2011-08-20 12:30:26 -07:00
Robert Griesemer
fd897ffc68 type switches: test for pathological case
R=rsc, r
CC=golang-dev
https://golang.org/cl/4894057
2011-08-19 09:31:50 -07: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
Andrew Gerrand
a576535e5e tag weekly.2011-10-17
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4867060
2011-08-18 14:34:00 +10:00
Andrew Gerrand
1491a20540 weekly.2011-08-17
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4914042
2011-08-18 14:27:08 +10:00
Rob Pike
10622421b5 gofix: walk names in ValueSpecs
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4887048
2011-08-18 13:48:44 +10:00
Rob Pike
3f5edd2461 test/chan/select5.go: change "with" to "if" in templatea
I converted this program yesterday and the output is the
same as it used to be, ignoring space, but the result is
not the best expression of the algorithm.  The old {.section
Maybe} pieces are now {{with .Maybe}}, as a direct translation,
but I they should be {{if .Maybe}} as the output is just a
bool and there is no cascading.

I have verified that the output of the program is unaffected.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4889053
2011-08-18 13:27:18 +10:00