The code here does too much work. Use path/filepath.Walk.