readFile reads a file relative to the path of the reader. Non-existing files are ignored.
(n string)
| 93 | // readFile reads a file relative to the path of the reader. |
| 94 | // Non-existing files are ignored. |
| 95 | func (r *reader) readFile(n string) string { |
| 96 | if r.err != nil { |
| 97 | return "" |
| 98 | } |
| 99 | b, err := util.ReadFileNoStat(filepath.Join(r.path, n)) |
| 100 | if err != nil { |
| 101 | if !os.IsNotExist(err) { |
| 102 | r.err = err |
| 103 | } |
| 104 | return "" |
| 105 | } |
| 106 | return strings.TrimSpace(string(b)) |
| 107 | } |
| 108 | |
| 109 | func (r *reader) readHumanBytes(n string) uint64 { |
| 110 | s := r.readFile(n) |
no test coverage detected