Commit Graph

11173 Commits

Author SHA1 Message Date
Volker Dobler
4dda23a1d0 http: Allow cookies with negative Max-Age attribute as these are
allowed by RFC 6265 sec 5.2.2.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5533083
2012-01-15 19:32:16 +11:00
Mikio Hara
7419921bf3 net: platform-dependent default socket options
This CL revises existing platform-dependent default socket
options to make it possible to accomodate multiple multicast
datagram listeners on a single service port.

Also removes unnecessary SO_REUSEADDR, SO_REUSEPORT socket
options from unicast datagram sockets by default.

Fixes #1692.

R=devon.odell, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5538052
2012-01-15 14:19:44 +09:00
Rob Pike
2374edc640 go/doc: print only one newline between paragraphs
Fixes #2595.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5544068
2012-01-14 11:57:32 -08:00
Shenghou Ma
4cfa9e3c61 doc: fix comments referring to removed API funcs
The strconv package has removed Atob, AtoF{64,32} and Ftoa.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540057
2012-01-14 10:59:45 -08:00
Rémy Oudompheng
6b72b07016 gc: do not compile switch on interface values into a binary search.
Fixes #2672.

R=golang-dev, lvd
CC=golang-dev, remy
https://golang.org/cl/5543058
2012-01-14 17:00:14 +01:00
Adam Langley
a9e1f6d7a6 exp/terminal: add SetPrompt and handle large pastes.
(This was missing in the last change because I uploaded it from the
wrong machine.)

Large pastes previously misbehaved because the code tried reading from
the terminal before checking whether an line was already buffered.
Large pastes can cause multiples lines to be read at once from the
terminal.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5542049
2012-01-14 10:59:11 -05:00
Adam Langley
423a09760b exp/proxy: new package
exp/proxy provides client support for tunneling connections through
various proxies.

This is an initial, incomplete sketch of the code to lay down an
API.

R=golang-dev, r, r, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5490062
2012-01-14 10:44:35 -05:00
Mikio Hara
d3c59f6ec8 net: make use of the kernel state to listen on TCP, Unix
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/5545044
2012-01-14 13:42:18 +09:00
Olivier Duperray
c40314821b cmd/gofmt: fix simplify.go by running gofmt on cmd/gofmt
R=golang-dev
CC=golang-dev
https://golang.org/cl/5539061
2012-01-13 18:05:47 -08:00
Scott Lawrence
439d863e7c go/doc: remove duplicate package comment
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5528101
2012-01-13 16:49:30 -08:00
Olivier Duperray
066551e49b pkg/go/doc: fix undefined: doc.NewPackageDoc in headscan.go
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5539059
2012-01-13 16:45:30 -08:00
Brad Fitzpatrick
bf734d62d8 exp/sql: add time.Time support
Fixes #2694

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5541057
2012-01-13 15:45:05 -08:00
Scott Lawrence
a08c1960dd go/ast: fix typo
R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5543056
2012-01-13 15:36:54 -08:00
Brad Fitzpatrick
1c441e259f exp/sql: fix statement leak
Also verified in external test suite that this fixes MySQL
resource exhaustion problems, and also exposed a double-free
bug in the gosqlite3 driver (where gosqlite3 either got lucky
before, or was working around this bug)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5544057
2012-01-13 15:25:07 -08:00
Rémy Oudompheng
0575cd9de4 strconv: faster FormatFloat(x, *, -1, 64) using Grisu3 algorithm.
The implementation is similar to the one from the double-conversion
library used in the Chrome V8 engine.

                            old ns/op   new ns/op  speedup
BenchmarkAppendFloatDecimal      591         480      1.2x
BenchmarkAppendFloat            2956         486      6.1x
BenchmarkAppendFloatExp        10622         503     21.1x
BenchmarkAppendFloatNegExp     40343         483     83.5x
BenchmarkAppendFloatBig         2798         664      4.2x

