Skip to content

Commit

Permalink
blueprint: remove omitempty from Customizations
Browse files Browse the repository at this point in the history
See BurntSushi/toml#360

A recent change in BurntSushi/toml made encoding fail (later changed to
error) if a struct is marked as omitempty and is comparable. Go docs about
equality: https://go.dev/doc/go1#equality. Basically: A struct is comparable
if all of its fields are comparable. Slices are not comparable.

Customizations are marked as omitempty but they contain a lot of slices,
thus they are not comparable. The new version of BurntSushi/toml therefore
panics when we encode them.

The solution is to remove the omitempty tag from Customizations.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
  • Loading branch information
ondrejbudai committed Aug 28, 2022
1 parent 774cc9e commit b6297c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/blueprint/blueprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Blueprint struct {
Modules []Package `json:"modules" toml:"modules"`
Groups []Group `json:"groups" toml:"groups"`
Containers []Container `json:"containers,omitempty" toml:"containers,omitempty"`
Customizations *Customizations `json:"customizations,omitempty" toml:"customizations,omitempty"`
Customizations *Customizations `json:"customizations,omitempty" toml:"customizations"`
Distro string `json:"distro" toml:"distro"`
}

Expand Down

0 comments on commit b6297c9

Please sign in to comment.