Skip to content

Instantly share code, notes, and snippets.

Created Apr 25, 2021
What would you like to do?
import (
// example of counting all files in a root directory
func countFiles() int {
count := 0;
filepath.WalkDir(".", func(path string, file fs.DirEntry, err error) error {
if err != nil {
return err
if !file.IsDir() {
return nil;
return count;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment