From decfd079c599d38c12a5ae9e89fdeec5874fb3be Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Fri, 21 Jun 2013 14:19:57 -0700 Subject: [PATCH] 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 --- cmd/cover/html.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/cover/html.go b/cmd/cover/html.go index c274271338..76bed29180 100644 --- a/cmd/cover/html.go +++ b/cmd/cover/html.go @@ -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)