-
Notifications
You must be signed in to change notification settings - Fork 353
/
main.go
35 lines (30 loc) · 874 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
package main
import (
"fmt"
"os"
"path"
"runtime"
"strings"
colorable "github.com/mattn/go-colorable"
"github.com/terraform-linters/tflint/cmd"
)
func main() {
cli := cmd.NewCLI(colorable.NewColorable(os.Stdout), colorable.NewColorable(os.Stderr))
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "Panic: %v\n", r)
for depth := 0; ; depth++ {
pc, src, line, ok := runtime.Caller(depth)
if !ok {
break
}
fmt.Fprintf(os.Stderr, " -> %d: %s: %s(%d)\n", depth, runtime.FuncForPC(pc).Name(), strings.Replace(src, path.Dir(src), "", 1), line)
}
fmt.Fprintln(os.Stderr, `
TFLint crashed... :(
Please attach an output log, describe the situation and version that occurred and post an issue to https://github.com/terraform-linters/tflint/issues`)
os.Exit(cmd.ExitCodeError)
}
}()
os.Exit(cli.Run(os.Args))
}