Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dupplicate homeDir's implementation #52

Closed
placintaalexandru opened this issue Apr 10, 2023 · 2 comments
Closed

Dupplicate homeDir's implementation #52

placintaalexandru opened this issue Apr 10, 2023 · 2 comments

Comments

@placintaalexandru
Copy link

placintaalexandru commented Apr 10, 2023

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.

@adrg
Copy link
Owner

adrg commented Apr 11, 2023

Hi @placintaalexandru,

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.

@placintaalexandru
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants