Skip to content

Commit

Permalink
fix: gob encoder panic if used in alias types.
Browse files Browse the repository at this point in the history
Signed-off-by: i4k <[email protected]>
  • Loading branch information
i4ki committed Aug 30, 2024
1 parent a2b4473 commit 3a593ed
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions hcldec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ import (
)

func init() {
// Every Spec implementation should be registered with gob, so that
// specs can be sent over gob channels, such as using
// github.com/hashicorp/go-plugin with plugins that need to describe
// what shape of configuration they are expecting.
gob.Register(ObjectSpec(nil))
gob.Register(TupleSpec(nil))
gob.Register((*AttrSpec)(nil))
gob.Register((*LiteralSpec)(nil))
gob.Register((*ExprSpec)(nil))
gob.Register((*BlockSpec)(nil))
gob.Register((*BlockListSpec)(nil))
gob.Register((*BlockSetSpec)(nil))
gob.Register((*BlockMapSpec)(nil))
gob.Register((*BlockLabelSpec)(nil))
gob.Register((*DefaultSpec)(nil))
gob.RegisterName("hcldec.ObjectSpec", ObjectSpec(nil))
gob.RegisterName("hcldec.TupleSpec", TupleSpec(nil))
gob.RegisterName("*hcldec.AttrSpec", (*AttrSpec)(nil))
gob.RegisterName("*hcldec.LiteralSpec", (*LiteralSpec)(nil))
gob.RegisterName("*hcldec.ExprSpec", (*ExprSpec)(nil))
gob.RegisterName("*hcldec.BlockSpec", (*BlockSpec)(nil))
gob.RegisterName("*hcldec.BlockListSpec", (*BlockListSpec)(nil))
gob.RegisterName("*hcldec.BlockSetSpec", (*BlockSetSpec)(nil))
gob.RegisterName("*hcldec.BlockMapSpec", (*BlockMapSpec)(nil))
gob.RegisterName("*hcldec.BlockLabelSpec", (*BlockLabelSpec)(nil))
gob.RegisterName("*hcldec.DefaultSpec", (*DefaultSpec)(nil))
}

0 comments on commit 3a593ed

Please sign in to comment.