all_of.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2011 Aaron Jacobs. All Rights Reserved.
  2. // Author: aaronjjacobs@gmail.com (Aaron Jacobs)
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. package oglematchers
  16. import (
  17. "strings"
  18. )
  19. // AllOf accepts a set of matchers S and returns a matcher that follows the
  20. // algorithm below when considering a candidate c:
  21. //
  22. // 1. Return true if for every Matcher m in S, m matches c.
  23. //
  24. // 2. Otherwise, if there is a matcher m in S such that m returns a fatal
  25. // error for c, return that matcher's error message.
  26. //
  27. // 3. Otherwise, return false with the error from some wrapped matcher.
  28. //
  29. // This is akin to a logical AND operation for matchers.
  30. func AllOf(matchers ...Matcher) Matcher {
  31. return &allOfMatcher{matchers}
  32. }
  33. type allOfMatcher struct {
  34. wrappedMatchers []Matcher
  35. }
  36. func (m *allOfMatcher) Description() string {
  37. // Special case: the empty set.
  38. if len(m.wrappedMatchers) == 0 {
  39. return "is anything"
  40. }
  41. // Join the descriptions for the wrapped matchers.
  42. wrappedDescs := make([]string, len(m.wrappedMatchers))
  43. for i, wrappedMatcher := range m.wrappedMatchers {
  44. wrappedDescs[i] = wrappedMatcher.Description()
  45. }
  46. return strings.Join(wrappedDescs, ", and ")
  47. }
  48. func (m *allOfMatcher) Matches(c interface{}) (err error) {
  49. for _, wrappedMatcher := range m.wrappedMatchers {
  50. if wrappedErr := wrappedMatcher.Matches(c); wrappedErr != nil {
  51. err = wrappedErr
  52. // If the error is fatal, return immediately with this error.
  53. _, ok := wrappedErr.(*FatalError)
  54. if ok {
  55. return
  56. }
  57. }
  58. }
  59. return
  60. }
PANIC: session(release): write data/sessions/9/c/9c872dcd26ff96a3: no space left on device

PANIC

session(release): write data/sessions/9/c/9c872dcd26ff96a3: 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)