1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-08 04:42:07 +03:00

Update vendored tools/.

This commit is contained in:
Will Rouesnel
2017-08-03 21:19:17 +10:00
parent 1afbd62ab1
commit a7ff84a674
22 changed files with 1452 additions and 1109 deletions

View File

@@ -6,6 +6,7 @@
package main
import (
"bytes"
_ "crypto/sha512"
"encoding/json"
"errors"
@@ -43,7 +44,7 @@ func (a *Flags) Set(value string) error {
var (
extraFlags Flags
pkg = flag.String("package", "", "Go package")
verbose = flag.Bool("v", false, "Pass '-v' argument to 'go test'")
verbose = flag.Bool("v", false, "Pass '-v' argument to 'go test' and output to stdout")
debug = flag.Bool("debug", false, "Enable debug output")
coverprof = flag.String("coverprofile", "", "If supplied, use a go cover profile (comma separated)")
covermode = flag.String("covermode", "count", "sent as covermode argument to go test")
@@ -127,19 +128,25 @@ func getCoverage() ([]*SourceFile, error) {
return nil, err
}
f.Close()
cmd := exec.Command("go")
outBuf := new(bytes.Buffer)
cmd.Stdout = outBuf
cmd.Stderr = outBuf
args := []string{"go", "test", "-covermode", *covermode, "-coverprofile", f.Name(), coverpkg}
if *verbose {
args = append(args, "-v")
cmd.Stdout = os.Stdout
}
args = append(args, extraFlags...)
args = append(args, line)
cmd.Args = args
b, err := cmd.CombinedOutput()
err = cmd.Run()
if err != nil {
return nil, fmt.Errorf("%v: %v", err, string(b))
return nil, fmt.Errorf("%v: %v", err, outBuf.String())
}
pfs, err := cover.ParseProfiles(f.Name())
if err != nil {
return nil, err