1 package version 2 3 import ( 4 "fmt" 5 "io" 6 "os" 7 ) 8 9 // FprintVersion outputs the version string to the writer, in the following 10 // format, followed by a newline: 11 // 12 // <cmd> <project> <version> 13 // 14 // For example, a binary "registry" built from github.com/docker/distribution 15 // with version "v2.0" would print the following: 16 // 17 // registry github.com/docker/distribution v2.0 18 func FprintVersion(w io.Writer) { 19 fmt.Fprintln(w, os.Args[0], Package, Version) 20 } 21 22 // PrintVersion outputs the version information, from Fprint, to stdout. 23 func PrintVersion() { 24 FprintVersion(os.Stdout) 25 } 26