staticcheck

package
v0.0.0-...-14bc36d Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package staticcheck contains a linter for Go source code.

Index

Constants

View Source
const (
	MsgInvalidHostPort = "invalid port or service name in host:port pair"
	MsgInvalidUTF8     = "argument is not a valid UTF-8 encoded string"
	MsgNonUniqueCutset = "cutset contains duplicate characters"
)

Variables

This section is empty.

Functions

func CanBinaryMarshal

func CanBinaryMarshal(j *lint.Job, v Value) bool

func ConvertedFrom

func ConvertedFrom(v Value, typ string) bool

ConvertedFrom reports whether value v was converted from type typ.

func ConvertedFromInt

func ConvertedFromInt(v Value) bool

func IntValue

func IntValue(v Value, z vrp.Z) bool

func InvalidUTF8

func InvalidUTF8(v Value) bool

func Pointer

func Pointer(v Value) bool

func StaticCheck

func StaticCheck(projectPath map[string]string) []string

func UnbufferedChannel

func UnbufferedChannel(v Value) bool

func UniqueStringCutset

func UniqueStringCutset(v Value) bool

func ValidHostPort

func ValidHostPort(v Value) bool

func ValidateRegexp

func ValidateRegexp(v Value) error

func ValidateTimeLayout

func ValidateTimeLayout(v Value) error

func ValidateURL

func ValidateURL(v Value) error

Types

type Argument

type Argument struct {
	Value Value
	// contains filtered or unexported fields
}

func (*Argument) Invalid

func (arg *Argument) Invalid(msg string)

type Call

type Call struct {
	Job   *lint.Job
	Instr ssa.CallInstruction
	Args  []*Argument

	Checker *Checker
	Parent  *ssa.Function
	// contains filtered or unexported fields
}

func (*Call) Invalid

func (c *Call) Invalid(msg string)

type CallCheck

type CallCheck func(call *Call)

func RepeatZeroTimes

func RepeatZeroTimes(name string, arg int) CallCheck

type Checker

type Checker struct {
	CheckGenerated bool
	// contains filtered or unexported fields
}

func NewChecker

func NewChecker() *Checker

func (*Checker) CheckArgOverwritten

func (c *Checker) CheckArgOverwritten(j *lint.Job)

func (*Checker) CheckBenchmarkN

func (c *Checker) CheckBenchmarkN(j *lint.Job)

func (*Checker) CheckCanonicalHeaderKey

func (c *Checker) CheckCanonicalHeaderKey(j *lint.Job)

func (*Checker) CheckConcurrentTesting

func (c *Checker) CheckConcurrentTesting(j *lint.Job)

func (*Checker) CheckCyclicFinalizer

func (c *Checker) CheckCyclicFinalizer(j *lint.Job)

func (*Checker) CheckDeferInInfiniteLoop

func (c *Checker) CheckDeferInInfiniteLoop(j *lint.Job)

func (*Checker) CheckDeferLock

func (c *Checker) CheckDeferLock(j *lint.Job)

func (*Checker) CheckDeprecated

func (c *Checker) CheckDeprecated(j *lint.Job)

func (*Checker) CheckDiffSizeComparison

func (c *Checker) CheckDiffSizeComparison(j *lint.Job)

func (*Checker) CheckDoubleNegation

func (c *Checker) CheckDoubleNegation(j *lint.Job)

func (*Checker) CheckDubiousDeferInChannelRangeLoop

func (c *Checker) CheckDubiousDeferInChannelRangeLoop(j *lint.Job)

func (*Checker) CheckEarlyDefer

func (c *Checker) CheckEarlyDefer(j *lint.Job)

func (*Checker) CheckEmptyBranch

func (c *Checker) CheckEmptyBranch(j *lint.Job)

func (*Checker) CheckEmptyCriticalSection

func (c *Checker) CheckEmptyCriticalSection(j *lint.Job)

func (*Checker) CheckExec

func (c *Checker) CheckExec(j *lint.Job)

func (*Checker) CheckFlagUsage

func (c *Checker) CheckFlagUsage(j *lint.Job)

func (*Checker) CheckIneffectiveAppend

func (c *Checker) CheckIneffectiveAppend(j *lint.Job)

func (*Checker) CheckIneffectiveCopy

func (c *Checker) CheckIneffectiveCopy(j *lint.Job)

func (*Checker) CheckIneffectiveFieldAssignments

func (c *Checker) CheckIneffectiveFieldAssignments(j *lint.Job)

func (*Checker) CheckIneffectiveLoop

func (c *Checker) CheckIneffectiveLoop(j *lint.Job)

func (*Checker) CheckInfiniteEmptyLoop

