Standard library / net
net.DNSError.Error()
Render a DNS lookup diagnostic; wording is not a stable machine interface. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *DNSError) Error() stringReturn Value
string
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "net" "strings")
func main() { e := &net.DNSError{Err: "demo failure", Name: "demo.invalid."} fmt.Println(strings.Contains(e.Error(), "demo.invalid."))}
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) }}