Skip to content

Commit

Permalink
Revert "fix: gob encoder panic if used in alias types. (#4)" (#5)
Browse files Browse the repository at this point in the history
This reverts commit c4b87c2, reversing
changes made to a2b4473.
  • Loading branch information
i4ki authored Aug 30, 2024
2 parents c4b87c2 + fe14f6a commit 1c95c1b
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions hcldec/gob.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ func init() {
// 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.
// NOTE(i4k): use RegisterName() instead of Register() because the latter panics
// if the registered types are used in alias types.
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))
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))
}

0 comments on commit 1c95c1b

Please sign in to comment.