github.com/greenboxal/deis@v1.12.1/builder/src/extract-version.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "os" 7 8 "github.com/deis/deis/builder" 9 ) 10 11 func main() { 12 if fi, _ := os.Stdin.Stat(); fi.Mode()&os.ModeNamedPipe == 0 { 13 fmt.Println("this app only works using the stdout of another process") 14 os.Exit(1) 15 } 16 17 bytes, err := ioutil.ReadAll(os.Stdin) 18 if err != nil { 19 panic(err) 20 } 21 22 version, err := builder.ParseReleaseVersion(bytes) 23 24 if err != nil { 25 fmt.Println(err) 26 os.Exit(1) 27 } 28 29 fmt.Println(version) 30 }