github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/internal/version.go (about) 1 package internal 2 3 import ( 4 "fmt" 5 "runtime" 6 "strings" 7 "time" 8 9 "github.com/docker/app/internal/renderer" 10 ) 11 12 var ( 13 // Version is the git tag that this was built from. 14 Version = "unknown" 15 // GitCommit is the commit that this was built from. 16 GitCommit = "unknown" 17 // BuildTime is the time at which the binary was built. 18 BuildTime = "unknown" 19 ) 20 21 // FullVersion returns a string of version information. 22 func FullVersion() string { 23 res := []string{ 24 fmt.Sprintf("Version: %s", Version), 25 fmt.Sprintf("Git commit: %s", GitCommit), 26 fmt.Sprintf("Built: %s", reformatDate(BuildTime)), 27 fmt.Sprintf("OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH), 28 fmt.Sprintf("Experimental: %s", Experimental), 29 fmt.Sprintf("Renderers: %s", strings.Join(renderer.Drivers(), ", ")), 30 } 31 return strings.Join(res, "\n") 32 } 33 34 // FIXME(chris-crone): use function in docker/cli/cli/command/system/version.go. 35 func reformatDate(buildTime string) string { 36 t, errTime := time.Parse(time.RFC3339Nano, buildTime) 37 if errTime == nil { 38 return t.Format(time.ANSIC) 39 } 40 return buildTime 41 }