Skip to content

Analyzer: intcast finds integer type cast that can cause overflow

License

Notifications You must be signed in to change notification settings

qawatake/intcast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

intcast

intcast identifies integer type casts that can potentially cause overflow.

func f(i int) uint {
  return uint(i) // unsafe cast
}

intcast also handles casts on defined types.

type MyInt int
func f(i MyInt) uint {
  return uint(i) // unsafe cast
}

intcast ignores lines with ignore comments.

func f(i int) uint {
  //lint:ignore intcast reason
  return uint(i)
}

How to use

go install github.com/qawatake/intcast/cmd/intcast@latest
intcast ./...

About

Analyzer: intcast finds integer type cast that can cause overflow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published