Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / internal / robustio / robustio_windows.go
1 // Copyright 2019 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
5 package robustio
6
7 import (
8         "os"
9         "syscall"
10 )
11
12 const errFileNotFound = syscall.ERROR_FILE_NOT_FOUND
13
14 // isEphemeralError returns true if err may be resolved by waiting.
15 func isEphemeralError(err error) bool {
16         switch werr := err.(type) {
17         case *os.PathError:
18                 err = werr.Err
19         case *os.LinkError:
20                 err = werr.Err
21         case *os.SyscallError:
22                 err = werr.Err
23         }
24         if errno, ok := err.(syscall.Errno); ok {
25                 switch errno {
26                 case syscall.ERROR_ACCESS_DENIED,
27                         syscall.ERROR_FILE_NOT_FOUND,
28                         ERROR_SHARING_VIOLATION:
29                         return true
30                 }
31         }
32         return false
33 }