natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.79k stars 591 forks source link

os.MkdirAll(path) doesn't return `nil` when the path already exists on windows #95

Closed hu13 closed 4 years ago

hu13 commented 4 years ago

Right here https://github.com/natefinch/lumberjack/blob/4b74a4dba98bba3444cce9a66dab2dd70d1c0639/lumberjack.go#L209, if the path already exists, the docs https://golang.org/pkg/os/#MkdirAll of os.MkdirAll says it expects to return nil.

However, I found that this is not the case on window 10/golang 1.12.7.

Wondering if we can have a defensive check here.

hu13 commented 4 years ago

It turned out not to be true if i ran os.MkdirAll on powershell.

Mostly, the user permission issue on my setup.