Standard library / go/types

go/types.Slice

Represents a Go slice type in the semantic model, not a runtime value. Expected stdout: '[]int\n'.

Formal Syntax & Structure

go syntaxgo
type Slice struct {}

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { t := types.NewSlice(types.Typ[types.Int]); fmt.Println(t) }
Go Reference