-
Notifications
You must be signed in to change notification settings - Fork 17
/
main.go
44 lines (39 loc) · 946 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"os"
"runtime"
"github.com/urfave/cli/v2"
"github.com/elza2/go-cyclic/action"
)
var (
version = "v1.1.0"
serviceName = "go-cyclic"
commands = []*cli.Command{
{
Name: "run",
Usage: "run tool for check circular references",
Action: action.CheckCyclic,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "dir",
Usage: "destination file address, must be in the same directory as the go.mod file",
},
&cli.StringFlag{
Name: "filter",
Usage: "filter the specified file, the wildcard mode is supported, eg: *_test.go",
},
},
},
}
)
func main() {
app := cli.NewApp()
app.Name = serviceName
app.Usage = "a tool to check the go application for circular references"
app.Version = fmt.Sprintf("%s %s/%s", version, runtime.GOOS, runtime.GOARCH)
app.Commands = commands
if err := app.Run(os.Args); err != nil {
fmt.Printf("go-cyclic: %+v\n", err)
}
}