diff options
Diffstat (limited to 'src/cmd/pprof/internal/report/source.go')
-rw-r--r-- | src/cmd/pprof/internal/report/source.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/pprof/internal/report/source.go b/src/cmd/pprof/internal/report/source.go index 57300dd91..73ae1b4ea 100644 --- a/src/cmd/pprof/internal/report/source.go +++ b/src/cmd/pprof/internal/report/source.go @@ -358,9 +358,13 @@ func getFunctionSource(fun, file string, fns nodes, start, end int) (nodes, stri for { line, err := buf.ReadString('\n') if err != nil { - if line == "" || err != io.EOF { + if err != io.EOF { return nil, file, err } + if line == "" { + // end was at or past EOF; that's okay + break + } } if lineno >= start { flat, cum := sumNodes(lineNodes[lineno]) |