MCPcopy Index your code
hub / github.com/koding/kite / readFile

Function readFile

systeminfo/systeminfo_linux.go:72–91  ·  view source on GitHub ↗
(file string, handler func(string) bool)

Source from the content-addressed store, hash-verified

70}
71
72func readFile(file string, handler func(string) bool) error {
73 contents, err := ioutil.ReadFile(file)
74 if err != nil {
75 return err
76 }
77
78 reader := bufio.NewReader(bytes.NewBuffer(contents))
79
80 for {
81 line, _, err := reader.ReadLine()
82 if err == io.EOF {
83 break
84 }
85 if !handler(string(line)) {
86 break
87 }
88 }
89
90 return nil
91}
92
93func strtoull(val string) (uint64, error) {
94 return strconv.ParseUint(val, 10, 64)

Callers 1

parseMeminfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected