ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
```package main import ( "fmt" "log" "os" ) var ( fileInfo os.FileInfo err error ) func main() { // 如果文件不存在,则返回错误 fileInfo, err = os.Stat("test.txt") if err != nil { log.Fatal(err) } fmt.Println("File name:", fileInfo.Name()) fmt.Println("Size in bytes:", fileInfo.Size()) fmt.Println("Permissions:", fileInfo.Mode()) fmt.Println("Last modified:", fileInfo.ModTime()) fmt.Println("Is Directory: ", fileInfo.IsDir()) fmt.Printf("System interface type: %T\n", fileInfo.Sys()) fmt.Printf("System info: %+v\n\n", fileInfo.Sys()) } ```