Skip to content

Commit 1c95c1b

Browse files
authored
Revert "fix: gob encoder panic if used in alias types. (#4)" (#5)
This reverts commit c4b87c2, reversing changes made to a2b4473.
2 parents c4b87c2 + fe14f6a commit 1c95c1b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

hcldec/gob.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ func init() {
1212
// specs can be sent over gob channels, such as using
1313
// github.com/hashicorp/go-plugin with plugins that need to describe
1414
// what shape of configuration they are expecting.
15-
// NOTE(i4k): use RegisterName() instead of Register() because the latter panics
16-
// if the registered types are used in alias types.
17-
gob.RegisterName("hcldec.ObjectSpec", ObjectSpec(nil))
18-
gob.RegisterName("hcldec.TupleSpec", TupleSpec(nil))
19-
gob.RegisterName("*hcldec.AttrSpec", (*AttrSpec)(nil))
20-
gob.RegisterName("*hcldec.LiteralSpec", (*LiteralSpec)(nil))
21-
gob.RegisterName("*hcldec.ExprSpec", (*ExprSpec)(nil))
22-
gob.RegisterName("*hcldec.BlockSpec", (*BlockSpec)(nil))
23-
gob.RegisterName("*hcldec.BlockListSpec", (*BlockListSpec)(nil))
24-
gob.RegisterName("*hcldec.BlockSetSpec", (*BlockSetSpec)(nil))
25-
gob.RegisterName("*hcldec.BlockMapSpec", (*BlockMapSpec)(nil))
26-
gob.RegisterName("*hcldec.BlockLabelSpec", (*BlockLabelSpec)(nil))
27-
gob.RegisterName("*hcldec.DefaultSpec", (*DefaultSpec)(nil))
15+
gob.Register(ObjectSpec(nil))
16+
gob.Register(TupleSpec(nil))
17+
gob.Register((*AttrSpec)(nil))
18+
gob.Register((*LiteralSpec)(nil))
19+
gob.Register((*ExprSpec)(nil))
20+
gob.Register((*BlockSpec)(nil))
21+
gob.Register((*BlockListSpec)(nil))
22+
gob.Register((*BlockSetSpec)(nil))
23+
gob.Register((*BlockMapSpec)(nil))
24+
gob.Register((*BlockLabelSpec)(nil))
25+
gob.Register((*DefaultSpec)(nil))
2826
}

0 commit comments

Comments
 (0)