Standard library / go/types
go/types.SizesFor()
Returns compiler- and architecture-specific type sizes, or nil for an unsupported combination. Expected stdout: '4 true\n'.
Formal Syntax & Structure
go syntaxgo
func SizesFor(compiler, arch string) SizesParameters & Attributes
| Name | Type | Description |
|---|---|---|
| compiler | string | Input to the operation as described above. |
| arch | string | Input to the operation as described above. |
Return Value
Sizes
Returns compiler- and architecture-specific type sizes, or nil for an unsupported combination.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { s := types.SizesFor("gc", "386") fmt.Println(s.Sizeof(types.Typ[types.Int]), types.SizesFor("unknown", "unknown") == nil)}