Per #27524 there are situations where the username for the
uid does not match the value in the $USER environment variable and it
seems sensible to choose the value in /etc/passwd when they disagree.
This may make the Current() call slightly more expensive, since we
read /etc/passwd with cgo disabled instead of just checking the
environment. However, we cache the result of Current() calls, so we
only invoke this cost once in the lifetime of the process.
Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>
Run-TryBot: Ian Lance Taylor <email@example.com>
TryBot-Result: Gobot Gobot <firstname.lastname@example.org>
The builders don't always set $HOME and $USER.
Fix that, and revert the os/user testing hacks from https://go-review.googlesource.com/c/go/+/107300
The text was updated successfully, but these errors were encountered: