Standard library / go/types

go/types.StdSizes.Alignof()

Returns the required alignment in bytes for this sizing model. Expected stdout: '8\n'.

Formal Syntax & Structure

go syntaxgo
func (s *StdSizes) Alignof(T Type) (result int64)

Parameters & Attributes

NameTypeDescription
TTypeDestination type or interface, or type to inspect.

Return Value

(result int64)

Returns the required alignment in bytes for this sizing model.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() {  v := &types.StdSizes{WordSize: 8, MaxAlign: 8}  fmt.Println(v.Alignof(types.Typ[types.Int64]))}
Go Reference