package app

import (
	"fmt"
	"os"
	"runtime"
	"text/template"

	"github.com/Sirupsen/logrus"
	"github.com/docker/libcompose/version"
	"github.com/urfave/cli"
)

var versionTemplate = `Version:      {{.Version}} ({{.GitCommit}})
Go version:   {{.GoVersion}}
Built:        {{.BuildTime}}
OS/Arch:      {{.Os}}/{{.Arch}}`

// Version prints the libcompose version number and additionnal informations.
func Version(c *cli.Context) error {
	if c.Bool("short") {
		fmt.Println(version.VERSION)
		return nil
	}

	tmpl, err := template.New("").Parse(versionTemplate)
	if err != nil {
		logrus.Fatal(err)
	}

	v := struct {
		Version   string
		GitCommit string
		GoVersion string
		BuildTime string
		Os        string
		Arch      string
	}{
		Version:   version.VERSION,
		GitCommit: version.GITCOMMIT,
		GoVersion: runtime.Version(),
		BuildTime: version.BUILDTIME,
		Os:        runtime.GOOS,
		Arch:      runtime.GOARCH,
	}

	if err := tmpl.Execute(os.Stdout, v); err != nil {
		logrus.Fatal(err)
	}
	fmt.Printf("\n")
	return nil
}

package app

import (
	"fmt"
	"os"
	"runtime"
	"text/template"

	"github.com/Sirupsen/logrus"
	"github.com/docker/libcompose/version"
	"github.com/urfave/cli"
)

var versionTemplate = `Version:      {{.Version}} ({{.GitCommit}})
Go version:   {{.GoVersion}}
Built:        {{.BuildTime}}
OS/Arch:      {{.Os}}/{{.Arch}}`

// Version prints the libcompose version number and additionnal informations.
func Version(c *cli.Context) {
	if c.Bool("short") {
		fmt.Println(version.VERSION)
		return
	}

	tmpl, err := template.New("").Parse(versionTemplate)
	if err != nil {
		logrus.Fatal(err)
	}

	v := struct {
		Version   string
		GitCommit string
		GoVersion string
		BuildTime string
		Os        string
		Arch      string
	}{
		Version:   version.VERSION,
		GitCommit: version.GITCOMMIT,
		GoVersion: runtime.Version(),
		BuildTime: version.BUILDTIME,
		Os:        runtime.GOOS,
		Arch:      runtime.GOARCH,
	}

	if err := tmpl.Execute(os.Stdout, v); err != nil {
		logrus.Fatal(err)
	}
	fmt.Printf("\n")
	return
}

--- 
+++ 
@@ -17,10 +17,10 @@
 OS/Arch:      {{.Os}}/{{.Arch}}`
 
 // Version prints the libcompose version number and additionnal informations.
-func Version(c *cli.Context) {
+func Version(c *cli.Context) error {
 	if c.Bool("short") {
 		fmt.Println(version.VERSION)
-		return
+		return nil
 	}
 
 	tmpl, err := template.New("").Parse(versionTemplate)
@@ -48,5 +48,5 @@
 		logrus.Fatal(err)
 	}
 	fmt.Printf("\n")
-	return
+	return nil
 }
Update Version signature to remove warning

Signed-off-by: Vincent Demeester <87e1f221a672a14a323e57bb65eaea19d3ed3804@sbr.pm>
