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

cmd/go: document 'go generate' flags -n -v -x #12544

Closed
dmitshur opened this issue Sep 8, 2015 · 3 comments
Closed

cmd/go: document 'go generate' flags -n -v -x #12544

dmitshur opened this issue Sep 8, 2015 · 3 comments

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Sep 8, 2015

Looking at https://tip.golang.org/cmd/go/#hdr-Generate_Go_files_by_processing_source right now:

Usage:

go generate [-run regexp] [file.go... | packages]

However, at the bottom it mentions:

It also accepts the standard build flags -v, -n, and -x. The -v flag prints the names of packages and files as they are processed. The -n flag prints commands that would be executed. The -x flag prints commands as they are executed.

The usage line should be updated to mention those additional flags:

-go generate [-run regexp] [file.go... | packages]
+go generate [-v] [-n] [-x] [-run regexp] [file.go... | packages]

Other commands have their usage complete and do not skip -n and -x flags that are available, for example:

go clean [-i] [-r] [-n] [-x] [build flags] [packages]
go fmt [-n] [-x] [packages]
go tool [-n] command [args...]
go vet [-n] [-x] [build flags] [packages]
go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]

It seems -v is never included even if available, so maybe it's most consistent to do:

go generate [-n] [-x] [-run regexp] [file.go... | packages]
@dmitshur
Copy link
Contributor Author

dmitshur commented Sep 8, 2015

As a result, I was wishing that go generate would support -n flag without realizing it was available.

@dmitshur
Copy link
Contributor Author

dmitshur commented Sep 8, 2015

Also, go generate does accept at least some of standard build flags (e.g., -tags=foo), so for clarity and consistency that should be included in usage also:

go generate [-n] [-x] [build flags] [-run regexp] [file.go... | packages]

With a note:

It also accepts the standard build flags, as well as -v, -n, and -x. ...

For more about build flags, see 'go help build'.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Sep 8, 2015
@rsc rsc changed the title cmd/go: Documentation for go generate usage doesn't mention other available flags. cmd/go: document 'go generate' flags -n -v -x Nov 5, 2015
@gopherbot
Copy link

CL https://golang.org/cl/17947 mentions this issue.

@rsc rsc closed this as completed in 8fac7e3 Dec 17, 2015
@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants