MCPcopy Index your code
hub / github.com/google/go-github / WithTimeout

Function WithTimeout

github/github.go:397–406  ·  view source on GitHub ↗

WithTimeout returns a ClientOptionsFunc that sets the timeout for a Client. This overrides the timeout set by [WithHTTPClient]. If not set and no HTTP client is provided, the default http.Client with no timeout will be used. It is recommended to provide a timeout for production environments.

(timeout time.Duration)

Source from the content-addressed store, hash-verified

395// client is provided, the default http.Client with no timeout will be used.
396// It is recommended to provide a timeout for production environments.
397func WithTimeout(timeout time.Duration) ClientOptionsFunc {
398 return func(o *clientOptions) error {
399 if timeout < 0 {
400 return errors.New("timeout must not be negative")
401 }
402
403 o.timeout = &timeout
404 return nil
405 }
406}
407
408// WithUserAgent returns a ClientOptionsFunc that sets the User-Agent header
409// for a Client. If not set, a default User-Agent will be used.

Callers 2

TestWithTimeoutFunction · 0.85
TestClient_CloneFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestWithTimeoutFunction · 0.68
TestClient_CloneFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…