Standard library / net
net.AddrError.Error()
Return a human-readable diagnostic for the constructed error; do not parse diagnostic text as a stable interface. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *AddrError) Error() stringReturn Value
string
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net")
func main() { fmt.Println((&net.AddrError{Err: "invalid port", Addr: "demo"}).Error() != "") }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}