Skip to content

Commit c1006e1

Browse files
unalias type aliases in go1.24 to get the actual type.
2 parents 007a7ea + 581b14b commit c1006e1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ func goFieldToCtyType(accessor string, fieldType types.Type) (interface{}, cty.T
320320
default:
321321
return goFieldToCtyType(accessor, underlyingType)
322322
}
323+
case *types.Alias:
324+
// Go 1.24+ represents type aliases explicitly (e.g., os.FileMode = fs.FileMode)
325+
// Unwrap the alias to get the actual type
326+
return goFieldToCtyType(accessor, types.Unalias(f))
323327
case *types.Slice:
324328
elem := f.Elem()
325329
if ptr, isPtr := elem.(*types.Pointer); isPtr {

0 commit comments

Comments
 (0)