See F. Loitsch, ``Printing Floating-Point Numbers Quickly and
Accurately with Integers'', Proceedings of the ACM, 2010.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5502079
2012-01-13 23:24:33 +01:00
Rob Pike
a5950df89e template: for range on a map, sort the keys if feasible.
Fixes #2696.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5543055
2012-01-13 14:09:13 -08:00
Mikio Hara
92c8df46c6 src: make use of runtime.GOOS, GOARCH instead of syscall.OS, ARCH
R=rsc, r
CC=golang-dev
https://golang.org/cl/5545048
2012-01-14 06:40:55 +09:00
Rob Pike
5f7337769c spec: change the wording regarding select statement choice
s/pseudo-random fair/uniform pseudo-random/
This careful word choice soothes the theoretically inclined.

R=golang-dev, rsc, gri
CC=golang-dev
https://golang.org/cl/5528098
2012-01-13 13:38:36 -08:00
Brad Fitzpatrick
87ceb0cec7 bytes: make Write and WriteString code look the same
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540056
2012-01-13 11:48:57 -08:00
Rob Pike
eaecf357e7 time: delete unused buffer.WriteByte method
R=golang-dev, bradfitz, r, rsc
CC=golang-dev
https://golang.org/cl/5539056
2012-01-13 11:47:55 -08:00
Dmitriy Vyukov
a4f7024e0a cmd/go: fix data race during build
Fixes #2695.

R=golang-dev, mpimenov, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5545052
2012-01-13 22:22:03 +04:00
Robert Griesemer
c7cdce13f5 godoc: make ?m=src mode deterministic
Merge package files in the go/ast MergePackageFiles
function always	    in the same order (sorted by filename)
instead	 of map iteration order to obtain the same
package	 file each time.  This functionality is used
by godoc when displaying packages in ?m=src mode.

Also: minor cleanup in godoc.go.

R=rsc
CC=golang-dev
https://golang.org/cl/5540054
2012-01-13 09:32:35 -08:00
Gustavo Niemeyer
1627b46eaa xml: major Go 1 fixup
This CL improves the xml package in the following ways:

- makes its interface match established conventions
- brings Marshal and Unmarshal closer together
- fixes a large number of bugs and adds tests
- improves speed significantly
- organizes and simplifies the code

Fixes #2426.
Fixes #2406.
Fixes #1989.

What follows is a detailed list of those changes.

- All matching is case sensitive without special processing
  to the field name or xml tag in an attempt to match them.
  Customize the field tag as desired to match the correct XML
  elements.

- Flags are ",flag" rather than "flag". The names "attr",
  "chardata", etc, may be used to name actual XML elements.

- Overriding of attribute names is possible with "name,attr".

- Attribute fields are marshalled properly if they have
  non-string types. Previously they were unmarshalled, but were
  ignored at marshalling time.

- Comment fields tagged with ",comment" are marshalled properly,
  rather than being marshalled as normal fields.

- The handling of the Any field has been replaced by the ",any"
  flag to avoid unexpected results when using the field name for
  other purposes, and has also been fixed to interact properly
  with name paths. Previously the feature would not function
  if any field in the type had a name path in its tag.

- Embedded struct support fixed and cleaned so it works when
  marshalling and also when using field paths deeper than one level.

- Conflict reporting on field names have been expanded to cover
  all fields. Previously it'd catch only conflicts of paths
  deeper than one level. Also interacts correctly with embedded
  structs now.

- A trailing '>' is disallowed in xml tags. It used to be
  supported for removing the ambiguity between "attr" and "attr>",
  but the marshalling support for that was broken, and it's now
  unnecessary. Use "name" instead of "name>".

- Fixed docs to point out that a XMLName doesn't have to be
  an xml.Name (e.g. a struct{} is a good fit too). The code was
  already working like that.

- Fixed asymmetry in the precedence of XML element names between
  marshalling and unmarshalling. Marshal would consider the XMLName
  of the field type before the field tag, while unmarshalling would
  do the opposite. Now both respect the tag of the XMLName field
  first, and a nice error message is provided in case an attempt
  is made to name a field with its tag in a way that would
  conflict with the underlying type's XMLName field.

