Skip to content

Commit 581b14b

Browse files
committed
unalias type aliases in go1.24 to get the actual type.
1 parent 007a7ea commit 581b14b

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)