34 lines
506 B
Go
34 lines
506 B
Go
package parser
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
type MemoryParser struct {
|
|
}
|
|
|
|
func (p *MemoryParser) Name() string {
|
|
return "mem"
|
|
}
|
|
|
|
func (p *MemoryParser) Parse(scanner *ParserScanner) (map[string]string, error) {
|
|
var (
|
|
stats = map[string]string{}
|
|
)
|
|
|
|
for scanner.Scan() {
|
|
line := scanner.Text()
|
|
parts := strings.Fields(line)
|
|
key := parts[0][:len(parts[0])-1]
|
|
|
|
stats[key] = parts[1]
|
|
}
|
|
|
|
//res, err := mem.parse(keys, stats)
|
|
//if err != nil {
|
|
// return nil, err
|
|
//}
|
|
|
|
return stats, scanner.Err()
|
|
}
|