util.go 586 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Rufs - Remote Union File System
  3. *
  4. * Copyright 2017 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the MIT
  7. * License, If a copy of the MIT License was not distributed with this
  8. * file, You can obtain one at https://opensource.org/licenses/MIT.
  9. */
  10. package rufs
  11. import (
  12. "io"
  13. "devt.de/krotik/rufs/node"
  14. )
  15. /*
  16. IsEOF tests if the given error is an EOF error.
  17. */
  18. func IsEOF(err error) bool {
  19. if err == io.EOF {
  20. return true
  21. }
  22. if rerr, ok := err.(*node.Error); ok {
  23. return rerr.Detail == io.EOF.Error()
  24. }
  25. return false
  26. }