Standard library / net/url

url.Error.Timeout()

Report whether the wrapped error reports a timeout. Expected stdout: 'true\n'.

Formal Syntax & Structure

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

Return Value

bool

Operation result; check errors and validity indicators when returned.

Working Example

Example Snippetgo
package main
import (  "context"  "fmt"  "net/url")
func main() { e := &url.Error{Err: context.DeadlineExceeded}; 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