R002

package
v0.0.0-...-9d70a79 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

README

R002

The R002 analyzer reports likely extraneous uses of star (*) dereferences for a Set() call. The Set() function automatically handles pointers and * dereferences without nil checks can panic.

Flagged Code

var stringPtr *string

d.Set("example", *stringPtr)

Passing Code

var stringPtr *string

d.Set("example", stringPtr)

Ignoring Reports

Singular reports can be ignored by adding the a //lintignore:R002 Go code comment at the end of the offending line or on the line immediately proceding, e.g.

var stringPtr *string

//lintignore:R002
d.Set("example", *stringPtr)

Documentation

Overview

Package R002 defines an Analyzer that checks for ResourceData.Set() calls using * dereferences

Index

Constants

View Source
const Doc = `` /* 247-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		resourcedatasetcallexpr.Analyzer,
		commentignore.Analyzer,
	},
	Run: run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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