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

unparam -help doesn't print usage. #12

Closed
dmitshur opened this issue Jul 31, 2017 · 4 comments
Closed

unparam -help doesn't print usage. #12

dmitshur opened this issue Jul 31, 2017 · 4 comments

Comments

@dmitshur
Copy link
Contributor

$ unparam -help
Usage of unparam:
  -tests
    	include tests (default true)

That doesn't answer the questions of "what parameters does unparam take? how do I use it? can I specify packages, or does it always use current directory? do I need to give it individual .go files?"

I had to look at the source code and/or guess to figure it out.

Compare with:

$ unconvert -help
usage: unconvert [flags] [package ...]
  -all
    	type check all GOOS and GOARCH combinations
  -apply
    	apply edits to source files
  -cpuprofile string
    	write CPU profile to file
  -safe
    	be more conservative (experimental)
  -v	verbose output

unconvert helpfully tells me that usage is unconvert [flags] [package ...], so I know how to use it.

I think doing this would be sufficient to fix this problem:

$ unparam -help
usage: unparam [flags] [package ...]
  -tests
    	include tests (default true)
@dmitshur
Copy link
Contributor Author

dmitshur commented Jul 31, 2017

staticcheck is even more descriptive/verbose:

$ staticcheck -help
Usage of staticcheck:
	staticcheck [flags] # runs on package in current directory
	staticcheck [flags] packages
	staticcheck [flags] directory
	staticcheck [flags] files... # must be a single package
Flags:
  -generated
    	Check generated code
  -go version
    	Target Go version in the format '1.x' (default 1.9)
  -ignore string
    	Space separated list of checks to ignore, in the following format: 'import/path/file.go:Check1,Check2,...' Both the import path and file name sections support globbing, e.g. 'os/exec/*_test.go'
  -min_confidence float
    	Deprecated; use -ignore instead
  -tags build tags
    	List of build tags
  -tests
    	Include tests (default true)

But I think that'd be overkill for this small tool. usage: unparam [flags] [package ...] would be completely sufficient IMO.

@mvdan
Copy link
Owner

mvdan commented Jul 31, 2017

I agree, and this was just me being lazy - feel free to send a patch. Otherwise, I'll get to it in a few days.

@dmitshur
Copy link
Contributor Author

dmitshur commented Jul 31, 2017

I'll let you get to it, mostly because it's easier for you. I'd have to go through this dance. Thanks!

@mvdan
Copy link
Owner

mvdan commented Jul 31, 2017

I know it's easier and faster for me - but I prefer to let people submit patches before I do, if they wish. Sometimes that leads to non-trivial contributions :)

@mvdan mvdan removed the help wanted label Jul 31, 2017
@mvdan mvdan closed this as completed in 4f8ea7a Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants