func testConnection(fs *gowfs.FileSystem) { _, err := fs.ListStatus(gowfs.Path{Name: "/"}) if err != nil { log.Fatal("Unable to connect to server. ", err) } log.Printf("Connected to server %s... OK.\n", fs.Config.Addr) }
func ls(fs *gowfs.FileSystem, hdfsPath string) { stats, err := fs.ListStatus(gowfs.Path{Name: hdfsPath}) if err != nil { log.Fatal("Unable to list paths: ", err) } log.Printf("Found %d file(s) at %s\n", len(stats), hdfsPath) for _, stat := range stats { fmt.Printf( "%-11s %3s %s\t%s\t%11d %20v %s\n", formatFileMode(stat.Permission, stat.Type), formatReplication(stat.Replication, stat.Type), stat.Owner, stat.Group, stat.Length, formatModTime(stat.ModificationTime), stat.PathSuffix) } }