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) *MethodSetParameters & Attributes
| Name | Type | Description |
|---|---|---|
| T | Type | Destination 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()) }