package errors import "fmt" type InvalidDirectory struct { Path string } func (err *InvalidDirectory) Error() string { if err.Path == "" { return "Invalid directory" } return fmt.Sprintf("Invalid directory '%s'", err.Path) }