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

170 Commits

Author SHA1 Message Date
Robert Hencke
fc79058199 gob: trivial print fix
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5707062
2012-02-29 08:45:57 -08:00
Rémy Oudompheng
c10f50859e all: remove various unused unexported functions and constants.
R=golang-dev, minux.ma, rsc
CC=golang-dev, remy
https://golang.org/cl/5702050
2012-02-28 21:48:03 +01:00
Shenghou Ma
e0aa36147d encoding/gob: fix "// +build" comment for debug.go
R=golang-dev, rsc, adg, r, r
CC=golang-dev
https://golang.org/cl/5693060
2012-02-28 13:39:42 +08:00
David Symonds
9dd746c4cb encoding/json: drop MarshalForHTML; gofix calls to Marshal.
I've elected to omit escaping the output of Marshalers for now.
I haven't thought through the implications of that;
I suspect that double escaping might be the undoing of that idea.

Fixes #3127.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5694098
2012-02-28 11:41:16 +11:00
Brad Fitzpatrick
fa33fdbc7d encoding/binary: better example
leave that joke to Java.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5695080
2012-02-28 10:15:23 +11:00
Gustavo Niemeyer
490c3d4a42 encoding/xml: fix anonymous field Unmarshal example
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5697043
2012-02-24 14:45:32 -05:00
Stefan Nilsson
83b5f067e8 binary: remove unnecessary dummy type.
R=rsc
CC=golang-dev
https://golang.org/cl/5698052
2012-02-23 15:29:17 -05:00
Gustavo Niemeyer
6c20f5c013 encoding/xml: add example and docs for anon fields
Anonymous pointer fields is not yet supported.
The problem is documented in issue 3108.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694043
2012-02-23 01:35:50 -02:00
Gustavo Niemeyer
133c6bf77f encoding/xml: move Unmarshal example to function
This also fixes MarshalIndent's example after the
recent formatting convention changes.

Fixes #2831.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5671062
2012-02-22 23:37:57 -02:00
Russ Cox
990f9f4c00 encoding/json: disable anonymous fields
We should, after Go 1, make them work the same as
package xml, that is, make them appear in the outer
struct.  For now turn them off so that people do not
depend on the old behavior.

Fixing them is issue 3069.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656102
2012-02-19 00:27:05 -05:00
Rob Pike
420f713b7a encoding/gob: cache engine for user type, not base type
When we build the encode engine for a recursive type, we
mustn't disregard the indirections or we can try to reuse an
engine at the wrong indirection level.

Fixes #3026.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5675087
2012-02-18 14:38:37 +11:00
Rob Pike
793f6f3cc3 encoding/gob: fix mutually recursive slices of structs
Fix by setting the element type if we discover it's zero while building.
We could have fixed this better with foresight by doing the id setting in a
different sequence, but doing that now would break binary compatibility.

Fixes #2995.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5675083
2012-02-18 12:43:08 +11:00
Andrew Gerrand
3e804f98d7 pkg: a slew of examples
R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5676071
2012-02-18 11:48:33 +11:00
Rob Pike
e574480ed1 encoding/gob: catch internal error when it happens
It was being skipped due to an oversight.
Also adjust naming parameters for map type construction - makes debugging easier.
Prelude to issue 3026.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5674071
2012-02-17 07:07:53 +11:00
Gustavo Niemeyer
aed20a6951 encoding/xml: add MarshalIndent and move the example
An unindented XML example is hard to follow. MarshalIndent
allows moving the example over to a test file (and fixing it).

R=golang-dev, r, gustavo, r, rsc
CC=golang-dev
https://golang.org/cl/5674050
2012-02-16 02:01:46 -02:00
Andrew Gerrand
11e113db57 godoc: make example code more readable with new comment convention
go/doc: move Examples to go/ast
cmd/go: use go/doc to read examples
src/pkg: update examples to use new convention

This is to make whole file examples more readable. When presented as a
complete function, preceding an Example with its output is confusing.
The new convention is to put the expected output in the final comment
of the example, preceded by the string "output:" (case insensitive).

An idiomatic example looks like this:

