Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/BurntSushi/go-sumtype
/ functions
Functions
37 in github.com/BurntSushi/go-sumtype
⨍
Functions
37
◇
Types & classes
6
↓ 9 callers
Function
run
(pkgs []*packages.Package)
main.go:32
↓ 8 callers
Function
setupPackages
(t *testing.T, code string)
help_test.go:12
↓ 8 callers
Function
teardownPackage
(t *testing.T, dir string)
help_test.go:28
↓ 3 callers
Method
Location
Location returns a short string describing where this declaration was found.
decl.go:28
↓ 3 callers
Method
Names
Names returns a sorted list of names corresponding to the missing variant cases.
check.go:30
↓ 3 callers
Function
missingNames
(t *testing.T, err error)
check_test.go:234
↓ 2 callers
Function
indirect
indirect dereferences through an arbitrary number of pointer types.
def.go:143
↓ 2 callers
Function
tycheckAll
(args []string)
main.go:54
↓ 1 callers
Method
Error
()
def.go:15
↓ 1 callers
Function
check
check does exhaustiveness checking for the given sum type definitions in the given package. Every instance of inexhaustive case analysis is returned.
check.go:41
↓ 1 callers
Function
checkSwitch
checkSwitch performs an exhaustiveness check on the given type switch statement. If the type switch is used on a sum type and does not cover all varia
check.go:65
↓ 1 callers
Function
defaultClauseAlwaysPanics
defaultClauseAlwaysPanics returns true if the given switch statement has a default clause that always panics. Note that this is done on a best-effort
check.go:131
↓ 1 callers
Function
findDef
findDef returns the sum type definition corresponding to the given type. If no such sum type definition exists, then nil is returned.
check.go:175
↓ 1 callers
Function
findSumTypeDecls
findSumTypeDecls searches every package given for sum type declarations of the form `go-sumtype:decl ...`.
decl.go:34
↓ 1 callers
Function
findSumTypeDefs
findSumTypeDefs attempts to find a Go type definition for each of the given sum type declarations. If no such sum type definition could be found for a
def.go:54
↓ 1 callers
Function
findTypeAssertExpr
findTypeAssertExpr extracts the expression that is being type asserted from a type swtich statement.
check.go:163
↓ 1 callers
Function
isSumTypeDecl
isSumTypeDecl returns true if and only if this line in a Go source file is a sum type decl.
decl.go:107
↓ 1 callers
Method
missing
missing returns a list of variants in this sum type that are not in the given list of types.
def.go:123
↓ 1 callers
Function
missingVariantsInSwitch
missingVariantsInSwitch returns a list of missing variants corresponding to the given switch statement. The corresponding sum type definition is also
check.go:85
↓ 1 callers
Function
newSumTypeDef
newSumTypeDef attempts to extract a sum type definition from a single package. If no such type corresponds to the given decl, then this function retur
def.go:78
↓ 1 callers
Function
parseSumTypeDecl
parseSumTypeDecl parses the type name out of a sum type decl. If no such decl could be found, then this returns an empty string.
decl.go:97
↓ 1 callers
Function
sumTypeDeclSearch
sumTypeDeclSearch searches the given file for sum type declarations of the form `go-sumtype:decl ...`.
decl.go:57
↓ 1 callers
Function
switchVariants
switchVariants returns all case expressions found in a type switch. This includes expressions from cases that have a list of expressions.
check.go:112
Method
Error
()
check.go:22
Method
Error
()
def.go:28
Method
Error
()
def.go:38
Method
String
()
def.go:117
Function
TestMissingOne
TestMissingOne tests that we detect a single missing variant.
check_test.go:10
Function
TestMissingOneWithPanic
TestMissingOneWithPanic tests that we detect a single missing variant even if we have a trivial default case that panics.
check_test.go:76
Function
TestMissingTwo
TestMissingTwo tests that we detect a two missing variants.
check_test.go:41
Function
TestNoMissing
TestNoMissing tests that we correctly detect exhaustive case analysis.
check_test.go:109
Function
TestNoMissingDefault
TestNoMissingDefault tests that even if we have a missing variant, a default case should thwart exhaustiveness checking.
check_test.go:141
Function
TestNotFound
TestNotFound tests that we report an error if one tries to declare a sum type that isn't defined.
check_test.go:194
Function
TestNotInterface
TestNotInterface tests that we report an error if one tries to declare a sum type that doesn't correspond to an interface.
check_test.go:214
Function
TestNotSealed
TestNotSealed tests that we report an error if one tries to declare a sum type with an unsealed interface.
check_test.go:172
Function
main
()
main.go:12
Function
pkgFiles
(pkg *ast.Package)
def.go:150