github.com/geofffranks/garden-linux@v0.0.0-20160715111146-26c893169cfa/containerizer/system/fake_container/main.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "os" 7 8 "code.cloudfoundry.org/garden-linux/containerizer/system" 9 ) 10 11 func main() { 12 if len(os.Args) != 2 { 13 fmt.Fprintf(os.Stderr, "ERROR: Root directory not provided\n") 14 os.Exit(1) 15 } 16 17 rootFS := &system.RootFS{ 18 Root: os.Args[1], 19 } 20 err := rootFS.Enter() 21 if err != nil { 22 fmt.Fprintf(os.Stderr, "ERROR: Failed to enter root fs: %v\n", err) 23 os.Exit(1) 24 } 25 26 files, err := ioutil.ReadDir(".") 27 if err != nil { 28 fmt.Fprintf(os.Stderr, "ERROR: Failed to read directory: %v\n", err) 29 os.Exit(1) 30 } 31 for _, file := range files { 32 fmt.Printf("%v\t", file.Name()) 33 } 34 fmt.Printf("\n") 35 }