oss.indeed.com/go/go-opine@v1.3.0/internal/gotest/doc.go (about) 1 // Package gotest runs "go test -v -json" and interprets the result. 2 // 3 // This package contains a LOT of code to 4 // 5 // 1. reassemble test events into test results (each test is reported as 6 // a bunch of "output" actions followed by a "pass", "fail", or "skip" 7 // action), and 8 // 2. order the results so that when printed each test can be easily 9 // associated with the package it is in. 10 // 11 // However, all of the above complexity is hidden behind a relatively 12 // simple API. Here is an example: 13 // 14 // var verboseOutput bytes.Buffer 15 // err := gotest.Run( 16 // gotest.QuietOutput(os.Stdout), 17 // gotest.VerboseOutput(&verboseOutput), 18 // ) 19 // 20 // The above example also shows why we use "go test -v -json" at all: we 21 // want to be able to construct both the verbose output (for generating 22 // the JUnit XML) and the quiet output (for printing to the console as the 23 // tests run). 24 // 25 // Note that output is held in memory for buffered results. Since "go test" 26 // also buffers output this is not likely to be an issue, but if it is we may 27 // want to consider compressing the output. 28 package gotest