func (c *Checker) CheckInfiniteEmptyLoop(j *lint.Job)

func (*Checker) CheckInfiniteRecursion

func (c *Checker) CheckInfiniteRecursion(j *lint.Job)

func (*Checker) CheckLeakyTimeTick

func (c *Checker) CheckLeakyTimeTick(j *lint.Job)

func (*Checker) CheckLhsRhsIdentical

func (c *Checker) CheckLhsRhsIdentical(j *lint.Job)

func (*Checker) CheckLoopCondition

func (c *Checker) CheckLoopCondition(j *lint.Job)

func (*Checker) CheckLoopEmptyDefault

func (c *Checker) CheckLoopEmptyDefault(j *lint.Job)

func (*Checker) CheckMapBytesKey

func (c *Checker) CheckMapBytesKey(j *lint.Job)

func (*Checker) CheckNaNComparison

func (c *Checker) CheckNaNComparison(j *lint.Job)

func (*Checker) CheckNilContext

func (c *Checker) CheckNilContext(j *lint.Job)

func (*Checker) CheckNilMaps

func (c *Checker) CheckNilMaps(j *lint.Job)

func (*Checker) CheckNonOctalFileMode

func (c *Checker) CheckNonOctalFileMode(j *lint.Job)

func (*Checker) CheckPredeterminedBooleanExprs

func (c *Checker) CheckPredeterminedBooleanExprs(j *lint.Job)

func (*Checker) CheckPureFunctions

func (c *Checker) CheckPureFunctions(j *lint.Job)

func (*Checker) CheckRangeStringRunes

func (c *Checker) CheckRangeStringRunes(j *lint.Job)

func (*Checker) CheckRepeatedIfElse

func (c *Checker) CheckRepeatedIfElse(j *lint.Job)

func (*Checker) CheckScopedBreak

func (c *Checker) CheckScopedBreak(j *lint.Job)

func (*Checker) CheckSeeker

func (c *Checker) CheckSeeker(j *lint.Job)

func (*Checker) CheckSillyBitwiseOps

func (c *Checker) CheckSillyBitwiseOps(j *lint.Job)

func (*Checker) CheckSliceOutOfBounds

func (c *Checker) CheckSliceOutOfBounds(j *lint.Job)

func (*Checker) CheckTemplate

func (c *Checker) CheckTemplate(j *lint.Job)

func (*Checker) CheckTestMainExit

func (c *Checker) CheckTestMainExit(j *lint.Job)

func (*Checker) CheckTimeSleepConstant

func (c *Checker) CheckTimeSleepConstant(j *lint.Job)

func (*Checker) CheckUnreadVariableValues

func (c *Checker) CheckUnreadVariableValues(j *lint.Job)

func (*Checker) CheckUnsafePrintf

func (c *Checker) CheckUnsafePrintf(j *lint.Job)

func (*Checker) CheckUnsignedComparison

func (c *Checker) CheckUnsignedComparison(j *lint.Job)

func (*Checker) CheckUntrappableSignal

func (c *Checker) CheckUntrappableSignal(j *lint.Job)

func (*Checker) CheckWaitgroupAdd

func (c *Checker) CheckWaitgroupAdd(j *lint.Job)

func (*Checker) CheckWriterBufferModified

func (c *Checker) CheckWriterBufferModified(j *lint.Job)

func (*Checker) Funcs

func (c *Checker) Funcs() map[string]lint.Func

func (*Checker) Init

func (c *Checker) Init(prog *lint.Program)

type Value

type Value struct {
	Value ssa.Value
	Range vrp.Range
}

Directories

Path Synopsis
Package callgraph defines the call graph and various algorithms and utilities to operate on it.
Package callgraph defines the call graph and various algorithms and utilities to operate on it.
cha
Package cha computes the call graph of a Go program using the Class Hierarchy Analysis (CHA) algorithm.
Package cha computes the call graph of a Go program using the Class Hierarchy Analysis (CHA) algorithm.
rta
This package provides Rapid Type Analysis (RTA) for Go, a fast algorithm for call graph construction and discovery of reachable code (and hence dead code) and runtime types.
This package provides Rapid Type Analysis (RTA) for Go, a fast algorithm for call graph construction and discovery of reachable code (and hence dead code) and runtime types.
static
Package static computes the call graph of a Go program containing only static call edges.
Package static computes the call graph of a Go program containing only static call edges.
Package gcsizes provides a types.Sizes implementation that adheres to the rules used by the gc compiler.
Package gcsizes provides a types.Sizes implementation that adheres to the rules used by the gc compiler.
internal

Jump to

Keyboard shortcuts

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