Richard Patel
a713a3eccc
Improved default tag for durations ( #464 )
2021-01-21 16:47:51 -05:00
Thomas Pelletier
652b9f8232
Cleanup ( #462 )
...
* Remove feature request template
Those should now start in discussions
https://github.com/pelletier/go-toml/discussions
* Update lincese year
* ci: do not run coverage on master
It only makes sense to report it for diffs on pull requests.
2021-01-06 20:48:20 -05:00
Thomas Pelletier
ba1b12be14
Fix ToMap for tables in nested mixed-type arrays ( #461 )
...
Co-authored-by: Micah Stetson <micah@schoolsplp.com >
2021-01-06 20:34:25 -05:00
Stanisław Barzowski
2e01f733df
[README] There are 3 cli tools, not 2. ( #454 )
2020-11-24 13:14:26 -05:00
Micah Stetson
1bd9461acb
Fix ToMap for tables in mixed-type arrays ( #453 )
2020-11-14 21:15:35 -05:00
Thomas Pelletier
5b4e7e5dcc
Remove underscore regexps ( #448 )
...
* Remove underscore regexps
Fixes #440 .
```
benchmark old ns/op new ns/op delta
BenchmarkUnmarshalToml-8 269582 257032 -4.66%
benchmark old allocs new allocs delta
BenchmarkUnmarshalToml-8 2650 2650 +0.00%
benchmark old bytes new bytes delta
BenchmarkUnmarshalToml-8 127761 127030 -0.57%
```
2020-10-11 19:27:08 -04:00
Thomas Pelletier
b4905040a8
TOML 1.0.0-rc.3 ( #449 )
...
No spec change since 1.0.0-rc.1.
2020-10-11 16:12:23 -04:00
Thomas Pelletier
5c66c78bc5
Remove date regexp ( #447 )
...
* Remove date regexp
Hand-roll the date matching logic to avoid trying to match a regexp on
every integer.
```
benchmark old ns/op new ns/op delta
BenchmarkUnmarshalToml-8 293449 272134 -7.26%
benchmark old allocs new allocs delta
BenchmarkUnmarshalToml-8 2746 2650 -3.50%
benchmark old bytes new bytes delta
BenchmarkUnmarshalToml-8 133604 127548 -4.53%
```
* Remove fuzzit
The company has been acquired by GitLab and shutting down.
2020-10-11 15:31:33 -04:00
Allen
f9ba08244d
Do not allow T-prefix on local dates ( #446 )
...
Fixes #442
2020-10-09 10:55:11 -04:00
Thomas Pelletier
e6908614ee
toml.Unmarshaler supports leaf nodes ( #444 )
...
Fixes #437
2020-09-13 18:46:13 -04:00
Cameron Moore
a7448fe8de
Fix date lexer to only support 4-digit year ( #443 )
...
Fixes #441
2020-09-12 18:04:04 -04:00
Thomas Pelletier
65ca806488
Fix Unmarshaler call when value is missing ( #439 )
...
Fixes #431
v1.8.1
2020-09-12 14:42:04 -04:00
Cameron Moore
5c94d86029
Use strings.Builder in lexer ( #438 )
...
Replace all string building operations in the lexer with
strings.Builder. Doing so shows significant performance improvements.
BurntSushi still has a slight edge in CPU performance, but there's still
much work to do on memory performance.
name old time/op new time/op delta
ParseToml-2 311µs ± 0% 273µs ± 3% -12.29% (p=0.008 n=5+5)
UnmarshalToml-2 386µs ± 4% 349µs ± 3% -9.63% (p=0.008 n=5+5)
UnmarshalBurntSushiToml-2 368µs ± 8% 341µs ± 2% ~ (p=0.056 n=5+5)
name old alloc/op new alloc/op delta
ParseToml-2 132kB ± 0% 118kB ± 0% -11.07% (p=0.008 n=5+5)
UnmarshalToml-2 147kB ± 0% 133kB ± 0% -9.92% (p=0.008 n=5+5)
UnmarshalBurntSushiToml-2 82.6kB ± 0% 82.6kB ± 0% ~ (p=1.000 n=5+5)
name old allocs/op new allocs/op delta
ParseToml-2 3.19k ± 0% 1.91k ± 0% -40.19% (p=0.008 n=5+5)
UnmarshalToml-2 4.03k ± 0% 2.75k ± 0% -31.83% (p=0.008 n=5+5)
UnmarshalBurntSushiToml-2 1.73k ± 0% 1.73k ± 0% ~ (all equal)
Out of curiosity, I benchmarked the results of updating each function
along the way to see how each change effected the overall performance:
name \ time/op master lexKey lexLitStringAsString lexStringAsString
ParseToml-2 311µs ± 0% 299µs ± 1% 290µs ± 3% 273µs ± 3%
UnmarshalToml-2 386µs ± 4% 381µs ± 2% 364µs ± 2% 349µs ± 3%
UnmarshalBurntSushiToml-2 368µs ± 8% 341µs ± 2% 345µs ± 5% 341µs ± 2%
name \ alloc/op master lexKey lexLitStringAsString lexStringAsString
ParseToml-2 132kB ± 0% 132kB ± 0% 125kB ± 0% 118kB ± 0%
UnmarshalToml-2 147kB ± 0% 146kB ± 0% 140kB ± 0% 133kB ± 0%
UnmarshalBurntSushiToml-2 82.6kB ± 0% 82.6kB ± 0% 82.6kB ± 0% 82.6kB ± 0%
name \ allocs/op master lexKey lexLitStringAsString lexStringAsString
ParseToml-2 3.19k ± 0% 2.86k ± 0% 2.49k ± 0% 1.91k ± 0%
UnmarshalToml-2 4.03k ± 0% 3.70k ± 0% 3.33k ± 0% 2.75k ± 0%
UnmarshalBurntSushiToml-2 1.73k ± 0% 1.73k ± 0% 1.73k ± 0% 1.73k ± 0%
Benchmarks were run from the benchmark/ directory using:
go test -bench=.*Toml -benchmem -count=5 ./...
2020-09-12 12:01:32 -04:00
Thomas Pelletier
b76eb62117
Marshal into empty interface{} ( #433 )
...
Allows to marshal a TOML document into an empty `interface{}`, resulting
in a `map[string]interface{}`.
Fixes #432
2020-09-11 10:04:46 -04:00
Thomas Pelletier
196ce3a1f6
Support go 1.15 ( #434 )
...
Fixes #428
2020-09-10 21:39:16 -04:00
Stephen Levine
9f8f82dfe8
Fix index exception when setting empty Tree slice ( #425 )
2020-09-10 21:19:18 -04:00
Stephen Levine
661484ae7e
Add *Tree.SetPositionPath ( #426 )
...
Signed-off-by: Stephen Levine <stephen.levine@gmail.com >
2020-07-31 23:44:50 -04:00
AllenX2018
34de94e6a8
fix issue #421
2020-07-08 19:02:44 +08:00
Allen
88263a05cc
move benchmark to a seperate diectory ( #420 )
...
Fixes #418
2020-06-15 17:55:19 -04:00
jixiuf
1dbe20e76c
Fix TreeFromMap on list of interfaces ( #416 )
...
Fixes #415
2020-06-13 12:27:57 -04:00
AllenX2018
05bf3807d3
fix issue#414
2020-06-11 12:10:57 +08:00
Thomas Pelletier
06838de5d2
Merge branch 'RiyaJohn-better_lists'
2020-06-01 10:18:10 -04:00
Thomas Pelletier
db62263e3e
Added exta tests for GetArrayPath
2020-06-01 10:16:36 -04:00
RiyaJohn
2d866e3fae
fix: rm int, int32, float32
2020-05-21 22:50:23 +05:30
RiyaJohn
100799f7b7
add testcase for bool
2020-05-18 16:13:17 +05:30
RiyaJohn
ecd155a62f
Merge remote-tracking branch 'upstream/master' into better_lists
2020-05-18 15:54:12 +05:30
RiyaJohn
bcacc71a18
feat: add GetArray() with testcases
2020-05-18 15:26:15 +05:30
Thomas Pelletier
16c9a8bdc0
Mention support to v1.0.0-rc.1
v1.8.0
2020-05-17 17:56:44 -04:00
x-hgg-x
f99d6bbca1
Fix query test
...
- replaced assertArrayContainsInAnyOrder with a version which tests the exact order for more strict testing
2020-05-17 20:42:51 +08:00
Jim Tittsler
8784f9c73a
Fix typos
2020-05-17 20:41:16 +08:00
x-hgg-x
a60e466129
Fix index and slice expressions for query ( #405 )
...
* Fix index and slice expressions for query
Support negative step for slice expressions
2020-05-14 14:21:51 +08:00
dependabot-preview[bot]
44aed552fd
Bump gopkg.in/yaml.v2 from 2.2.8 to 2.3.0 ( #408 )
2020-05-14 06:20:36 +00:00
AllenX2018
1479e10663
fix issue #406
2020-05-08 18:43:08 +08:00
x-hgg-x
9ba7363552
Allow spaces when using dotted keys in assignment ( #402 )
...
Fixes #401
2020-05-07 08:11:29 -04:00
x-hgg-x
96ff402934
Fix marshaling nested arrays of tables ( #395 )
...
Fixes #369
2020-05-07 08:09:23 -04:00
x-hgg-x
249d0eaf46
Restore test for accidental whitespaces ( #403 )
2020-05-06 23:15:34 -04:00
x-hgg-x
19eb8cf036
Fix various quoted keys bugs ( #400 )
...
Fixes #396 #397 #398 #399
2020-05-06 23:13:18 -04:00
Allen
c5fbd3eba6
Add support of mixed-type array ( #376 )
...
Fixes #357
2020-05-06 23:07:57 -04:00
x-hgg-x
9ccd9bbc7a
Fix unmarshaler error when a custom marshaler function is defined ( #383 )
...
Fixes #382
2020-05-04 15:05:45 -04:00
x-hgg-x
e7d1a179ae
Support custom unmarshaler ( #394 )
...
Co-authored-by: Thomas Pelletier <pelletier.thomas@gmail.com >
2020-05-04 13:33:55 -04:00
x-hgg-x
71a8bd4c61
Prevent automatic conversion between int and float when unmarshaling ( #390 )
...
Fixes #389
Co-authored-by: Thomas Pelletier <pelletier.thomas@gmail.com >
2020-05-04 13:30:08 -04:00
x-hgg-x
34782191ba
Add more supported default values types for unmarshaling ( #392 )
...
Fixes #391
2020-05-04 13:26:07 -04:00
x-hgg-x
7fbde32684
Fix overflow checking when unmarshaling ( #388 )
...
Fixes #387
2020-05-04 13:22:43 -04:00
x-hgg-x
82a6a1977d
Add indentation setting for Encoder ( #386 )
...
Fixes #371
2020-05-04 13:21:22 -04:00
x-hgg-x
cc3100c329
Fix unmarshaling arrays ( #385 )
...
Fixes #384
2020-05-04 13:19:19 -04:00
x-hgg-x
f1ba6388fb
Fix inline table loading errors ( #381 )
...
Fixes #379 #380
2020-05-04 13:13:55 -04:00
Allen
d05497900e
Forbid adding keys to exist inline table ( #378 )
2020-05-04 13:06:37 -04:00
Oncilla
e29a498ed5
unmarshal: support encoding.TextUnmarshaler ( #375 )
...
* unmarshal: support encoding.TextUnmarshaler
This PR adds support for decoding fields of primitive types that implement
encoding.TextUnmarshaler by calling the custom method.
Fields in anonymous structs are not supported at this point.
Co-authored-by: Lorenz Bauer <lmb@users.noreply.github.com >
2020-05-04 12:49:37 -04:00
Oncilla
2b8e33f503
marshal: support encoding.TextMarshaler ( #374 )
...
With this PR the encoder now supports encoding.TextMarshaler.
Additionally, a bug is fixed, where the encoder does not notice a pointer
field that implements the toml.Marshaler interface.
fixes #373
2020-04-28 07:29:00 -04:00
Oncilla
d3c92c5999
unmarshal: add strict mode ( #372 )
...
This PR adds a strict mode to the Decoder. It can be enabled with the
`Strict` method.
In the strict mode, the decoder fails if any fields that were part
of the input do not have a corresponding field in the struct.
Fixes #277
2020-04-28 07:24:56 -04:00