-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 818 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
package main
import (
"log"
"os"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/irvinlim/golang-ci/pkg/cmd/lint"
lintInstall "github.com/irvinlim/golang-ci/pkg/cmd/lint-install"
lintInstallAll "github.com/irvinlim/golang-ci/pkg/cmd/lint-install-all"
)
func main() {
Run()
}
type stackTracer interface {
StackTrace() errors.StackTrace
}
var rootCmd = &cobra.Command{
Use: "golang-ci",
Short: "CI tool for Golang",
}
func init() {
rootCmd.AddCommand(lint.Command)
rootCmd.AddCommand(lintInstall.Command)
rootCmd.AddCommand(lintInstallAll.Command)
}
func Run() {
if err := rootCmd.Execute(); err != nil {
log.Printf("Error encountered: %v\n", err)
if err, ok := err.(stackTracer); ok {
log.Println("Traceback:")
log.Printf("%+v\n", err.StackTrace())
}
os.Exit(1)
}
}