Standard library / net
net.OpError.Unwrap()
Expose the underlying error for error-chain inspection. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (e *OpError) Unwrap() errorReturn Value
error
Operation result; check errors and validity indicators when returned.
Working Example
Example Snippetgo
package main
import ( "fmt" "io" "net")
func main() { e := &net.OpError{Op: "read", Err: io.EOF}; fmt.Println(e.Unwrap() == io.EOF) }
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) }}