1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

go.tools/cmd/cover: skip mode line (first line of profile)

Still to do: use the mode to affect how to present the data.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/10364050
This commit is contained in:
Rob Pike 2013-06-21 14:19:57 -07:00
parent 0325defab0
commit decfd079c5

View File

@ -97,7 +97,17 @@ type ProfileBlock struct {
// Profile for each file.
func ParseProfiles(r io.Reader) (map[string]*Profile, error) {
files := make(map[string]*Profile)
s := bufio.NewScanner(r)
buf := bufio.NewReader(r)
// First line is mode.
mode, err := buf.ReadString('\n')
if err != nil {
return nil, err
}
_ = mode // TODO: Use the mode to affect the display.
// Rest of file is in the format
// encoding/base64/base64.go:34.44,37.40 3 1
// where the fields are: name.go:line.column,line.column numberOfStatements count
s := bufio.NewScanner(buf)
for s.Scan() {
line := s.Text()
m := lineRe.FindStringSubmatch(line)