github.com/goccy/go-yaml@v1.18.0
package main
import (
"log"
"github.com/goccy/go-yaml"
)
func main() {
data := []byte(`
# empty document
`)
target := make(map[string]any)
err := yaml.Unmarshal(data, &target)
if err != nil {
log.Fatalf("error: %v", err)
}
if target == nil {
log.Println("target is nil")
}
}
I would expect yaml.Unmarshal to preserve the empty (non-nil) map in the above example.
gohugoio/hugo#14074