From a3701e09313695d4a0f6fb0eb7844c1a4befc07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 27 Jul 2021 19:07:10 +0200 Subject: Switch to go-toml v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have been using `go-toml` for language files only. This commit makes it the only TOML library. It's spec compliant and very fast. A benchark building a site with 200 pages with TOML front matter: ```bash name old time/op new time/op delta SiteNew/Regular_TOML_front_matter-16 48.5ms ± 1% 47.1ms ± 1% -2.85% (p=0.029 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_TOML_front_matter-16 16.9MB ± 0% 16.7MB ± 0% -1.56% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_TOML_front_matter-16 302k ± 0% 296k ± 0% -2.20% (p=0.029 n=4+4) ``` Note that the front matter unmarshaling is only a small part of building a site, so the above is very good. Fixes #8801 --- parser/frontmatter_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'parser/frontmatter_test.go') diff --git a/parser/frontmatter_test.go b/parser/frontmatter_test.go index 9d9b7c3b8..dfbc695d8 100644 --- a/parser/frontmatter_test.go +++ b/parser/frontmatter_test.go @@ -31,9 +31,9 @@ func TestInterfaceToConfig(t *testing.T) { // TOML {map[string]interface{}{}, metadecoders.TOML, nil, false}, { - map[string]interface{}{"title": "test 1"}, + map[string]interface{}{"title": "test' 1"}, metadecoders.TOML, - []byte("title = \"test 1\"\n"), + []byte("title = \"test' 1\"\n"), false, }, -- cgit v1.2.3