Skip to content

nikosgram/qwalk

Repository files navigation

qwalk Go Reference Go CodeQL

Golang fastest directory walking method

Got the idea of creating this library based on @feyrob's godirlist repo: https://github.com/feyrob/godirlist

Examples

There are a few examples in the qwalk_test.go and qwalk_bench_test.go files if you want to see a very simplified version of what you can do with qwalk.

package main

import (
	"fmt"
	"runtime"
	
	"github.com/nikosgram/qwalk"
)

func main() {
	// print all no-directory items
	qwalk.Walk(
		[]string{"."},
		func(info qwalk.ItemInfo) bool {
			// print only from no-dir items
			if !info.Info.IsDir() {
				fmt.Println(info.Path)
			}

			// allow dir-listing on all directories
			return true
		},
		runtime.NumCPU(),
	)
}