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

Function ReadIntFromFile

internal/util/parse.go:93–99  ·  view source on GitHub ↗

ReadIntFromFile reads a file and attempts to parse a int64 from it.

(path string)

Source from the content-addressed store, hash-verified

91
92// ReadIntFromFile reads a file and attempts to parse a int64 from it.
93func ReadIntFromFile(path string) (int64, error) {
94 data, err := os.ReadFile(path)
95 if err != nil {
96 return 0, err
97 }
98 return strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64)
99}
100
101// ParseBool parses a string into a boolean pointer.
102func ParseBool(b string) *bool {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…