Documentation ¶
Overview ¶
Package lint contains a linter for Go source code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCheckstyleReporter ¶
func NewCheckstyleReporter(indent bool) *checkstyleReporter
NewCheckstyleReporter creates initialized Checkstyle report generator
Types ¶
type Config ¶
type Config struct { Package bool `json:"package"` Imports bool `json:"imports"` Names bool `json:"names"` Exported bool `json:"exported"` VarDecls bool `json:"var-decls"` Elses bool `json:"elses"` MakeSlice bool `json:"make-slice"` ErrorReturn bool `json:"error-return"` IgnoredReturn bool `json:"ignored-return"` PackageUnderscore bool `json:"package-underscore"` NamedReturn bool `json:"named-return"` PackagePrefixNames bool `json:"package-prefix-names"` Ranges bool `json:"ranges"` ReceiverNames bool `json:"receiver-names"` Errorf bool `json:"errorf"` Errors bool `json:"errors"` ErrorStrings bool `json:"error-strings"` IncDec bool `json:"inc-dec"` MinConfidence float64 `json:"min-confidence"` IgnoreFiles []string `json:"ignore-files"` IgnorePackages []string `json:"ignore-packages"` IgnoreTypes []string `json:"ignore-types"` Initialisms map[string]bool `json:"initialisms"` BadReceiverNames map[string]bool `json:"bad-receivers"` // contains filtered or unexported fields }
Config defines configuration options for linter
func NewConfig ¶
NewConfig reads config from given file. If filename is empty, default config will be returned
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates linter config with predefined options
type PlainReporter ¶
type PlainReporter struct {
// contains filtered or unexported fields
}
PlainReporter defines reporter that output problems as plain text
func (*PlainReporter) Collect ¶
func (r *PlainReporter) Collect(ps []Problem)
Collect receives problems for further report generation
func (*PlainReporter) Flush ¶
func (r *PlainReporter) Flush() (report string, err error)
Flush outputs collected problems one by one in plain text Expect no errors here
func (*PlainReporter) NumProblems ¶
func (r *PlainReporter) NumProblems() int
type Problem ¶
type Problem struct { File string // name of the sourcefile Position token.Position // position in source file Text string // the prose that describes the problem Link string // (optional) the link to the style guide for the problem Confidence float64 // a value in (0,1] estimating the confidence in this problem's correctness LineText string // the source line Category string // a short name for the general category of the problem }
Problem represents a problem in some source code.
Click to show internal directories.
Click to hide internal directories.