Bruno is a very try-hard developer; when he found out that os.Stat() function was moved to the io/fs package as the fs.Stat() function, he quickly updated his Go program to show-off to his friends that he uses "fancier" 🥶🆒 code than them.
When he finished updating the code in his program, he forgot a very important detail regarding the fs.Stat() function. Can you help him fix his code, so he can properly show it off to his friends? Below is the code he has written so far:
package main
import (
"fmt"
"io/fs"
"log"
"os"
)
func main() {
fileInfo, err := fs.Stat("chad.png")
if err != nil {
log.Fatal(err)
}
mode := fileInfo.Mode()
fmt.Println("File name:", fileInfo.Name())
fmt.Println("File size:", fileInfo.Size())
fmt.Printf("File permission bits: %#o", mode.Perm())
}
To properly get the file attributes from chad.png, he needs to set the file system as the sigma_files directory in his workspace:
edgy_project
├── main.go
├── sigma_files
│ └── chad.png
└── sigma_grindset_quotes.txt
Please select which one of the fs.Stat() code lines below follow the correct syntax to achieve his goal.