manunio
55ca4e35e4
fuzz: improve target perf ( #864 )
...
This attempts to improve issue types like timeout, slow_unit
and speed, as seen in the following oss-fuzz performance report:
https://oss-fuzz.com/performance-report/libFuzzer_go-toml_fuzz_toml/libfuzzer_asan_go-toml/2023-05-11
2023-05-12 16:21:17 +02:00
Gordon
d34104d493
Support text Un/Marshaller for map keys ( #863 )
2023-05-09 17:56:57 +02:00
manunio
2aa08368fa
fuzz: move fuzz_target from oss-fuzz ( #861 )
2023-04-28 21:38:13 -04:00
dependabot[bot]
654811fbc3
build(deps): bump actions/setup-go from 3 to 4 ( #859 )
...
Bumps [actions/setup-go](https://github.com/actions/setup-go ) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases )
- [Commits](https://github.com/actions/setup-go/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/setup-go
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-21 13:35:40 -04:00
dependabot[bot]
5c05d4d863
build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 ( #852 )
...
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify ) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases )
- [Commits](https://github.com/stretchr/testify/compare/v1.8.1...v1.8.2 )
---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-20 13:57:54 -04:00
Thomas Pelletier
643c251c4b
Fix panic when unmarshaling into a map twice ( #854 )
...
Fixes #851
v2.0.7
2023-02-28 17:34:24 +01:00
Thomas Pelletier
8a416daa69
Fix error report of type mismatch on inline tables ( #853 )
...
Parser did not track the location of the faulty inline table in the
document, and unmarshaler tried to the use the non-raw data field of the
AST node, both resulting into a panic when generating the parser error.
Fixes #850
2023-02-28 17:06:49 +01:00
Andreas Deininger
fcd9179b7d
Fixes typos ( #849 )
2023-02-13 03:57:48 -08:00
Marty
9f5726004e
Allow integers to be unmarshaled into floats ( #841 )
...
Co-authored-by: Marty <martin@windscribe.com >
2023-02-09 12:02:25 -05:00
Thomas Pelletier
c4a2eef8a4
Fix go 1.20 version in github actions ( #848 )
...
YAML interprets 1.20 as 1.2 without explicitely being a string.
2023-02-09 12:00:14 -05:00
Thomas Pelletier
b58c20aa49
Upgrade go 1.20 ( #847 )
...
Fixes #842
2023-02-08 18:59:58 -05:00
Cuong Manh Le
090cccf4ba
Fix inline table first key value whitespace ( #837 )
...
Co-authored-by: Cuong Manh Le <cuong@windscribe.com >
2023-02-01 12:00:09 +01:00
DavidKorczynski
58a592bbf8
ci: add CIFuzz integration ( #831 )
...
Signed-off-by: David Korczynski <david@adalogics.com >
2022-11-21 18:51:48 -05:00
dependabot[bot]
94bd3ddcd6
build(deps): bump actions/setup-go from 2 to 3 ( #820 )
...
Bumps [actions/setup-go](https://github.com/actions/setup-go ) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases )
- [Commits](https://github.com/actions/setup-go/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/setup-go
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
v2.0.6
2022-11-09 16:14:19 -05:00
Thomas Pelletier
e195b58fd0
Expose parser API as unstable ( #827 )
2022-11-09 16:12:39 -05:00
dependabot[bot]
c83d001c6d
build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1 ( #825 )
...
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify ) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases )
- [Commits](https://github.com/stretchr/testify/compare/v1.8.0...v1.8.1 )
---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-30 13:53:41 -04:00
Johanan Idicula
b9e3b9c370
refactor: Use typeMismatchError rather than raw string error ( #826 )
...
Uses the existing method to DRY up the error message generation, and decorates
with position index where needed. No behaviour is changed, but it allows for
further changes to make error messaging more specific.
Related to: pelletier/go-toml#806
2022-10-30 13:44:16 -04:00
Olivier Mengué
d26887310c
Reduce init time allocation when declaring types used for reflect ( #821 )
...
In declaration of types used for reflect, use
reflect.TypeOf((*T)).Elem() instead of reflect.TypeOf(T{}) to avoid
init-time allocations.
See related stdlib issue: https://github.com/golang/go/issues/55973
2022-10-07 14:28:37 +02:00
Thomas Pelletier
942841787a
Fix reflect.Pointer backward compatibility ( #813 )
...
Though we don't officially support older versions of Go, this is an easy fix to
unblock people.
Fixes #812
v2.0.5
2022-08-26 09:15:03 -04:00
Thomas Pelletier
28f1efc7d3
Decode: don't break on non-struct embed field ( #810 )
v2.0.4
2022-08-22 18:39:11 -04:00
Piotr Buliński
7d69e4a728
Add missing '+build' comment to fuzz_test.go ( #809 )
2022-08-22 14:05:37 -04:00
Thomas Pelletier
e46d245c09
Decode: don't crash on embedded nil pointers ( #808 )
...
Also has the perks of reducing the overhead of FindByIndex:
```
name old time/op new time/op delta
UnmarshalDataset/config-32 17.0ms ± 1% 17.0ms ± 1% ~ (p=1.000 n=5+5)
UnmarshalDataset/canada-32 71.6ms ± 1% 71.4ms ± 1% ~ (p=1.000 n=5+5)
UnmarshalDataset/citm_catalog-32 24.2ms ± 3% 23.5ms ± 2% -3.03% (p=0.032 n=5+5)
UnmarshalDataset/twitter-32 9.37ms ± 1% 9.09ms ± 2% -2.97% (p=0.032 n=5+5)
UnmarshalDataset/code-32 75.4ms ± 2% 74.9ms ± 0% ~ (p=0.222 n=5+5)
UnmarshalDataset/example-32 147µs ±10% 136µs ± 1% -7.14% (p=0.008 n=5+5)
Unmarshal/SimpleDocument/struct-32 512ns ± 2% 500ns ± 0% -2.35% (p=0.008 n=5+5)
Unmarshal/SimpleDocument/map-32 721ns ± 2% 702ns ± 1% -2.68% (p=0.008 n=5+5)
Unmarshal/ReferenceFile/struct-32 40.1µs ± 0% 39.6µs ± 0% -1.30% (p=0.008 n=5+5)
Unmarshal/ReferenceFile/map-32 62.3µs ± 1% 60.6µs ± 0% -2.83% (p=0.008 n=5+5)
Unmarshal/HugoFrontMatter-32 10.8µs ± 1% 10.5µs ± 1% -2.86% (p=0.008 n=5+5)
name old speed new speed delta
UnmarshalDataset/config-32 61.8MB/s ± 1% 61.8MB/s ± 1% ~ (p=1.000 n=5+5)
UnmarshalDataset/canada-32 30.8MB/s ± 1% 30.8MB/s ± 1% ~ (p=1.000 n=5+5)
UnmarshalDataset/citm_catalog-32 23.0MB/s ± 3% 23.8MB/s ± 2% +3.09% (p=0.032 n=5+5)
UnmarshalDataset/twitter-32 47.2MB/s ± 1% 48.6MB/s ± 2% +3.09% (p=0.032 n=5+5)
UnmarshalDataset/code-32 35.6MB/s ± 2% 35.9MB/s ± 0% ~ (p=0.222 n=5+5)
UnmarshalDataset/example-32 55.3MB/s ±10% 59.4MB/s ± 1% +7.36% (p=0.008 n=5+5)
Unmarshal/SimpleDocument/struct-32 21.5MB/s ± 2% 22.0MB/s ± 0% +2.41% (p=0.008 n=5+5)
Unmarshal/SimpleDocument/map-32 15.2MB/s ± 2% 15.7MB/s ± 1% +2.74% (p=0.008 n=5+5)
Unmarshal/ReferenceFile/struct-32 131MB/s ± 0% 132MB/s ± 0% +1.31% (p=0.008 n=5+5)
Unmarshal/ReferenceFile/map-32 84.1MB/s ± 1% 86.6MB/s ± 0% +2.91% (p=0.008 n=5+5)
Unmarshal/HugoFrontMatter-32 50.6MB/s ± 1% 52.1MB/s ± 1% +2.93% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
UnmarshalDataset/config-32 5.86MB ± 0% 5.86MB ± 0% ~ (p=0.579 n=5+5)
UnmarshalDataset/canada-32 83.0MB ± 0% 83.0MB ± 0% ~ (p=0.651 n=5+5)
UnmarshalDataset/citm_catalog-32 34.7MB ± 0% 34.7MB ± 0% ~ (p=0.548 n=5+5)
UnmarshalDataset/twitter-32 12.7MB ± 0% 12.7MB ± 0% ~ (p=1.000 n=5+5)
UnmarshalDataset/code-32 22.2MB ± 0% 22.2MB ± 0% ~ (p=0.841 n=5+5)
UnmarshalDataset/example-32 186kB ± 0% 186kB ± 0% ~ (p=0.111 n=5+5)
Unmarshal/SimpleDocument/struct-32 805B ± 0% 805B ± 0% ~ (all equal)
Unmarshal/SimpleDocument/map-32 1.13kB ± 0% 1.13kB ± 0% ~ (all equal)
Unmarshal/ReferenceFile/struct-32 20.9kB ± 0% 20.9kB ± 0% ~ (p=0.643 n=5+5)
Unmarshal/ReferenceFile/map-32 38.3kB ± 0% 38.3kB ± 0% ~ (p=0.397 n=5+5)
Unmarshal/HugoFrontMatter-32 7.44kB ± 0% 7.44kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
UnmarshalDataset/config-32 227k ± 0% 227k ± 0% ~ (p=1.000 n=5+5)
UnmarshalDataset/canada-32 782k ± 0% 782k ± 0% ~ (all equal)
UnmarshalDataset/citm_catalog-32 192k ± 0% 192k ± 0% ~ (p=0.968 n=4+5)
UnmarshalDataset/twitter-32 56.9k ± 0% 56.9k ± 0% ~ (p=0.429 n=4+5)
UnmarshalDataset/code-32 1.05M ± 0% 1.05M ± 0% ~ (p=0.556 n=4+5)
UnmarshalDataset/example-32 1.36k ± 0% 1.36k ± 0% ~ (all equal)
Unmarshal/SimpleDocument/struct-32 9.00 ± 0% 9.00 ± 0% ~ (all equal)
Unmarshal/SimpleDocument/map-32 13.0 ± 0% 13.0 ± 0% ~ (all equal)
Unmarshal/ReferenceFile/struct-32 183 ± 0% 183 ± 0% ~ (all equal)
Unmarshal/ReferenceFile/map-32 642 ± 0% 642 ± 0% ~ (all equal)
Unmarshal/HugoFrontMatter-32 141 ± 0% 141 ± 0% ~ (all equal)
```
Fixes #807
2022-08-20 21:24:03 -04:00
Thomas Pelletier
7baa23f493
Decode: error on array table mismatched type ( #804 )
...
Prevent the decoder from continuing if it encounters a type it cannot decode an
array table into.
Fixes #799
v2.0.3
2022-08-15 16:38:07 -04:00
Thomas Pelletier
2d8433b69e
Encode: don't inherit omitempty ( #803 )
...
Fixes #786 .
2022-08-15 11:29:46 -04:00
Thomas Pelletier
67bc5422f3
Go 1.19 ( #802 )
2022-08-15 10:56:33 -04:00
Thomas Pelletier
fb6d1d6c2b
Marshal: define and fix newlines behavior when using omitempty ( #798 )
...
Ref #786
2022-07-24 15:40:20 -04:00
dependabot[bot]
d017a6dc89
build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0 ( #795 )
2022-06-29 09:51:28 -04:00
dependabot[bot]
d6d3196163
build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5 ( #794 )
2022-06-24 12:49:56 -04:00
dependabot[bot]
41718a6db3
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.4 ( #793 )
...
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify ) from 1.7.2 to 1.7.4.
- [Release notes](https://github.com/stretchr/testify/releases )
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.4 )
---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-21 08:32:13 -04:00
Thomas Pelletier
216628222f
Build arm + arm64 binaries for linux and windows ( #790 )
...
* Build arm + arm64 binaries for linux and windows
* Type MaxInt64 to avoid overflow on 32 bits arch
On a 32 bits arch, math.MaxIn64 is interpreted as an int, and therefore
overflows. This causes compilation to build on those platforms.
v2.0.2
2022-06-08 18:05:42 -04:00
dependabot[bot]
322e0b15d2
build(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2 ( #788 )
...
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify ) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/stretchr/testify/releases )
- [Commits](https://github.com/stretchr/testify/compare/v1.7.1...v1.7.2 )
---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 17:44:59 -04:00
Thomas Pelletier
85bfc0ed51
Encode: add bound check for uint64 > math.Int64 ( #785 )
...
As brought up on #782 , there is an asymetry between numbers go-toml can encode
and decode. Specifically, unsigned numbers larger than `math.Int64` could be
encoded but not decoded.
We considered two options: allow decoding of those numbers, or prevent those
numbers to be decoded.
Ultimately we decided to narrow the range of numbers to be encoded. The TOML
specification only requires parsers to support at least the 64 bits integer
range. Allowing larger numbers would create non-standard TOML documents, which
may not be readable (at best) by other implementations. It is a safer default to
generate documents valid by default. People who wish to deal with larger numbers
can provide a custom type implementing `encoding.TextMarshaler`.
Refs #781
2022-05-31 22:10:41 -04:00
dependabot[bot]
295a720dfb
build(deps): bump goreleaser/goreleaser-action from 2 to 3 ( #783 )
...
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action ) from 2 to 3.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases )
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-23 15:05:00 +02:00
Thomas Pelletier
0a422e3dbd
Decoder: check max uint on 32 bit platforms ( #778 )
...
Fixes #777
v2.0.1
2022-05-10 15:43:26 +02:00
Thomas Pelletier
627dade0c7
Encode: support comment on array tables ( #776 )
...
Fixes #774
2022-05-10 15:17:36 +02:00
Thomas Pelletier
b2e0231cc9
Encode: fix multiline comment ( #775 )
...
Fixes #768
2022-05-10 14:53:26 +02:00
dependabot[bot]
ba95863cd3
build(deps): bump docker/login-action from 1 to 2 ( #771 )
...
Bumps [docker/login-action](https://github.com/docker/login-action ) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases )
- [Commits](https://github.com/docker/login-action/compare/v1...v2 )
---
updated-dependencies:
- dependency-name: docker/login-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-09 18:59:02 +02:00
Erik Hartwig
db679df765
Typo in README.md fix ( #770 )
...
Change "document was not prevent in the target structure" to "document was not present in the target structure".
2022-05-09 18:46:46 +02:00
Thomas Pelletier
c5ca2c682b
Fix embedded struct with explicit field name ( #773 )
...
Fixes #772
2022-05-09 18:45:02 +02:00
Thomas Pelletier
ed80712cb4
Copy version policy from v1
2022-04-28 11:55:39 -04:00
dependabot[bot]
b24772942d
build(deps): bump github/codeql-action from 1 to 2 ( #764 )
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](https://github.com/github/codeql-action/compare/v1...v2 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-28 08:24:14 -04:00
dependabot[bot]
9501a05ed7
build(deps): bump actions/checkout from 2 to 3 ( #765 )
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-28 08:23:56 -04:00
Thomas Pelletier
171a592663
Prepare repository for v2.0.0 ( #762 )
v2.0.0
2022-04-27 21:29:16 -04:00
Thomas Pelletier
5aaf5ef13b
Fix internal entry size test ( #761 )
...
The test meant to assert that the size of entry does not grow beyond
what it is today. 48 is the current size in bytes on x64. On 32-bit
platform that value should be less. As written the test was doing the
opposite comparison.
Fixes #760
2022-04-24 18:50:54 -04:00
Thomas Pelletier
adacebd8c7
Update benchmarks in README ( #756 )
v2.0.0-beta.8
2022-04-10 22:24:19 -04:00
Thomas Pelletier
8bbb673431
Fuzzing setup and fixes ( #755 )
...
* encode: fix localdate formatting
* encode: fix empty key marshaling
* encode: fix invalid quotation of time.Time
* encode: ensure control chars are escaped
* decode: always use UTC for zero tz
* encode: check for invalid characters in keys
* encode: always construct map for empty array tables
* fuzz: add go 1.18 fuzz test
* encode: handle NaNs
* encode: allow new lines in quoted keys
* encode: never emit table inside array
* encode: don't capitalize inf
2022-04-10 21:37:12 -04:00
Thomas Pelletier
2377ac4bc0
encode: fix embedded interfaces ( #753 )
...
Resolve marshaling regression when handling an embedded interface in a
struct.
Fixes #752
2022-04-08 09:25:54 -04:00
Thomas Pelletier
f5cc8c49eb
decoder: remove mention of UnmarshalText in errors ( #751 )
...
Fixes #737
v2.0.0-beta.7
2022-04-07 21:58:19 -04:00
Thomas Pelletier
89d7b412d8
decode: allow subtables to be defined later ( #750 )
...
Fixes #739
2022-04-07 21:49:16 -04:00
Thomas Pelletier
88a8aecdd4
tools: display error context when it exists ( #749 )
...
For example when failing to decode toml, display the context around the
error and the location of the problem.
2022-04-07 20:33:09 -04:00