pkger/examples/walk/std/main.go

31 lines
466 B
Go
Raw Normal View History

2019-10-17 20:45:22 +03:00
package main
import (
"fmt"
"log"
"os"
"path/filepath"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
return filepath.Walk("./public", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
fmt.Println("Name: ", info.Name())
fmt.Println("Size: ", info.Size())
fmt.Println("Mode: ", info.Mode())
fmt.Println("ModTime: ", info.ModTime())
fmt.Println()
return nil
})
}