-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: The result of UserHomeDir and User.HomeDir is inconsistent. #31070
Comments
With commit bedb6a1 , the result is now consistent. But not when HOME is not set.:
|
Great! But will this patch be released on 1.12.2? this is a long time for me to wait until 1.13 release 🤔 |
Change https://golang.org/cl/169540 mentions this issue: |
@Dreamacro I don't know, you should ask the core team cc @bradfitz @mvdan Not sure this issue is urgent for a cherry pick. |
/cc @eliasnaur |
Cherry-picks are generally reserved for regressions, security bugs, or really bad bugs like runtime crashes, so I don't think this qualifies. If anyone really wants the fix before 1.13 is released, copy-pasting a bit of code from master should be pretty easy. I think what @Gnouc said in his first comment makes sense. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes.
What did you do?
Before go 1.12, I used
os/user
to get homedir.After new release, I used new function
UserHomeDir
However, they may return different values under same environment. For example, when I used
termux
on android, the former returns$HOME
while the latter returns/
.The root case because of the
UserHomeDir
returns/
directly butuser.Current()
read env "$HOME" first.I prefer the previous implementation. So how do you plan to deal with the inconsistency between the two implementation?
The text was updated successfully, but these errors were encountered: