adding build info
This commit is contained in:
parent
b71e4db7db
commit
03a1a4e132
@ -8,9 +8,17 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getVersion() string {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
return info.Main.Version
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func (t *Test) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||
if len(t.Tests) == 0 {
|
||||
start.Name = xml.Name{Local: "testcase"}
|
||||
@ -50,6 +58,9 @@ func (t *Test) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
fmt.Fprintf(os.Stderr, "go2junit version %s\n", getVersion())
|
||||
|
||||
testsuites := Testsuites{}
|
||||
|
||||
if len(os.Args) != 2 && len(os.Args) != 3 {
|
||||
@ -146,7 +157,9 @@ func main() {
|
||||
if testsuites.Failures+testsuites.Errors+testsuites.Skipped+testsuites.Disabled > 0 {
|
||||
fmt.Printf("\nFAILED TESTS\n\n")
|
||||
printFailedTests("", "", testsuites.Suites)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func printFailedTests(indent string, parentTest string, tests []*Test) {
|
||||
|
Loading…
Reference in New Issue
Block a user