Standard library / go/types

go/types.NewMethodSet()

Constructs the method set of a type; pointer and value method sets can differ. Expected stdout: '0\n'.

Formal Syntax & Structure

go syntaxgo
func NewMethodSet(T Type) *MethodSet

Parameters & Attributes

NameTypeDescription
TTypeDestination type or interface, or type to inspect.

Return Value

*MethodSet

Constructs the method set of a type; pointer and value method sets can differ.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { fmt.Println(types.NewMethodSet(types.Typ[types.Int]).Len()) }
Go Reference