ginkgo: Ginkgo panics when using the Table extension

see https://sunrise.ci.cf-app.com/pipelines/pivnet-resource/jobs/test/builds/135

[2] /tmp/ginkgo371214560/validator.test flag redefined: ginkgo.seed
[2] panic: /tmp/ginkgo371214560/validator.test flag redefined: ginkgo.seed

I see the same thing when locally when not running in parallel.

This is running golang 1.6 and I believe the behavior is not observed on golang 1.5 as I have used the Table extension in other projects on golang 1.5 without issue.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Sigh… Go. The hackery that went into the vendor experiment continues to blindside people (also flags and ginkgo both use global state, so caveat emptor).

OK this makes sense @robdimsdale - if ginkgo is vendored but /table isn’t vendored and ginkgo happens to be under your $GOPATH then go will pull in the package under $GOPATH/github.com/onsi/ginkgo/extensions/table which will import the package under $GOPATH/github.com/onsi/ginkgo which runs the init() function and registers the flags globally.

But go will pull in the ginkgo package for your test suite from VENDOR_PATH/github.com/onsi/ginkgo. This will be a different package from the $GOPATH one and go will run it’s init() function too (normally the init() function for a package is only run once - but these are treated like two different packages).

The two init()s call the flag package to register ginkgo.seeds and kaboom

bizzare. i took your example and tried it on my machine running go 1.6 (brew installed) and it works for me… have you cleared your $GOPATH/pkg?