diff options
Diffstat (limited to 'vendor/github.com/prometheus/procfs/internal/util/parse.go')
-rw-r--r-- | vendor/github.com/prometheus/procfs/internal/util/parse.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/github.com/prometheus/procfs/internal/util/parse.go b/vendor/github.com/prometheus/procfs/internal/util/parse.go index 755591d..22cb07a 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/parse.go +++ b/vendor/github.com/prometheus/procfs/internal/util/parse.go | |||
@@ -73,6 +73,15 @@ func ReadUintFromFile(path string) (uint64, error) { | |||
73 | return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) | 73 | return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) |
74 | } | 74 | } |
75 | 75 | ||
76 | // ReadIntFromFile reads a file and attempts to parse a int64 from it. | ||
77 | func ReadIntFromFile(path string) (int64, error) { | ||
78 | data, err := ioutil.ReadFile(path) | ||
79 | if err != nil { | ||
80 | return 0, err | ||
81 | } | ||
82 | return strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64) | ||
83 | } | ||
84 | |||
76 | // ParseBool parses a string into a boolean pointer. | 85 | // ParseBool parses a string into a boolean pointer. |
77 | func ParseBool(b string) *bool { | 86 | func ParseBool(b string) *bool { |
78 | var truth bool | 87 | var truth bool |