retnilnil

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 8 Imported by: 0

README

retnilnil

Go Reference Test

retnilnil is a static analysis tool for Golang that detects return nil, nil in functions with (*T, error) as the return type.

func f() (*T, error) {
	return nil, nil // retnilnil detects this
}

retnilnil ignores a code which has an ignore comment.

func f() (*T, error) {
	//lint:ignore retnilnil reason
	return nil, nil // retnilnil doesn't detect this
}

retnilnil also ignores a function that has a comment includes nil, nil.

// f always returns `nil, nil`
func f() (*T, error) {
	return nil, nil // retnilnil doesn't detect this
}

Install

You can get retnilnil by go install command (Go 1.16 and higher).

$ go install github.com/neglect-yp/retnilnil/cmd/retnilnil@v0.2.0

How to use

$ retnilnil ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: name,
	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