go17.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2016 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. // +build go1.7
  5. package context
  6. import (
  7. "context" // standard library's context, as of Go 1.7
  8. "time"
  9. )
  10. var (
  11. todo = context.TODO()
  12. background = context.Background()
  13. )
  14. // Canceled is the error returned by Context.Err when the context is canceled.
  15. var Canceled = context.Canceled
  16. // DeadlineExceeded is the error returned by Context.Err when the context's
  17. // deadline passes.
  18. var DeadlineExceeded = context.DeadlineExceeded
  19. // WithCancel returns a copy of parent with a new Done channel. The returned
  20. // context's Done channel is closed when the returned cancel function is called
  21. // or when the parent context's Done channel is closed, whichever happens first.
  22. //
  23. // Canceling this context releases resources associated with it, so code should
  24. // call cancel as soon as the operations running in this Context complete.
  25. func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
  26. ctx, f := context.WithCancel(parent)
  27. return ctx, CancelFunc(f)
  28. }
  29. // WithDeadline returns a copy of the parent context with the deadline adjusted
  30. // to be no later than d. If the parent's deadline is already earlier than d,
  31. // WithDeadline(parent, d) is semantically equivalent to parent. The returned
  32. // context's Done channel is closed when the deadline expires, when the returned
  33. // cancel function is called, or when the parent context's Done channel is
  34. // closed, whichever happens first.
  35. //
  36. // Canceling this context releases resources associated with it, so code should
  37. // call cancel as soon as the operations running in this Context complete.
  38. func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
  39. ctx, f := context.WithDeadline(parent, deadline)
  40. return ctx, CancelFunc(f)
  41. }
  42. // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
  43. //
  44. // Canceling this context releases resources associated with it, so code should
  45. // call cancel as soon as the operations running in this Context complete:
  46. //
  47. // func slowOperationWithTimeout(ctx context.Context) (Result, error) {
  48. // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
  49. // defer cancel() // releases resources if slowOperation completes before timeout elapses
  50. // return slowOperation(ctx)
  51. // }
  52. func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
  53. return WithDeadline(parent, time.Now().Add(timeout))
  54. }
  55. // WithValue returns a copy of parent in which the value associated with key is
  56. // val.
  57. //
  58. // Use context Values only for request-scoped data that transits processes and
  59. // APIs, not for passing optional parameters to functions.
  60. func WithValue(parent Context, key interface{}, val interface{}) Context {
  61. return context.WithValue(parent, key, val)
  62. }
PANIC: session(release): write data/sessions/d/b/db4449d9808cd793: no space left on device

PANIC

session(release): write data/sessions/d/b/db4449d9808cd793: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)