aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding
AgeCommit message (Collapse)Author
2013-11-18[release-branch.go1.2] encoding/gob: do not use MarshalText, UnmarshalTextAndrew Gerrand
««« CL 22770044 / 23fc3139589c encoding/gob: do not use MarshalText, UnmarshalText This seems to be the best of a long list of bad ways to fix this issue. Fixes #6760. R=r CC=golang-dev https://golang.org/cl/22770044 »»» R=golang-dev CC=golang-dev https://golang.org/cl/28110043
2013-11-18[release-branch.go1.2] encoding/gob: expose encode/decode exampleAndrew Gerrand
««« CL 26220045 / d76ade89413f encoding/gob: expose encode/decode example R=golang-dev, r CC=golang-dev https://golang.org/cl/26220045 »»» R=golang-dev CC=golang-dev https://golang.org/cl/25380044
2013-11-01[release-branch.go1.2] encoding/xml: fix doc commentAndrew Gerrand
««« CL 19300046 / 5ac568b9d67b encoding/xml: fix doc comment The tag is ",chardata" not "chardata". Fixes #6631. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/19300046 »»» R=golang-dev CC=golang-dev https://golang.org/cl/20060045
2013-10-17encoding/xml: accept chains of interfaces and pointersRuss Cox
Fixes #6556. R=golang-dev, iant, adg CC=golang-dev https://golang.org/cl/14747043
2013-10-08encoding/gob: add examplesRob Pike
Also tweak the package document, putting in section headings and adding a sentence about intended use. Fixes #4925. R=golang-dev, iant, adg, ugorji CC=golang-dev https://golang.org/cl/14519044
2013-10-03encoding/json: add an example for RawMessageJosh Bleecher Snyder
RawMessage is useful and mildly non-obvious. Given the frequency with which RawMessage questions show up on golang-nuts, and get answered with an example, I suspect adding an example to the docs might help. R=golang-dev, adg CC=golang-dev https://golang.org/cl/14190044
2013-09-30undo CL 14154043 / 3e485428767eCarl Shapiro
««« original CL description encoding/gob: do not hide pointer argument for the garbage collector R=golang-dev, r CC=golang-dev https://golang.org/cl/14154043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/14165043
2013-09-30encoding/gob: do not hide pointer argument for the garbage collectorCarl Shapiro
R=golang-dev, r CC=golang-dev https://golang.org/cl/14154043
2013-09-27encoding/json: Tweak documentation for Encoder.Encode.Kamil Kisiel
The documentation for the Encoder type calls it a stream, not a connection. R=golang-dev, adg CC=golang-dev https://golang.org/cl/14015044
2013-09-27all: fix some mistakes found by go tool vet .Rob Pike
R=golang-dev, iant, adg CC=golang-dev https://golang.org/cl/14000043
2013-09-23encoding/json: don't cache value addressability when building first encoderBrad Fitzpatrick
newTypeEncoder (called once per type and then cached) was looking at the first value seen of that type's addressability and caching the encoder decision. If the first value seen was addressable and a future one wasn't, it would panic. Instead, introduce a new wrapper encoder type that checks CanAddr at runtime. Fixes #6458 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13839045
2013-09-17encoding/xml: remove dead codeRobert Griesemer
Avoid future 'declared and not used error'. See also issue 6414. R=r CC=golang-dev https://golang.org/cl/13242058
2013-09-16encoding/gob: ignore chan and func fields of structuresRob Pike
Previously, fields of type chan or func caused an error. Now we just treat them like unexported fields and ignore them. This makes it easier to guarantee long-term compatibilty since a substructure from another package cannot break gob encoding by adding a func or chan field. Fixes #6071 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/13693043
2013-09-15encoding/xml: document behavior for undefined name space prefixesRuss Cox
Fixes #5626. R=golang-dev, dominik.honnef CC=golang-dev https://golang.org/cl/13702043
2013-09-12encoding/xml: add Encoder.FlushRuss Cox
Fixes #6365. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13627046
2013-09-09encoding/json: document actual behavior for Unmarshal into interface{}Russ Cox
Fixes #4900. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13400044
2013-09-09encoding/xml: fix panic in MarshalRuss Cox
Fixes #6341. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13512048
2013-09-06undo CL 13004046 / 5db14b33d6efRob Pike
Flushing after every token negates the point of buffering. A different approach is required. ««« original CL description encoding/xml: flush buffer after encoding token R=rsc, bradfitz, adg CC=golang-dev https://golang.org/cl/13004046 »»» R=golang-dev, adg, rsc CC=golang-dev https://golang.org/cl/13515043
2013-08-29undo CL 13180043 / 318540e7857fAndrew Gerrand
Accidentally submitted. ««« original CL description encoding/json: add "overflow" struct tag option Fixes #6213. R=golang-dev, dsymonds, bradfitz CC=golang-dev https://golang.org/cl/13180043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/13234045
2013-08-29encoding/json: add "overflow" struct tag optionAndrew Gerrand
Fixes #6213. R=golang-dev, dsymonds, bradfitz CC=golang-dev https://golang.org/cl/13180043
2013-08-27encoding/binary: use bytes.Reader in read exampleMathieu Lonjaret
R=golang-dev, dave CC=golang-dev https://golang.org/cl/13274043
2013-08-21all: protect alloc count tests by -testing.shortRob Pike
Update #5000 Should reduce the flakiness a little. Malloc counting is important to general testing but not to the build dashboard, which uses -short. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/12866047
2013-08-19encoding/xml: flush buffer after encoding tokenDominik Honnef
R=rsc, bradfitz, adg CC=golang-dev https://golang.org/cl/13004046
2013-08-14encoding/xml: support generic encoding interfacesRuss Cox
Remove custom support for time.Time. No new tests: the tests for the time.Time special case now test the general case. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12751045
2013-08-14encoding/xml: add, support Marshaler interfaceRuss Cox
See golang.org/s/go12xml for design. Repeat of CL 12603044, which was submitted accidentally and then rolled back. Fixes #2771. Fixes #4169. Fixes #5975. Fixes #6125. R=golang-dev CC=golang-dev https://golang.org/cl/12919043
2013-08-14encoding/xml: add, support Unmarshaler interfaceRuss Cox
See golang.org/s/go12xml for design. R=golang-dev, dominik.honnef, dan.kortschak CC=golang-dev https://golang.org/cl/12556043
2013-08-14encoding/json: support encoding.TextMarshaler, encoding.TextUnmarshalerRuss Cox
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12703043
2013-08-14undo CL 12603044 / 2ca230b93195Russ Cox
fat fingers - did not intend to submit. depends on the Unmarshaler CL anyway. ««« original CL description encoding/xml: add, support Marshaler interface See golang.org/s/go12xml for design. Fixes #2771. Fixes #4169. Fixes #5975. Fixes #6125. R=golang-dev, iant, dan.kortschak CC=golang-dev https://golang.org/cl/12603044 »»» TBR=golang-dev CC=golang-dev https://golang.org/cl/12918043
2013-08-14encoding/gob: support new generic interfaces in package encodingRuss Cox
R=r CC=golang-dev https://golang.org/cl/12681044
2013-08-14encoding: new packageRuss Cox
See golang.org/s/go12encoding for design. R=r CC=golang-dev https://golang.org/cl/12541051
2013-08-14encoding/xml: add, support Marshaler interfaceRuss Cox
See golang.org/s/go12xml for design. Fixes #2771. Fixes #4169. Fixes #5975. Fixes #6125. R=golang-dev, iant, dan.kortschak CC=golang-dev https://golang.org/cl/12603044
2013-08-14encoding/binary: make Write work like ReadRob Pike
Use the fast path calculation to shorten the code. No effect on benchmarks. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12696046
2013-08-10encoding/binary: better description for intReadSizeRob Pike
It used to be called intDestSize; the new name is better too. R=bradfitz CC=golang-dev https://golang.org/cl/12713043
2013-08-10encoding/binary: fast path for reading slicesRob Pike
Again, it still allocates but the code is simple. benchmark old ns/op new ns/op delta BenchmarkReadSlice1000Int32s 35580 11465 -67.78% benchmark old MB/s new MB/s speedup BenchmarkReadSlice1000Int32s 112.42 348.86 3.10x R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12694048
2013-08-09encoding/json: escape & alwaysRuss Cox
There are a few different places in the code that escape possibly-problematic characters like < > and &. This one was the only one missing &, so add it. This means that if you Marshal a string, you get the same answer you do if you Marshal a string and pass it through the compactor. (Ironically, the compaction makes the string longer.) Because html/template invokes json.Marshal to prepare escaped strings for JavaScript, this changes the form of some of the escaped strings, but not their meaning. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12708044
2013-08-09encoding/json: faster encodingBrad Fitzpatrick
The old code was caching per-type struct field info. Instead, cache type-specific encoding funcs, tailored for that particular type to avoid unnecessary reflection at runtime. Once the machine is built once, future encodings of that type just run the func. benchmark old ns/op new ns/op delta BenchmarkCodeEncoder 48424939 36975320 -23.64% benchmark old MB/s new MB/s speedup BenchmarkCodeEncoder 40.07 52.48 1.31x Additionally, the numbers seem stable now at ~52 MB/s, whereas the numbers for the old code were all over the place: 11 MB/s, 40 MB/s, 13 MB/s, 39 MB/s, etc. In the benchmark above I compared against the best I saw the old code do. R=rsc, adg CC=gobot, golang-dev, r https://golang.org/cl/9129044
2013-08-09encoding/binary: fix 32-bit buildRob Pike
Sigh. R=golang-dev CC=golang-dev https://golang.org/cl/12491045
2013-08-09encoding/binary: speed up writing slices of integersRob Pike
Simple approach. Still generates garbage, but not as much. benchmark old ns/op new ns/op delta BenchmarkWriteSlice1000Int32s 40260 18791 -53.33% benchmark old MB/s new MB/s speedup BenchmarkWriteSlice1000Int32s 99.35 212.87 2.14x Fixes #2634. R=golang-dev, crawshaw CC=golang-dev https://golang.org/cl/12680046
2013-08-09encoding/binary: document its goals betterRob Pike
It's a modest package with modest goals and limitations. Make that clear. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/12694043
2013-08-09encoding/csv: always allow trailing commasPieter Droogendijk
Original CL by rsc (11916045): The motivation for disallowing them was RFC 4180 saying "The last field in the record must not be followed by a comma." I believe this is an admonition to CSV generators, not readers. When reading, anything followed by a comma is not the last field. Fixes #5892. R=golang-dev, rsc, r CC=golang-dev https://golang.org/cl/12294043
2013-08-08encoding/xml: allow attributes stored in pointers to be marshaled.Dmitriy Shelenin
Fixes #5334. R=golang-dev, dave, rsc CC=golang-dev https://golang.org/cl/8653047
2013-08-05undo CL 12486043 / ab644299d124Brad Fitzpatrick
Uglier. ««« original CL description all: use strings.IndexByte instead of Index where possible R=golang-dev, khr CC=golang-dev https://golang.org/cl/12486043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/12485044
2013-08-05all: use strings.IndexByte instead of Index where possibleBrad Fitzpatrick
R=golang-dev, khr CC=golang-dev https://golang.org/cl/12486043
2013-08-03various: deleted unused itemsRob Pike
R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/12396043
2013-07-30encoding/xml: Do not pass through invalid utf8 bytesAlex A Skinner
EscapeText now escapes 0xFFFD returned from DecodeRune as 0xFFFD, rather than passing through the original byte. Fixes #5880. R=golang-dev, r, bradfitz, adg CC=golang-dev https://golang.org/cl/11975043
2013-07-23all: be more idiomatic when documenting boolean return values.Rob Pike
Phrases like "returns whether or not the image is opaque" could be describing what the function does (it always returns, regardless of the opacity) or what it returns (a boolean indicating the opacity). Even when the "or not" is missing, the phrasing is bizarre. Go with "reports whether", which is still clunky but at least makes it clear we're talking about the return value. These were edited by hand. A few were cleaned up in other ways. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/11699043
2013-07-22all: change "true iff" to "whether" in public docsBrad Fitzpatrick
For consistency with Go documentation style. R=golang-dev, khr CC=golang-dev https://golang.org/cl/11697043
2013-07-12encoding/json: add more tests for UTF-8 coercionRuss Cox
Suggested by Rob in CL 11211045, but the mail arrived moments after hg submit completed. R=golang-dev, r CC=golang-dev https://golang.org/cl/11138045
2013-07-12undo CL 11161044 / ba455262a9dbRuss Cox
I want to think more carefully about this. We put this in because Marshal encoded named []byte but Unmarshal rejected them. And we noticed that Marshal's behavior was undocumented so we documented it. But I am starting to think the docs and Unmarshal were correct and Marshal's behavior was the problem. Rolling back to give us more time to think. ««« original CL description json: unmarshal types that are byte slices. The json package cheerfully would marshal type S struct { IP net.IP } but would give an error when unmarshalling. This change allows any type whose concrete type is a byte slice to be unmarshalled from a string. Fixes #5086. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/11161044 »»» R=golang-dev, r CC=golang-dev https://golang.org/cl/11042046
2013-07-12encoding/json: coerce invalid UTF-8 to valid UTF-8 during MarshalRuss Cox
In practice, rejecting an entire structure due to a single invalid byte in a string is just too picky, and too hard to track down. Be consistent with the bulk of the standard library by converting invalid UTF-8 into UTF-8 with replacement runes. R=golang-dev, crawshaw CC=golang-dev https://golang.org/cl/11211045