intcast

package module
v0.0.0-...-846b08a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 10 Imported by: 0

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "intcast",
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
		commentmap.Analyzer,
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL