package util
Import Path
github.com/prometheus/procfs/internal/util (on go.dev)
Dependency Relation
imports 7 packages, and imported by one package
Package-Level Type Names (only one)
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 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.
func NewValueParser(v string) *ValueParser
Package-Level Functions (total 13)
NewValueParser creates a ValueParser using the input string.
ParseBool parses a string into a boolean pointer.
Parses a uint64 from given hex in string.
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 io.ReadAll to read contents of entire file.
This is similar to os.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 1024kB. For files larger than this, a scanner
should be used.
ReadHexFromFile reads a file and attempts to parse a uint64 from a hexadecimal format 0xXX.
ReadIntFromFile reads a file and attempts to parse a int64 from it.
ReadUintFromFile reads a file and attempts to parse a uint64 from it.
SysReadFile is a simplified os.ReadFile that invokes syscall.Read directly.
https://github.com/prometheus/node_exporter/pull/728/files
Note that this function will not read files larger than 128 bytes.
SysReadIntFromFile reads a file using SysReadFile and attempts to parse a int64 from it.
SysReadUintFromFile reads a file using SysReadFile and attempts to parse a uint64 from it.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux 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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |