Skip to content

Commit

Permalink
clear readdir after use.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Dec 6, 2024
1 parent 645b1e8 commit 8a0c604
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions handler/app/dirs.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ func (dir Dirs) assets(nameDir, unid string) map[string][2]string {
}
}
}
clear(files)
return matches
}

Expand Down
4 changes: 3 additions & 1 deletion handler/html3/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const (

func emptyFS(fs embed.FS) bool {
entries, err := fs.ReadDir(".")
return err != nil || len(entries) == 0
result := err != nil || len(entries) == 0
clear(entries)
return result
}

// GlobTo returns the path to the template file.
Expand Down
4 changes: 3 additions & 1 deletion handler/htmx/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func GlobTo(name string) string {

func emptyFS(fs embed.FS) bool {
entries, err := fs.ReadDir(".")
return err != nil || len(entries) == 0
result := err != nil || len(entries) == 0
clear(entries)
return result
}

// Templates returns a map of the templates.
Expand Down

0 comments on commit 8a0c604

Please sign in to comment.