package genutil import ( "fmt" "os" "path/filepath" ) // OutDir creates the absolute path name from path and checks path exists. // Returns absolute path including trailing '/' or error if path does not exist. func OutDir(path string) (string, error) { outDir, err := filepath.Abs(path) if err != nil { return "", err } stat, err := os.Stat(outDir) if err != nil { return "", err } if !stat.IsDir() { return "", fmt.Errorf("output directory %s is not a directory", outDir) } outDir += "/" return outDir, nil }