The Wayback Machine - https://web.archive.org/web/20201028045258/https://github.com/cweill/gotests/issues/133
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a -version flag to differentiate two gotests binaries #133

Open
lepinkainen opened this issue Jun 21, 2020 · 0 comments
Open

Add a -version flag to differentiate two gotests binaries #133

lepinkainen opened this issue Jun 21, 2020 · 0 comments

Comments

@lepinkainen
Copy link

@lepinkainen lepinkainen commented Jun 21, 2020

I have two setups, in one the -parallel option works just fine in vscode - it generates parallel test cases as it should. In the other it doesn't do anything (not reporting errors in custom flags is a problem in the vscode go plugin, which is not the issue here).

Both were installed with go get -u github.com/cweill/gotests/... when in the $HOME directory within 15 minutes of each other.

One installation looks like this (go version go1.14.3 darwin/amd64) - no -parallel option

Usage of gotests:
  -all
    	generate tests for all functions and methods
  -excl string
    	regexp. generate tests for functions and methods that don't match. Takes precedence over -only, -exported, and -all
  -exported
    	generate tests for exported functions and methods. Takes precedence over -only and -all
  -i	print test inputs in error messages
  -nosubtests
    	disable generating tests using the Go 1.7 subtests feature
  -only string
    	regexp. generate tests for functions and methods that match only. Takes precedence over -all
  -template string
    	optional. Specify custom test code templates, e.g. testify
  -template_dir string
    	optional. Path to a directory containing custom test code templates. Takes precedence over -template
  -template_params string
    	read external parameters to template by json with stdin
  -template_params_file string
    	read external parameters to template by json with file
  -w	write output to (test) files instead of stdout

The other like this (go version go1.13.8 linux/amd64) - -parallel found and works perfectly

Usage of ./gotests:
  -all
    	generate tests for all functions and methods
  -excl string
    	regexp. generate tests for functions and methods that don't match. Takes precedence over -only, -exported, and -all
  -exported
    	generate tests for exported functions and methods. Takes precedence over -only and -all
  -i	print test inputs in error messages
  -nosubtests
    	disable generating tests using the Go 1.7 subtests feature
  -only string
    	regexp. generate tests for functions and methods that match only. Takes precedence over -all
  -parallel
    	enable generating parallel subtests
  -template string
    	optional. Specify custom test code templates, e.g. testify. This can also be set via environment variable GOTESTS_TEMPLATE
  -template_dir string
    	optional. Path to a directory containing custom test code templates. Takes precedence over -template. This can also be set via environment variable GOTESTS_TEMPLATE_DIR
  -template_params string
    	read external parameters to template by json with stdin
  -template_params_file string
    	read external parameters to template by json with file
  -w	write output to (test) files instead of stdout

Took me a LONG while to figure out why vscode was generating parallel tests on one and not on the other... There is no way to differentiate the two installs except by manually comparing the help texts - which themselves only appear when giving a faulty flag. Just running gotests by itself gives the exact same defaults on both installations.

It would be really useful to have a -version flag in gotests to debug these issues and maybe make it possible for plugins like the Go vscode plugin to determine if some options are available or not.

Bonus question: why did both platforms and go versions get a completely different version of gotests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.