package config
import "honnef.co/go/tools/config"
Index ¶
Variables ¶
var Analyzer = &analysis.Analyzer{ Name: "config", Doc: "loads configuration for the current package tree", Run: func(pass *analysis.Pass) (interface{}, error) { if len(pass.Files) == 0 { cfg := DefaultConfig return &cfg, nil } cache, err := os.UserCacheDir() if err != nil { cache = "" } var path string for _, f := range pass.Files { p := pass.Fset.PositionFor(f.Pos(), true).Filename if cache != "" && strings.HasPrefix(p, cache) { continue } path = p break } if path == "" { cfg := DefaultConfig return &cfg, nil } dir := filepath.Dir(path) cfg, err := Load(dir) if err != nil { return nil, fmt.Errorf("error loading staticcheck.conf: %s", err) } return &cfg, nil }, RunDespiteErrors: true, ResultType: reflect.TypeOf((*Config)(nil)), }
var DefaultConfig = Config{ Checks: []string{"all", "-ST1000", "-ST1003", "-ST1016"}, Initialisms: []string{ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", }, DotImportWhitelist: []string{}, HTTPStatusCodeWhitelist: []string{"200", "400", "404", "500"}, }
Types ¶
type Config ¶
type Config struct { Checks []string `toml:"checks"` Initialisms []string `toml:"initialisms"` DotImportWhitelist []string `toml:"dot_import_whitelist"` HTTPStatusCodeWhitelist []string `toml:"http_status_code_whitelist"` }
func For ¶
func Load ¶
func (Config) Merge ¶
Source Files ¶
config.go
- Version
- v0.0.0-2019.2
- Published
- Jun 24, 2019
- Platform
- darwin/amd64
- Imports
- 7 packages
- Last checked
- 39 minutes ago –
Tools for package owners.