itervar

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 6 Imported by: 0

README

itervar

itervar is a static analysis tool that detects references to loop iterator variable.

test_and_lint Go Report Card

Features

Detect code using reference to loop iterator variable, a common mistake in Go.

https://github.com/golang/go/wiki/CommonMistakes#using-reference-to-loop-iterator-variable

Example
func forLoop() {
	var out []*int
	for i := 0; i < 3; i++ {
		fmt.Println(i)
		out = append(out, &i) // want "using reference to loop iterator variable"
	}
}

Installation

go get
GO111MODULE=off go get github.com/p1ass/itervar/cmd/itervar

Usage

go vet -vettool=`which itervar` ./...

Documentation

Index

Constants

This section is empty.

Variables

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