unitconst

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 19 Imported by: 2

README

unitconst

pkg.go.dev

unitconst finds using a untyped constant without a unit.

duration := 5 // 5 * time.Second is correct
time.Sleep(duration)
$ go vet -vettool=`which unitconst` -unitconst.type="time.Duration" main.go
./main.go:6:13: must not use a untyped constant without a unit

The default value of unitconst.type option is time.Duration. unitconst.type accepts comma separated value such as time.Duration, unit.Length.

Documentation

Index

Constants

This section is empty.

Variables

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

Analyzer finds using untyped constant as specified type.

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