package main import ( "fmt" "os" ) func main() { fi, err := os.Stat("path/to/directory") if err != nil { return // handle error } if fi.IsDir() { fmt.Printf("%s is a directory\n", fi.Name()) } else { fmt.Printf("%s is not a directory\n", fi.Name()) } }This example checks whether the path "path/to/directory" refers to a directory, and prints a message indicating whether it is a directory or not. Package: "os"