.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / cmd / staticcheck / staticcheck.go
1 // staticcheck analyses Go code and makes it better.
2 package main
3
4 import (
5         "log"
6         "os"
7
8         "golang.org/x/tools/go/analysis"
9         "honnef.co/go/tools/lintcmd"
10         "honnef.co/go/tools/simple"
11         "honnef.co/go/tools/staticcheck"
12         "honnef.co/go/tools/stylecheck"
13         "honnef.co/go/tools/unused"
14 )
15
16 func main() {
17         fs := lintcmd.FlagSet("staticcheck")
18         debug := fs.String("debug.unused-graph", "", "Write unused's object graph to `file`")
19         fs.Parse(os.Args[1:])
20
21         var cs []*analysis.Analyzer
22         for _, v := range simple.Analyzers {
23                 cs = append(cs, v)
24         }
25         for _, v := range staticcheck.Analyzers {
26                 cs = append(cs, v)
27         }
28         for _, v := range stylecheck.Analyzers {
29                 cs = append(cs, v)
30         }
31
32         cs = append(cs, unused.Analyzer)
33         if *debug != "" {
34                 f, err := os.OpenFile(*debug, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
35                 if err != nil {
36                         log.Fatal(err)
37                 }
38                 unused.Debug = f
39         }
40
41         lintcmd.ProcessFlagSet(cs, fs)
42 }