Standard library / go/types
go/types.TypeAndValue.Assignable()
Reports whether the expression denotes an assignable operand. Expected stdout: 'false\n'.
Formal Syntax & Structure
go syntaxgo
func (tv TypeAndValue) Assignable() boolReturn Value
bool
Reports whether the expression denotes an assignable operand.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token" "go/types")
func check(e error) { if e != nil { panic(e) }}
func main() { tv, e := types.Eval(token.NewFileSet(), nil, 0, "2+3") check(e) fmt.Println(tv.Assignable())}