- Do not marshal broken "<???>" tags when in doubt. Use the type
  name, and error out if that's not possible.

- Do not break down unmarshalling if there's an interface{} field
  in a struct.

- Significant speed boost due to caching of type metadata and
  overall allocation clean ups. The following timings reflect
  processing of the the atom test data:

  Old:

  BenchmarkMarshal           50000             48798 ns/op
  BenchmarkUnmarshal          5000            357174 ns/op

  New:

  BenchmarkMarshal          100000             19799 ns/op
  BenchmarkUnmarshal         10000            128525 ns/op

R=cw, gustavo, kevlar, adg, rogpeppe, fullung, christoph, rsc
CC=golang-dev
https://golang.org/cl/5503078
2012-01-13 11:05:19 +01:00
Robert Griesemer
45ca908f89 godoc: fix missing name change
Fixes godoc text mode (i.e., URL?m=text).

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5545043
2012-01-12 17:54:17 -08:00
Robert Griesemer
eac31c67a8 go/doc: streamlined go/doc API
- the main changes are removing the Doc suffix
  from the exported types, so instead of
  doc.TypeDoc one will have doc.Type, etc.

- All exported types now have a Name (or Names) field.
  For Values, the Names field lists all declared variables
  or constants.

- Methods have additional information about where they are
  coming from.

- There's a mode field instead of a bool to
  control the package's operation, which makes
  it easier to extend w/o API changes.

Except for the partially implemented new Method type,
this is based on existing code. A clean rewrite is in
progress based on this new API.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/5528060
2012-01-12 17:36:57 -08:00
Robert Griesemer
4f63cdc81f go/doc: initial testing support
R=rsc, adg
CC=golang-dev
https://golang.org/cl/5533082
2012-01-12 17:20:51 -08:00
Robert Griesemer
9535b86a27 go/doc: don't ignore anonymous non-exported fields
- remove wrapper.go from testing package (not needed anymore)

Fixes #1000.

R=rsc, golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5502074
2012-01-12 16:05:05 -08:00
Robert Griesemer
74cb963225 go/parser: Remove unused Parse* functions. Simplified ParseExpr signature.
Only ParseFile, ParseDir, and ParseExpr are used in the tree.
If partial parsing of code is required, it is fairly simple
to wrap the relevant piece of code into a dummy package for
parsing (see parser.ParseExpr).

Also: minor cleanups.

R=rsc
CC=golang-dev
https://golang.org/cl/5535055
2012-01-12 16:04:48 -08:00
Robert Griesemer
06479f766c go/ast: remove unnecessary result value from ast.Fprint/Print
These functions are mostly of interest for debugging; the
number of bytes written is uninteresting.

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5540046
2012-01-12 16:04:32 -08:00
Russ Cox
c2ffd9d0c2 cmd/go: use relative paths in go fix, go fmt, go vet output
Fixes #2686.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5528089
2012-01-12 15:28:52 -08:00
Russ Cox
4505ae3863 cmd/go: handle path to cmd directory
Now it works to run 'go install' (no args) in cmd/go.

Fixes #2679.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5543046
2012-01-12 15:27:57 -08:00
Russ Cox
e91b31bc79 fix build
TBR=gri
CC=golang-dev
https://golang.org/cl/5528090
2012-01-12 15:27:49 -08:00
Russ Cox
811006c89d cmd/go: handle cgo pkg-config pragmas
Fixes #2681.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540047
2012-01-12 15:04:39 -08:00
Russ Cox
ba0e02b207 cgo: write _cgo_export.h to object directory, not source dir
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540048
2012-01-12 15:04:31 -08:00
Brad Fitzpatrick
630c838886 build: don't use a fixed filename in temp
Fixes #2688

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5539050
2012-01-12 14:45:32 -08:00
Brad Fitzpatrick
b37de7387a json: better error messages when the ,string option is misused
Fixes #2331

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5544045
2012-01-12 14:40:29 -08:00
Russ Cox
c624fa691d go/build: pass CgoLDFLAGS at end of link command
By the time a Unix linker gets to the end of the
command line it has forgotten what you told it
at the beginning of the command line, so you
have to put library arguments (like -lm) at the end.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5541043
2012-01-12 13:44:02 -08:00
Brad Fitzpatrick
7a7d345391 net/http: don't ignore Request.Write's Flush error
Pointed out by nekotaroh in issue 2645

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5539045
2012-01-12 13:15:40 -08:00
Rémy Oudompheng
37cd165838 strconv: implement fast path for rounding already short numbers.
benchmark                   old ns/op   new ns/op   delta
BenchmarkFormatFloatDecimal      3765        1386    -63%

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5494060
2012-01-12 11:34:06 -08:00
Russ Cox
f0f6aa59cc go/doc: move CommentText to ast.CommentGroup's Text method
Now only godoc imports go/doc.

