Skip to content

Commit

Permalink
DOCS: Add comments to exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cian911 committed Dec 28, 2021
1 parent fa1bd6f commit 231a360
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Event struct {
IsDir bool
}

// New creates and returns a new event struct
func New(file, path, dest, ext string) *Event {
return &Event{
File: file,
Expand All @@ -50,6 +51,7 @@ func (e *Event) IsValidEvent(ext string) bool {
return false
}

// IsNewDirEvent returns a bool if the given path is a directory or not
func (e *Event) IsNewDirEvent() bool {
if e.Ext == "" && utils.ValidatePath(e.Path) {
return true
Expand Down
4 changes: 4 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func ValidateFileExt(ext string) bool {
return true
}

// ScanFilesInDir scans and returns a map of all files in a given directory.
// The returned map is a key value of the filename, and if a directory.
// im_a_dir -> true
// sample.txt -> false
func ScanFilesInDir(path string) (map[string]bool, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
Expand Down

0 comments on commit 231a360

Please sign in to comment.