Created
June 30, 2022 10:16
-
-
Save sivsivsree/3e0f7b4b583526e2114939c16805c187 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An emptyCtx is never canceled, has no values, and has no deadline. It is not | |
// struct{}, since vars of this type must have distinct addresses. | |
type emptyCtx int | |
func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { | |
return | |
} | |
func (*emptyCtx) Done() <-chan struct{} { | |
return nil | |
} | |
func (*emptyCtx) Err() error { | |
return nil | |
} | |
func (*emptyCtx) Value(key any) any { | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment