github.com/technosophos/deis@v1.7.1-0.20150915173815-f9005256004b/builder/src/extract-types.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 // this should not happen but just in case return an empty type 19 if err != nil { 20 fmt.Println("{}") 21 os.Exit(0) 22 } 23 24 defaultType, err := builder.GetDefaultType(bytes) 25 26 if err != nil { 27 fmt.Println(err) 28 os.Exit(1) 29 } 30 31 fmt.Println(defaultType) 32 }