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

x/tools/cmd/vet: complain about incomplete switch statements #5469

Closed
robpike opened this issue May 14, 2013 · 10 comments
Closed

x/tools/cmd/vet: complain about incomplete switch statements #5469

robpike opened this issue May 14, 2013 · 10 comments

Comments

@robpike
Copy link
Contributor

robpike commented May 14, 2013

From the mailing list:

A year ago, around Google I/O, we were talking about Go
wishlist items and it came up that some people miss having
a compiler that checks switch case coverage (like some C
compilers do with enums). As I recall, Rob said it doesn't
belong in the compiler (naturally) but would be a good
addition to go vet.

Not sure about the details, but I think the general idea would
be to have go vet report a problem when some but not all
values from a const block are used as cases in a switch.
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 1:

I hope this never happens, at least not by default. I hate when C and C++ compilers
whine about me using a switch statement to look for just a few values.

@robpike
Copy link
Contributor Author

robpike commented Jul 30, 2013

Comment 2:

This is a feature request for vet, not the compilers.  Maybe that mitigates enough to be
worthwhile, although I too dislike the C++ warnings (along with many others).

@rsc
Copy link
Contributor

rsc commented Jul 31, 2013

Comment 3:

I know, but things that vet complains about have a way of becoming verboten. I am sure
that if it ends up in vet someone will start sending me CLs "fixing" my code.

@robpike
Copy link
Contributor Author

robpike commented Jul 31, 2013

Comment 4:

Then just say no.
I'm not arguing for this feature, but if vet becomes law I'd rather delete it than fight
the users.

@rsc
Copy link
Contributor

rsc commented Jul 31, 2013

Comment 5:

Okay. If it happens I will send a link to the previous comment. :-)

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added repo-tools.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/vet: complain about incomplete switch statements x/tools/cmd/vet: complain about incomplete switch statements Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@robpike
Copy link
Contributor Author

robpike commented May 7, 2015

Decided not to do this.

@robpike robpike closed this as completed May 7, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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