Standard library / go/types

go/types.Nil.String()

Formats the declaration for human-readable diagnostics; do not parse this representation as a stable format. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (obj *Nil) String() string

Return Value

string

Formats the declaration for human-readable diagnostics; do not parse this representation as a stable format.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types"  "strings")
func main() {  v := types.Universe.Lookup("nil").(*types.Nil)  fmt.Println(strings.Contains(v.String(), "nil"))}
Go Reference