/usr/share/gocode/src/github.com/smartystreets/goconvey/convey/wiring.go is in golang-github-smartystreets-goconvey-dev 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | package convey
import (
"os"
"github.com/smartystreets/goconvey/reporting"
)
func init() {
parseFlags()
suites = NewSuiteContext()
}
// parseFlags parses the command line args manually because the go test tool,
// which shares the same process space with this code, already defines
// the -v argument (verbosity) and we can't feed in a custom flag to old-style
// go test packages (like -json, which I would prefer). So, we use the timeout
// flag with a value of -42 to request json output. My deepest sympothies.
func parseFlags() {
verbose = flagFound(verboseEnabledValue)
json = flagFound(jsonEnabledValue)
}
func flagFound(flagValue string) bool {
for _, arg := range os.Args {
if arg == flagValue {
return true
}
}
return false
}
func buildReporter() reporting.Reporter {
if testReporter != nil {
return testReporter
} else if json {
return reporting.BuildJsonReporter()
} else if verbose {
return reporting.BuildStoryReporter()
} else {
return reporting.BuildDotReporter()
}
}
var (
suites *SuiteContext
// only set by internal tests
testReporter reporting.Reporter
)
var (
json bool
verbose bool
)
const verboseEnabledValue = "-test.v=true"
const jsonEnabledValue = "-test.timeout=-42s" // HACK! (see parseFlags() above)
|