diff --git a/main.go b/main.go index 328ea30c7..ba5e3c828 100644 --- a/main.go +++ b/main.go @@ -15,9 +15,9 @@ import ( "github.com/urfave/cli" ) -// version will be populated by the Makefile, read from -// VERSION file of the source code. -var version = "" +// version must be set from the contents of VERSION file by go build's +// -X main.version= option in the Makefile. +var version = "unknown" // gitCommit will be the hash that the binary was built from // and will be populated by the Makefile @@ -55,10 +55,8 @@ func main() { app.Name = "runc" app.Usage = usage - var v []string - if version != "" { - v = append(v, version) - } + v := []string{version} + if gitCommit != "" { v = append(v, "commit: "+gitCommit) }