Categorygithub.com/qawatake/intcast
repositorypackage
0.0.0-20231020142052-846b08a39076
Repository: https://github.com/qawatake/intcast.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

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 ./...