From da53ac99bef9ce7567ac90b2be916e6e4a336ff4 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 23 Oct 2019 15:08:14 -0700 Subject: [PATCH] when using a slice of an imported field type, the Underlying still returned the slice rather than the element type. --- cmd/mapstructure-to-hcl2/mapstructure-to-hcl2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/mapstructure-to-hcl2/mapstructure-to-hcl2.go b/cmd/mapstructure-to-hcl2/mapstructure-to-hcl2.go index 5fce0daaf..da3a507bf 100644 --- a/cmd/mapstructure-to-hcl2/mapstructure-to-hcl2.go +++ b/cmd/mapstructure-to-hcl2/mapstructure-to-hcl2.go @@ -343,7 +343,7 @@ func getUsedImports(s *types.Struct) map[NamePath]*types.Package { fieldType = p.Elem() } if p, ok := fieldType.(*types.Slice); ok { - fieldType = p.Underlying() + fieldType = p.Elem() } namedType, ok := fieldType.(*types.Named) if !ok {