From fe31bd9413faeae7feb2bffe2453dd866c9cfab9 Mon Sep 17 00:00:00 2001 From: Michael Hausenblas Date: Mon, 11 May 2020 10:55:59 +0100 Subject: [PATCH] fies version rendering issue Signed-off-by: Michael Hausenblas --- Makefile | 2 +- main.go | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index fae2190..ec95021 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -release_version:= v0.5.0 +release_version:= v0.6.0 export GO111MODULE=on diff --git a/main.go b/main.go index ae380ab..738b0b0 100644 --- a/main.go +++ b/main.go @@ -3,9 +3,10 @@ package main import ( "flag" "fmt" - "github.com/mhausenblas/cinf/namespaces" "os" "strconv" + + "github.com/mhausenblas/cinf/namespaces" ) const ( @@ -21,17 +22,17 @@ const ( \::/ / /:/ / \:\__\ \:\__\ \/__/ \/__/ \/__/ \/__/ ` - VERSION = "0.5.0" ) var ( - DEBUG bool - version bool - targetns string - targetpid string - cgspec string - monspec string - logspec string + DEBUG bool + version string + showversion bool + targetns string + targetpid string + cgspec string + monspec string + logspec string ) func debug(m string) { @@ -42,12 +43,12 @@ func debug(m string) { func about() { fmt.Printf(BANNER) - fmt.Printf("\nThis is cinf in version %s\n", VERSION) + fmt.Printf("\nThis is cinf in version %s\n", version) fmt.Print("See also https://github.com/mhausenblas/cinf\n\n") } func init() { - flag.BoolVar(&version, "version", false, "List info about cinf, including its version.") + flag.BoolVar(&showversion, "version", false, "List info about cinf, including its version.") flag.StringVar(&targetns, "namespace", "", "List details about namespace with provided ID. You can get the namespace ID by running cinf without arguments.") flag.StringVar(&targetpid, "pid", "", "List namespaces the process with provided process ID is in.") flag.StringVar(&cgspec, "cgroup", "", "List details of a cgroup a process belongs to. Format is PID:CGROUP_HIERARCHY, for example 1000:2.") @@ -72,7 +73,7 @@ func init() { func main() { namespaces.DEBUG = DEBUG debug("=== SHOWING DEBUG MESSAGES ===") - if version { + if showversion { about() os.Exit(0) }