also here i think 

```go
if pthInfo != nil && !pathinfo.IsDir() { ... }
```