cleanup: reduce complexity of main()

Move the printing of the version and other information to its own
function. This reduces the complexity enough so that golang-ci does not
complain about it anymore.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2022-03-17 10:21:30 +01:00 committed by mergify[bot]
parent 16abbbc846
commit 4dc1d36218

View File

@ -156,8 +156,7 @@ func getDriverName() string {
}
}
func main() {
if conf.Version {
func printVersion() {
fmt.Println("Cephcsi Version:", util.DriverVersion)
fmt.Println("Git Commit:", util.GitCommit)
fmt.Println("Go Version:", runtime.Version())
@ -166,6 +165,11 @@ func main() {
if kv, err := util.GetKernelVersion(); err == nil {
fmt.Println("Kernel:", kv)
}
}
func main() {
if conf.Version {
printVersion()
os.Exit(0)
}
log.DefaultLog("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit)