mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
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
This commit is contained in:
parent
40b6016cf3
commit
a3701e0931
12 changed files with 50 additions and 40 deletions
|
@ -119,10 +119,10 @@ p3 = "p3params_no_production"
|
|||
c.Assert(cfg.GetString("params.p3"), qt.Equals, "p3params_development")
|
||||
c.Assert(cfg.GetString("languages.no.params.p3"), qt.Equals, "p3params_no_development")
|
||||
|
||||
c.Assert(len(cfg.Get("menus.docs").(([]map[string]interface{}))), qt.Equals, 2)
|
||||
c.Assert(len(cfg.Get("menus.docs").([]interface{})), qt.Equals, 2)
|
||||
noMenus := cfg.Get("languages.no.menus.docs")
|
||||
c.Assert(noMenus, qt.Not(qt.IsNil))
|
||||
c.Assert(len(noMenus.(([]map[string]interface{}))), qt.Equals, 1)
|
||||
c.Assert(len(noMenus.([]interface{})), qt.Equals, 1)
|
||||
}
|
||||
|
||||
func TestLoadConfigDirError(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue