How about letting something like [http://golang.org/pkg/path/filepath/#Walk](filepath.Walk) handle the traversal, might simplify this function down a bit