diff --git a/cmd/go2junit/go2junit.go b/cmd/go2junit/go2junit.go index f35e173..d803de4 100644 --- a/cmd/go2junit/go2junit.go +++ b/cmd/go2junit/go2junit.go @@ -68,9 +68,16 @@ func main() { os.Exit(1) } filename := os.Args[1] - - file, _ := os.Open(filename) - defer file.Close() + var file *os.File + if filename != "-" { + file, err := os.Open(filename) + if err != nil { + panic(err) + } + defer file.Close() + } else { + file = os.Stdin + } scanner := bufio.NewScanner(file) lineno := 0