Skip to content

Instantly share code, notes, and snippets.

@LandonTClipp
Created September 7, 2020 20:45
Show Gist options
  • Save LandonTClipp/a933c2530df437a1d6cfea8ec77de098 to your computer and use it in GitHub Desktop.
Save LandonTClipp/a933c2530df437a1d6cfea8ec77de098 to your computer and use it in GitHub Desktop.
github.com/chigopher/pathlib os example
package main
import (
"fmt"
"os"
"github.com/chigopher/pathlib"
)
func main() {
// Create a path on your regular OS filesystem
path := pathlib.NewPath("/")
subdirs, err := path.ReadDir()
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
for _, dir := range subdirs {
fmt.Println(dir.Name())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment