Skip to content

Commit

Permalink
accept input as a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mralves committed May 30, 2019
1 parent 3df2f51 commit 990b0d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gocov-xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ type Line struct {
}

func Parse(sourcePath string) error {
err := ParseWithOutput(sourcePath, os.Stdout)
err := ParseWithOutput(os.Stdin, sourcePath, os.Stdout)
if err != nil {
return err
}
fmt.Println()
return nil
}

func ParseWithOutput(sourcePath string, output io.Writer) error {
func ParseWithOutput(input io.Reader, sourcePath string, output io.Writer) error {
sources := make([]string, 1)
sources[0] = sourcePath
var r struct{ Packages []gocov.Package }
var totalLines, totalHits int64
err := json.NewDecoder(os.Stdin).Decode(&r)
err := json.NewDecoder(input).Decode(&r)
if err != nil {
return err
}
Expand Down

0 comments on commit 990b0d3

Please sign in to comment.