Commit bc7e2662 authored by Rob Pike's avatar Rob Pike

cmd/go: use -o option of cover tool

Separates correct from erroneous output so errors running the tool will appear
in the log.

R=rsc
CC=golang-dev
https://golang.org/cl/10191043
parent ae5e791e
......@@ -1110,14 +1110,15 @@ func (b *builder) copyFile(a *action, dst, src string, perm os.FileMode) error {
}
// cover runs, in effect,
// go tool cover -mode=b.coverMode -count="count" -pos="pos" src.go >dst.go
// go tool cover -mode=b.coverMode -count="count" -pos="pos" -o dst.go src.go
func (b *builder) cover(a *action, dst, src string, perm os.FileMode, count, pos string) error {
out, err := b.runOut(a.objdir, "cover "+a.p.ImportPath, nil, tool("cover"), "-mode="+a.p.coverMode, "-count="+count, "-pos="+pos, src)
if err != nil {
return err
}
// Output is processed source code. Write it to destination.
return ioutil.WriteFile(dst, out, perm)
return b.run(a.objdir, "cover "+a.p.ImportPath, nil,
tool("cover"),
"-mode", a.p.coverMode,
"-count", count,
"-pos", pos,
"-o", dst,
src)
}
var objectMagic = [][]byte{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment