@@ -27,13 +27,6 @@ import (
2727 "github.com/sirupsen/logrus"
2828)
2929
30- var config * Config
31-
32- var logTime = flag .Bool ("logTime" , false , "whether or not to print time and date in logs" )
33- var configFilePath = flag .String ("config" , "config.yaml" , "configuration file path" )
34- var cpuProfile = flag .String ("cpuProfile" , "" , "write CPU profile to `file`" )
35- var memProfile = flag .String ("memProfile" , "" , "write memory profile to `file`" )
36-
3730func initCPUProfiling (cpuProfile * string ) func () {
3831 logrus .Info ("initializing CPU profiling" )
3932
@@ -95,6 +88,13 @@ func killListener(c chan os.Signal, beforeExit []func()) {
9588}
9689
9790func main () {
91+ var (
92+ logTime = flag .Bool ("logTime" , false , "whether or not to print time and date in logs" )
93+ configFilePath = flag .String ("config" , "config.yaml" , "configuration file path" )
94+ cpuProfile = flag .String ("cpuProfile" , "" , "write CPU profile to `file`" )
95+ memProfile = flag .String ("memProfile" , "" , "write memory profile to `file`" )
96+ )
97+
9898 flag .Parse ()
9999
100100 initLogging (logTime )
@@ -115,12 +115,10 @@ func main() {
115115
116116 go killListener (c , beforeExit )
117117
118- var err error
119- config , err = loadConfig (* configFilePath )
120-
118+ config , err := loadConfig (* configFilePath )
121119 if err != nil {
122120 logrus .WithError (err ).Fatal ("could not load config" )
123121 }
124122
125- InitMatrix ()
123+ InitMatrix (config )
126124}
0 commit comments