Standard library / go/types
go/types.NewInterface()
Legacy constructor accepting embedded named types. Prefer NewInterfaceType. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func NewInterface(methods []*Func, embeddeds []*Named) *InterfaceParameters & Attributes
| Name | Type | Description |
|---|---|---|
| methods | []*Func | Method objects to attach. |
| embeddeds | []*Named | Input to the operation as described above. |
Return Value
*Interface
Legacy constructor accepting embedded named types.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { i := types.NewInterface(nil, nil).Complete(); fmt.Println(i.Empty()) }