Standard library / reflect
reflect.ValueError.Error()
Return the diagnostic describing the invalid operation; do not rely on exact error text for control flow. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *ValueError) Error() stringReturn Value
string
Return the diagnostic describing the invalid operation; do not rely on exact error text for control flow.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect" "strings")
func main() { e := &reflect.ValueError{Method: "reflect.Value.Int", Kind: reflect.String} fmt.Println(strings.Contains(e.Error(), "Int"))}