Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qawatake/intcast

Analyzer: intcast finds integer type cast that can cause overflow
https://github.com/qawatake/intcast

go golang linter staticanalysis

Last synced: about 1 month ago
JSON representation

Analyzer: intcast finds integer type cast that can cause overflow

Awesome Lists containing this project

README

        

# intcast

`intcast` identifies integer type casts that can potentially cause overflow.

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

`intcast` also handles casts on defined types.

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

`intcast` ignores lines with ignore comments.

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

## How to use

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