R=gri
CC=golang-dev
https://golang.org/cl/5541045
2012-01-12 11:34:02 -08:00
Russ Cox
6f77cd2914 strconv: fix round up corner case
Comment described the correct condition
but the code did not implement it.

Fixes #2625.

R=remyoudompheng
CC=golang-dev
https://golang.org/cl/5530082
2012-01-12 11:32:28 -08:00
Brad Fitzpatrick
701f70abf6 sql: fix potential corruption in QueryRow.Scan into a *[]byte
Fixes #2622

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5533077
2012-01-12 11:23:33 -08:00
Russ Cox
c356fc74a1 dashboard: add deployment comment to app.yaml
Also update default app and version to be correct.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5541044
2012-01-12 11:06:09 -08:00
Russ Cox
fb036824df go/build: allow colon in #cgo flags
This makes it possible to say -I c:/foo on Windows.

Fixes #2683 comment #3.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540043
2012-01-12 11:05:54 -08:00
Rob Pike
eb94327068 dashboard: use build.golang.org as the domain
The domain returned by appengine.DefaultVersionHostname
isn't the one we want.
This change has been uploaded to build.golang.org

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5539043
2012-01-12 10:42:39 -08:00
Russ Cox
267f56e10b ld: parse but do not implement -X flag
This will let programs invoking ld prepare for it.
See issue 2676.

R=iant
CC=golang-dev
https://golang.org/cl/5535044
2012-01-12 10:23:24 -08:00
Russ Cox
4953b87296 testing: fix defer race
In a test that does

        func TestFoo(t *testing.T) {
                defer cleanup()
                t.Fatal("oops")
        }

it can be important that cleanup run as the test fails.
The old code did this in Fatal:

        t.signal <- t
        runtime.Goexit()

The runtime.Goexit would run the deferred cleanup
but the send on t.signal would cause the main test loop
to move on and possibly even exit the program before
the runtime.Goexit got a chance to run.

This CL changes tRunner (the top stack frame of a test
goroutine) to send on t.signal as part of a function
deferred by the top stack frame.  This delays the send
on t.signal until after runtime.Goexit has run functions
deferred by the test itself.

For the above TestFoo, this CL guarantees that cleanup
will run before the test binary exits.

This is particularly important when cleanup is doing
externally visible work, like removing temporary files
or unmounting file systems.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532078
2012-01-12 10:18:12 -08:00
Russ Cox
725f084b11 cmd/go: fix linker arguments
Especially affects tests, but not test-specific.
The linker was only being told where to find the
direct dependencies of package main.  Sometimes that
was sufficient to find the rest; sometimes not.

Fixes #2657.
Fixes #2666.
Fixes #2680.

R=golang-dev, adg, rogpeppe
CC=golang-dev
https://golang.org/cl/5528079
2012-01-12 10:18:03 -08:00
Dmitriy Vyukov
a03c519a8c effective_go: provide reference to runtime.NumCPU()
R=golang-dev, robert.hencke, r
CC=golang-dev
https://golang.org/cl/5538050
2012-01-12 22:06:50 +04:00
Shenghou Ma
cd54e44b50 doc: trivial comment typo fix
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5529080
2012-01-12 07:55:23 -08:00