golint or go vet; flagging case statements that are suspect

295 views
Skip to first unread message

Joshua Boelter

unread,
Sep 26, 2014, 10:45:50 AM9/26/14
to golan...@googlegroups.com

I wrote a test for golint to detect switch case statements that may be suspect. I realize that this is perfectly normal in Go, it's also completely opposite C which has caught me a few times now.  As a style thing, I prefer to make it explicit w/ a break.  The pull request was closed as wontfix.

I ran this across a wide range of packages and didn't find any obvious failures, although a good number of false positives appear. They generally appear to be an intentional use of the lack of implicit fallthrough (at least when commented). Others are suspect.

(Note: I did not commit golint.go w/ a new package reference if you're testing this)



Any interest in keeping this alive or making a patch for go vet?

Rob Pike

unread,
Sep 26, 2014, 10:57:31 AM9/26/14
to Joshua Boelter, golan...@googlegroups.com
No interest in adding support for this to the tools. It's just a
difference from C one must learn.

-rob
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages