()
| 24 | } |
| 25 | |
| 26 | func main() { |
| 27 | if len(os.Args) < 2 { |
| 28 | printUsageAndExit() |
| 29 | } |
| 30 | |
| 31 | command := os.Args[1] |
| 32 | |
| 33 | if len(os.Args) == 4 && os.Args[2] == "--test" { |
| 34 | setTestApplication(os.Args[3]) |
| 35 | } else if len(os.Args) != 2 { |
| 36 | printUsageAndExit() |
| 37 | } |
| 38 | |
| 39 | sentryDsn, err := getEnv("SENTRY_DSN") |
| 40 | if err != nil && !isTesting() { |
| 41 | log.Fatal(err) |
| 42 | } |
| 43 | |
| 44 | err = sentry.Init(sentry.ClientOptions{ |
| 45 | Dsn: sentryDsn, |
| 46 | }) |
| 47 | if err != nil { |
| 48 | log.Fatalf("Sentry initialization failed: %v\n", err) |
| 49 | } |
| 50 | |
| 51 | defer sentry.Flush(2 * time.Second) |
| 52 | |
| 53 | github := GitHub{} |
| 54 | application := Application{} |
| 55 | |
| 56 | switch command { |
| 57 | case "review": |
| 58 | reviewer := Reviewer{ |
| 59 | gitHub: &github, |
| 60 | application: &application, |
| 61 | } |
| 62 | reviewer.Review() |
| 63 | case "approve": |
| 64 | approver := Approver{ |
| 65 | gitHub: &github, |
| 66 | application: &application, |
| 67 | } |
| 68 | approver.Approve() |
| 69 | case "aggregate": |
| 70 | aggregator := Aggregator{ |
| 71 | gitHub: &github, |
| 72 | } |
| 73 | aggregator.Aggregate() |
| 74 | default: |
| 75 | fmt.Printf("Invalid command: %s\n", command) |
| 76 | printUsageAndExit() |
| 77 | } |
| 78 | } |
nothing calls this directly
no test coverage detected