Type system

Go type aliases

Introduces another name for an identical type, not a new distinct type. Generic aliases require Go 1.24 or later; this example uses a non-generic alias. Example output: '3'.

Formal Syntax & Structure

go syntaxgo
type Name = T

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  type Count = int  var x Count = 3  var y int = x  fmt.Println(y)}
Go Reference