nilmiru

package module
v0.0.0-...-1be15eb Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 5 Imported by: 0

README

nilmiru

CI

nilmiru is a static analysis tool that detects nil check leakage in function.

Features

Points out nil check leakage in function. If the check is leaked, the function may cause panic.

Example

nilmiru points out nil check leakage.

func slice_invalid(s []string) bool {
	s[0] = "a" // want "nil check leakage"
	return true
}
Constrains
  • For now, nilmiru only checks the type of pointer(*hoge) and slice([]hoge), so it can not check composite type field.
  • nilmiru forces to do nil check even though the code is valid like below.
func slice_valid_range(s []string) bool{
	for i := range s{ // want "nil check leakage"
		s[i] = "a" // want "nil check leakage"
		return true
	}
	return false
}

How to use

$ go install github.com/speed1313/nilmiru/cmd/nilmiru
$ go vet -vettool=$(which nilmiru) ./...

Documentation

Index

Constants

This section is empty.

Variables

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

Analyzer is ...

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