@@ -71,28 +71,26 @@ type I struct {
7171 colorful bool
7272}
7373
74- var isColorful bool
74+ var noColorFlag bool
7575
7676func init () {
77- noColor := flag .Bool ("nocolor" , false , "turns off colors" )
78- flag .Parse ()
79- isColorful = ! * noColor
77+ flag .BoolVar (& noColorFlag , "nocolor" , false , "turns off colors" )
8078}
8179
8280// New makes a new testing helper using the specified
8381// T through which failures will be reported.
8482// In strict mode, failures call T.FailNow causing the test
8583// to be aborted. See NewRelaxed for alternative behavior.
8684func New (t T ) * I {
87- return & I {t , t .FailNow , os .Stdout , isColorful }
85+ return & I {t , t .FailNow , os .Stdout , ! noColorFlag }
8886}
8987
9088// NewRelaxed makes a new testing helper using the specified
9189// T through which failures will be reported.
9290// In relaxed mode, failures call T.Fail allowing
9391// multiple failures per test.
9492func NewRelaxed (t T ) * I {
95- return & I {t , t .Fail , os .Stdout , isColorful }
93+ return & I {t , t .Fail , os .Stdout , ! noColorFlag }
9694}
9795
9896func (is * I ) log (args ... interface {}) {
0 commit comments