ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ``` import ( "fmt" "log" "github.com/vladimirvivien/gowfs" ) var fs *gowfs.FileSystem func main() { fs, err := gowfs.NewFileSystem(gowfs.Configuration{Addr: "192.168.0.110:50070", User: "im_user"}) if err != nil{ log.Fatal(err) } //获取文件信息 checksum, err := fs.GetFileChecksum(gowfs.Path{Name: `/input/README.txt`}) if err != nil { log.Fatal(err) } fmt.Println(string(checksum.Bytes)) fmt.Println (checksum) //创建目录 createTestDir( "/user/kafka/hello2") } func createTestDir(hdfsPath string) { path := gowfs.Path{Name:hdfsPath} ok, err := fs.MkDirs(path, 0744) if err != nil || !ok { log.Fatal("Unable to create test directory ", hdfsPath, ":", err) } log.Println ("HDFS Path ", path.Name, " created.") } ```