On Thu, Jan 30, 2020 at 9:43 PM Craig Rodrigues <crodr...@gmail.com> wrote: > > I ran a quick experiment in my source tree, and saw a difference in > the behavior of "go test -c" between go 1.12 and go 1.13. > > EXPERIMENT 1: using docker image golang:1.12-alpine with go1.12.16 > linux/amd64 > ---------------------------------------------------------------------------------------------------------------------- > go test -o my_test -c my_test.go > > my_test --help > > I see this flag: > -test.timeout d > panic test binary after duration d (default 0, timeout disabled) > > EXPERIMENT 2: using docker image golang:1.13-alpine with go1.13.7 linux/amd64 > ---------------------------------------------------------------------------------------------------------------------- > go tet -o my_test -c my_test.go > > my_test --help > > The -test.timeout flag is not there. In fact all the -test.timeout flags are > gone. > > Is there a way that I can get back these -test.XXX flags with go1.13 and > higher? > > 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. Ian -- 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/CAOyqgcX17r08MT5JuUT-m5sHtbOgW5auXKQ3TH9i72oRoiwHtg%40mail.gmail.com.