mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
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:
parent
16abbbc846
commit
4dc1d36218
@ -156,16 +156,20 @@ func getDriverName() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printVersion() {
|
||||||
|
fmt.Println("Cephcsi Version:", util.DriverVersion)
|
||||||
|
fmt.Println("Git Commit:", util.GitCommit)
|
||||||
|
fmt.Println("Go Version:", runtime.Version())
|
||||||
|
fmt.Println("Compiler:", runtime.Compiler)
|
||||||
|
fmt.Printf("Platform: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||||
|
if kv, err := util.GetKernelVersion(); err == nil {
|
||||||
|
fmt.Println("Kernel:", kv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if conf.Version {
|
if conf.Version {
|
||||||
fmt.Println("Cephcsi Version:", util.DriverVersion)
|
printVersion()
|
||||||
fmt.Println("Git Commit:", util.GitCommit)
|
|
||||||
fmt.Println("Go Version:", runtime.Version())
|
|
||||||
fmt.Println("Compiler:", runtime.Compiler)
|
|
||||||
fmt.Printf("Platform: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
|
||||||
if kv, err := util.GetKernelVersion(); err == nil {
|
|
||||||
fmt.Println("Kernel:", kv)
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
log.DefaultLog("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit)
|
log.DefaultLog("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit)
|
||||||
|
Loading…
Reference in New Issue
Block a user