On Thursday, January 30, 2020 at 10:06:36 PM UTC-8, Ian Lance Taylor wrote:
>
> On Thu, Jan 30, 2020 at 9:43 PM Craig Rodrigues <crod...@gmail.com 
> <javascript:>> wrote: 
> > I see here that this might be related: 
> https://golang.org/doc/go1.13#testing 
> > 
> >           Testing flags are now registered in the new Init function, 
> >           which is invoked by the generated main function for the test. 
> >           As a result, testing flags are now only registered when 
> running 
> >           a test binary, and packages that call flag.Parse during 
> package 
> >           initialization may cause tests to fail. 
> > 
> > But I'm not sure how to move forward to get back the behavior from go 
> 1.12. 
>
> That could well be the problem.  If so, the solution is to not call 
> flag.Parse from an init function. 
>


Ah OK!

So my_test.go , and every test file in my codebase has:

func init() {
        ParseFlags()
}

which calls flag.Parse for a bunch of framework-specific test flags.

How should I restructure this so that I get the "-test.XXX" flags generated 
in the binary,
like I did with go 1.12?

Thanks.

--
Craig

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bded1c69-6d05-4ad3-81c8-2e6b0d19f54f%40googlegroups.com.

Reply via email to