MCPcopy Create free account
hub / github.com/prometheus/procfs / readFile

Method readFile

bcachefs/get.go:95–107  ·  view source on GitHub ↗

readFile reads a file relative to the path of the reader. Non-existing files are ignored.

(n string)

Source from the content-addressed store, hash-verified

93// readFile reads a file relative to the path of the reader.
94// Non-existing files are ignored.
95func (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
109func (r *reader) readHumanBytes(n string) uint64 {
110 s := r.readFile(n)

Callers 1

readHumanBytesMethod · 0.95

Calls 1

ReadFileNoStatFunction · 0.92

Tested by

no test coverage detected