Standard library / net

net.OpError.Timeout()

Report timeout classification of the underlying error. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (e *OpError) Timeout() bool

Return Value

bool

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net"  "os")
func main() { e := &net.OpError{Op: "read", Err: os.ErrDeadlineExceeded}; fmt.Println(e.Timeout()) }
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)  }}
Go Reference