linter

package
v0.0.0-...-0ad2128 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

Linter

The linter searches the codebase for code that has been identified as bad patterns.

Usage

    go run cmd/linter/main.go [--locks-only=<true|false>]
--path=<path/subpath|path/...>...

The output contains the pattern matched, the file/line number/column and a snippet of the code surrounding the matched pattern.

The flags that can be passed to the linter are:

Flag Required Description
--path Yes The directory to search in, relative to the gopath. Multiple allowed. In form '// or ___/...'
--locks-only Yes Only output matched patterns that include locks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileFilter

func FileFilter(f os.FileInfo) bool

func FuncDecls

func FuncDecls(f *ast.File) []*ast.FuncDecl

FuncDecls returns all the function declarations in a file.

func PrintProblem

func PrintProblem(filename string, p Problem) error

Types

type Problem

type Problem struct {
	Kind string
	token.Position
}

Problem represents a problem found in the source code.

func CheckFuncs

func CheckFuncs(funcs []*ast.FuncDecl, fset *token.FileSet, locksOnly bool) []Problem

CheckFuncs returns where there are problems given a set of potentially bad function declarations.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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