Skip to content

Exhaustive-enum is an exhaustive enum checker for Go. It can be used to make sure you don't miss any cases when switching over an enumeration.

Notifications You must be signed in to change notification settings

bouk/exhaustive-enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exhaustive-enum

Exhaustive-enum is an exhaustive enum checker for Go. It can be used to make sure you don't miss any cases when switching over an enumeration.

Method

Find switch statements. For each:

  • Find type of expression being switched over.
  • Verify if the type is an enum:
    1. exhaustive-enum annotation.
    2. Type has to be a value type (not struct/interface).
    3. Find all exported values in the package of the type definition.
  • Verify that all the enum cases are in the switch, or that there's a default case.

About

Exhaustive-enum is an exhaustive enum checker for Go. It can be used to make sure you don't miss any cases when switching over an enumeration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages