func Executables(dirname string) []string {
	resultq := make(chan []string)
	dirname = filepath.Clean(dirname)
	requestq <- func() {
		resultq <- executables[dirname]
		close(resultq)
	}
	res := <-resultq
	if res == nil {
		go Files(dirname)
	}
	return res
}
Executables returns executables (and directories) in dirname and schedules a rescan or dirname.
package cache
import (
	"os"
	"path/filepath"
	"strings"
)
func Check(path string) {
	resultq := make(chan bool)
	dirname, basename := filepath.Split(path)
	requestq <- func() {
		for _, p := range executables[dirname] {
			if p == basename {
				resultq <- true
				break
			}
		}
		close(resultq)
	}
	if <-resultq {
		Files(dirname)
	}
}