Verify if reader is a generic ReaderAt
(reader io.Reader)
| 36 | |
| 37 | // Verify if reader is a generic ReaderAt |
| 38 | func isReadAt(reader io.Reader) (ok bool) { |
| 39 | var v *os.File |
| 40 | v, ok = reader.(*os.File) |
| 41 | if ok { |
| 42 | // Stdin, Stdout and Stderr all have *os.File type |
| 43 | // which happen to also be io.ReaderAt compatible |
| 44 | // we need to add special conditions for them to |
| 45 | // be ignored by this function. |
| 46 | for _, f := range []string{ |
| 47 | "/dev/stdin", |
| 48 | "/dev/stdout", |
| 49 | "/dev/stderr", |
| 50 | } { |
| 51 | if f == v.Name() { |
| 52 | ok = false |
| 53 | break |
| 54 | } |
| 55 | } |
| 56 | } else { |
| 57 | _, ok = reader.(io.ReaderAt) |
| 58 | } |
| 59 | return ok |
| 60 | } |
| 61 | |
| 62 | // OptimalPartInfo - calculate the optimal part info for a given |
| 63 | // object size. |
no outgoing calls
no test coverage detected