Skip to content

gostaticanalysis/typeswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typeswitch

godoc.org

typeswitch finds a type which implement an interfaces which are used in type-switch but the type does not appear in any cases of the type-switch.

package main

type I interface{ F() }
type A struct{I} // implements I
type B struct{I} // implements I

func main() {
	var i I = A{}
	switch i.(type) {
	case A:
	}
}
$go vet -vettool=`which typeswitch` main.go
./main.go:9:2: type B does not appear in any cases

About

Analyzer: typeswitch finds a type which implement an interfaces which are used in type-switch but the type does not appear in a ny cases of the type-switch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages