Dupplicate `homeDir`'s implementation
placintaalexandru opened this issue · 2 comments
Function homeDir
from all paths_{windows | darwin | unix | plan9}.go
does exactly the same thing as os.UserHomeDir. I believe it can be moved to a commons.go
file to reduce the amount of os specific code and rely more on built-in functionality.
The xdg.Home
field was introduced because historically, the code for os.UserHomeDir
has not been the same between Go versions and I wanted to support as many as possible. For example, the code did change between Go 1.15 and Go 1.16. Regarding moving the implementation for homeDir
in a common location, maybe. I don't see advantages in doing so at this point.
However, I might drop xdg.Home
(and homeDir
) completely in the next major version of the library as older Go versions are not widely used anymore. It must be in a major version because I don't do breaking changes in minor version releases.
Thank you for the fast reply @adrg.
I was trying to get rid of dupplicate code by removing all the 4 homeDir
function and replace them with only one. I did not know you would remove the xdg.Home
in the future. I guess this can be closed then.