Switch to go-toml v2
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 27 Jul 2021 17:07:10 +0000 (19:07 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 28 Jul 2021 09:51:13 +0000 (11:51 +0200)
commita3701e09313695d4a0f6fb0eb7844c1a4befc07a
tree443c85a8b6cbf841155efad4aa99ead8c2824720
parent40b6016cf3f7aac541b042d32e3a162411fd9cd0
Switch to go-toml v2

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
12 files changed:
commands/commands_test.go
common/herrors/file_error_test.go
common/herrors/line_number_extractors.go
go.mod
go.sum
hugolib/config_test.go
hugolib/configdir_test.go
langs/i18n/translationProvider.go
parser/frontmatter.go
parser/frontmatter_test.go
parser/metadecoders/decoder.go
tpl/transform/remarshal_test.go