package util
Import Path
github.com/prometheus/procfs/internal/util (on go.dev)
Dependency Relation
imports 6 packages, and imported by one package
Package-Level Type Names (only one, which is exported)
A ValueParser enables parsing a single string into a variety of data types
in a concise and safe way. The Err method must be invoked after invoking
any other methods to ensure a value was successfully parsed.
err error
v string
Err returns the last error, if any, encountered by the ValueParser.
Int interprets the underlying value as an int and returns that value.
PInt64 interprets the underlying value as an int64 and returns a pointer to
that value.
PUInt64 interprets the underlying value as an uint64 and returns a pointer to
that value.
int64 interprets the underlying value as an int64 and returns that value.
TODO: export if/when necessary.
func NewValueParser(v string) *ValueParser
Package-Level Functions (total 8, all are exported)
NewValueParser creates a ValueParser using the input string.
ParseBool parses a string into a boolean pointer.
ParsePInt64s parses a slice of strings into a slice of int64 pointers.
ParseUint32s parses a slice of strings into a slice of uint32s.
ParseUint64s parses a slice of strings into a slice of uint64s.
ReadFileNoStat uses ioutil.ReadAll to read contents of entire file.
This is similar to ioutil.ReadFile but without the call to os.Stat, because
many files in /proc and /sys report incorrect file sizes (either 0 or 4096).
Reads a max file size of 512kB. For files larger than this, a scanner
should be used.
ReadUintFromFile reads a file and attempts to parse a uint64 from it.
SysReadFile is here implemented as a noop for builds that do not support
the read syscall. For example Windows, or Linux on Google App Engine.
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |