-
-
Notifications
You must be signed in to change notification settings - Fork 197
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I have ported the TOML config in hugoreleaser to YAML using this YAML library. The primary motivation behind this was to be able to use YAML anchors/aliases get Hugo's release config a little more manageable.
Unfortunately my setup crashes:
See https://go.dev/play/p/lNf3br5S0sF
package main
import (
"strings"
yaml "github.com/goccy/go-yaml"
)
type Build struct {
Definitions map[string]any `json:"definitions"`
BuildSettings BuildSettings `json:"build_settings"`
}
type BuildSettings struct {
Binary string `json:"binary"`
Flags []string `json:"flags"`
Env []string `json:"env"`
Ldflags string `json:"ldflags"`
}
func main() {
config := `
definitions:
myenv: &my_env
- VAR1=1
- VAR2=2
build_settings:
binary: hugoreleaser
flags:
- -buildmode
- exe
env: *my_env
ldflags: "-s -w -X main.tag=${HUGORELEASER_TAG}"
`
d := yaml.NewDecoder(strings.NewReader(config),
yaml.DisallowUnknownField(),
)
var cfg Build
err := d.Decode(&cfg)
if err != nil {
panic(err)
}
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working