1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:44:42 -07:00

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
This commit is contained in:
Rob Pike 2013-06-11 20:47:35 -07:00
parent ae5e791ed2
commit bc7e26621e

View File

@ -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{