// This example demonstrates Foo by doing bar and quux.
func ExampleFoo() {
        // example body that does bar and quux

        // Output:
        // example output
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5673053
2012-02-16 11:50:28 +11:00
Russ Cox
9f333170bf cmd/go: a raft of fixes
* add -work option to save temporary files (Fixes issue 2980)
* fix go test -i to work with cgo packages (Fixes issue 2936)
* do not overwrite/remove empty directories or non-object
  files during build (Fixes issue 2829)
* remove package main vs package non-main heuristic:
  a directory must contain only one package (Fixes issue 2864)
* to make last item workable, ignore +build tags for files
  named on command line: go build x.go builds x.go even
  if it says // +build ignore.
* add // +build ignore tags to helper programs

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5674043
2012-02-14 16:39:20 -05:00
Russ Cox
6a75ece01c runtime: delete Type and implementations (use reflect instead)
unsafe: delete Typeof, Reflect, Unreflect, New, NewArray

Part of issue 2955 and issue 2968.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650069
2012-02-12 23:26:20 -05:00
Rob Pike
59dc21584a encoding/binary: another attempt to describe the type of Read and Write's data
R=golang-dev, rsc, gri, r
CC=golang-dev
https://golang.org/cl/5641062
2012-02-10 09:55:48 +11:00
Rob Pike
eb02b9cf9c encoding/hex: vet the test prints
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5642075
2012-02-10 09:44:56 +11:00
Rob Pike
025c9a946d encoding/binary: slices are allowed; say so
Fixes #2629.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642069
2012-02-09 11:42:10 +11:00
Rob Pike
8c4a2ca83b encoding/binary: add Size, to replace the functionality of the old TotalSize
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5644063
2012-02-09 11:26:03 +11:00
Russ Cox
49110eaa22 encoding/json: document buffering
Fixes #1955.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5643058
2012-02-08 13:48:03 -05:00
Russ Cox
1d8250c8b0 time: clean up MarshalJSON, add RFC3339 method
encoding/xml: handle time.Time as recognized type

The long term plan is to define an interface that time.Time
can implement and that encoding/xml can call, but we are
not going to try to define that interface before Go 1.
Instead, special-case time.Time in package xml, because
it is such a fundamental type, as a stop-gap.
The eventual methods will behave this way.

Fixes #2793.

R=golang-dev, r, r, n13m3y3r
CC=golang-dev
https://golang.org/cl/5634051
2012-02-07 23:37:25 -05:00
Gustavo Niemeyer
0a7ad329e1 encoding/xml: add support for the omitempty flag
This also changes the behavior of attribute marshalling so
that strings and byte slices are marshalled even if empty.
The omitempty flag may be used to obtain the previous behavior.

Fixes #2899.

R=rsc
CC=golang-dev
https://golang.org/cl/5645050
2012-02-08 01:57:44 -02:00
Rob Pike
90d43ad720 encoding/csv: document ReadAll behavior at EOF
Fixes #2847.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5641050
2012-02-08 14:24:04 +11:00
Rob Pike
52ebadd356 encoding/binary: hide TotalSize
The function has a bizarre signature: it was the only public function there
that exposed the reflect package. Also, its definition is peculiar and hard to
explain. It doesn't merit being exported.

This is an API change but really, it should never have been exported and
it's certain very few programs will depend on it: it's too weird.

Fixes #2846.

R=golang-dev, gri, bradfitz
CC=golang-dev
https://golang.org/cl/5639054
2012-02-08 14:09:20 +11:00
Rob Pike
92f55949f9 encoding/hex: canonicalize error type names
Also simplify the tests.

Fixes #2849.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5643045
2012-02-08 11:53:32 +11:00
Rob Pike
9ce23548cb encoding/gob: document CommonType
Also bring the names in doc.go in line with the source.
More radical resolutions are possible but require substantial internal
changes for very little benefit. Fixing it this way lets us keep the
embedding, which has a huge simplifying effect, and guarantees
binary compatibility.

Fixes #2848.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5644045
2012-02-07 16:15:55 +11:00
Rob Pike
749f228cbd encoding/xml: fix documentation for Decoder.Skip
Fixes #2850.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5645043
2012-02-07 16:15:35 +11:00
Russ Cox
ae7497bda6 doc: remove overuse of simply
Specifically, remove simply where it is claiming that the
code or the action to be carried out is simple, since the
reader might disagree.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5637048
2012-02-06 13:34:35 -05:00
Rémy Oudompheng
842c906e2e runtime: delete UpdateMemStats, replace with ReadMemStats(&stats).
Unexports runtime.MemStats and rename MemStatsType to MemStats.
The new accessor requires passing a pointer to a user-allocated
MemStats structure.

Fixes #2572.

R=bradfitz, rsc, bradfitz, gustavo
CC=golang-dev, remy
https://golang.org/cl/5616072
2012-02-06 19:16:26 +01:00
Rob Pike
5be24046c7 all: avoid bytes.NewBuffer(nil)
The practice encourages people to think this is the way to
create a bytes.Buffer when new(bytes.Buffer) or
just var buf bytes.Buffer work fine.
(html/token.go was missing the point altogether.)

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5637043
2012-02-06 14:09:00 +11:00
David Symonds
9440d823a5 gob: fuzz testing, plus a fix for very large type names.
Fixes #2689.

R=r
CC=golang-dev
https://golang.org/cl/5616063
2012-02-06 14:02:12 +11:00
David Symonds
107b0f12bc encoding/base32: ignore new line characters during decode.
This is the analogue to the encoding/base64 change,
https://golang.org/cl/5610045.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5617056
2012-02-03 13:36:38 +11:00
David Symonds
cce3de79f6 encoding/base32: add DecodeString and EncodeToString helper methods.
This makes encoding/base32 be consistent with encoding/base64.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5615053
2012-02-03 11:52:04 +11:00
David Symonds
bf89d58e73 encoding/json: call (*T).MarshalJSON for addressable T values.
Fixes #2170.

R=golang-dev, cw, adg
CC=golang-dev
https://golang.org/cl/5618045
2012-02-03 11:15:06 +11:00
Robert Griesemer
f3f5239d1e all packages: fix various typos
Detected semi-automatically. There are probably more.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5620046
2012-02-01 16:19:36 -08:00
David Symonds
2f2b6e55ef encoding/base64: ignore new line characters during decode.
Fixes #2541.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5610045
2012-02-01 19:13:38 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Brad Fitzpatrick
eb53d472ef doc: use consistent receiver names, when it makes sense.
Makes for prettier docs.

R=golang-dev, dsymonds, r, rsc
CC=golang-dev
https://golang.org/cl/5576056
2012-01-30 11:58:49 -08:00
Brad Fitzpatrick
25c96cba2e json: remove old optimization that inlining covers now
Benchmarks look the same.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5572080
2012-01-30 11:42:09 -08:00
Gustavo Niemeyer
9c497443ae encoding/xml: fix decoding of xml.Name with sub-elements
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5569090
2012-01-30 16:32:48 -02:00
Russ Cox
0368ca138b build: remove code now in subrepositories
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5569064
2012-01-25 15:30:42 -05:00
Gustavo Niemeyer
66599c4070 encoding/xml: remove Marshaler support
Marshaler has a number of open areas that need
further thought (e.g. it doesn't handle attributes,
it's supposed to handle tag names internally but has
no information to do so, etc).

We're removing it now and will bring it back with an
interface that covers these aspects, after Go 1.

Related to issue 2771, but doesn't fix it.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5574057
2012-01-24 21:51:15 -02:00
Gustavo Niemeyer
e3ab30bbc1 encoding/xml: add docs for ignoring tag
That was supposed to be in the original CL, but missed
the files.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570052
2012-01-24 21:04:40 -02:00
Brad Fitzpatrick
2c2c20224a encoding/binary: document that PutVarint, PutUvarint may panic
Fixes #2628

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5571058
2012-01-24 14:19:59 -08:00
Gustavo Niemeyer
0442087f93 encoding/xml: bring API closer to other packages
Includes gofix module. The only case not covered should be
xml.Unmarshal, since it remains with a similar interface, and
would require introspecting the type of its first argument
better.

Fixes #2626.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5574053
2012-01-24 01:10:32 -02:00
Rob Pike
a937bff52c gob: annotate debug.go so it's not normally built
So it's not included in the package by the go tool.

R=iant, fullung, rsc
CC=golang-dev
https://golang.org/cl/5563049
2012-01-23 08:40:34 -08:00
Gustavo Niemeyer
5fde5cd5cb encoding/xml: support ignoring fields with "-"
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5564045
2012-01-23 01:34:35 -02:00