The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

context.go 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package context defines the Context type, which carries deadlines,
  5. // cancelation signals, and other request-scoped values across API boundaries
  6. // and between processes.
  7. //
  8. // Incoming requests to a server should create a Context, and outgoing calls to
  9. // servers should accept a Context. The chain of function calls between must
  10. // propagate the Context, optionally replacing it with a modified copy created
  11. // using WithDeadline, WithTimeout, WithCancel, or WithValue.
  12. //
  13. // Programs that use Contexts should follow these rules to keep interfaces
  14. // consistent across packages and enable static analysis tools to check context
  15. // propagation:
  16. //
  17. // Do not store Contexts inside a struct type; instead, pass a Context
  18. // explicitly to each function that needs it. The Context should be the first
  19. // parameter, typically named ctx:
  20. //
  21. // func DoSomething(ctx context.Context, arg Arg) error {
  22. // // ... use ctx ...
  23. // }
  24. //
  25. // Do not pass a nil Context, even if a function permits it. Pass context.TODO
  26. // if you are unsure about which Context to use.
  27. //
  28. // Use context Values only for request-scoped data that transits processes and
  29. // APIs, not for passing optional parameters to functions.
  30. //
  31. // The same Context may be passed to functions running in different goroutines;
  32. // Contexts are safe for simultaneous use by multiple goroutines.
  33. //
  34. // See http://blog.golang.org/context for example code for a server that uses
  35. // Contexts.
  36. package context // import "golang.org/x/net/context"
  37. // Background returns a non-nil, empty Context. It is never canceled, has no
  38. // values, and has no deadline. It is typically used by the main function,
  39. // initialization, and tests, and as the top-level Context for incoming
  40. // requests.
  41. func Background() Context {
  42. return background
  43. }
  44. // TODO returns a non-nil, empty Context. Code should use context.TODO when
  45. // it's unclear which Context to use or it is not yet available (because the
  46. // surrounding function has not yet been extended to accept a Context
  47. // parameter). TODO is recognized by static analysis tools that determine
  48. // whether Contexts are propagated correctly in a program.
  49. func TODO() Context {
  50. return todo
  51. }