Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

records: Find user's home directory through env #277

Merged
merged 1 commit into from
Sep 23, 2015
Merged

records: Find user's home directory through env #277

merged 1 commit into from
Sep 23, 2015

Conversation

tsenart
Copy link
Contributor

@tsenart tsenart commented Sep 23, 2015

As reported in golang/go#6376,
os/user.Current doesn't work with cross-compilation.
This commit replaces its use with os.Getenv of the $HOME and
$USERPROFILE environment variables.

Fixes #275

As reported in golang/go#6376,
`os/user.Current` doesn't work with cross-compilation.
This commit replaces its use with `os.Getenv` of the `$HOME` and
`$USERPROFILE` environment variables.

Fixes #275
usr, err := user.Current()
if err != nil {
// this can happen (on Linux) if you're running mesos-dns as a non-root user.
logging.Error.Println("Failed to determine current user, translating ~/ to ./, error was", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't log this anymore when HOME and USERPROFILE is unset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, OK, this gives users some insight in those conditions. I'll add it back.

@s-urbaniak s-urbaniak assigned tsenart and unassigned s-urbaniak Sep 23, 2015
@tsenart tsenart assigned s-urbaniak and unassigned tsenart Sep 23, 2015
@s-urbaniak s-urbaniak assigned tsenart and unassigned s-urbaniak Sep 23, 2015
tsenart added a commit that referenced this pull request Sep 23, 2015
records: Find user's home directory through env
@tsenart tsenart merged commit 777b8df into master Sep 23, 2015
@tsenart tsenart removed the PTAL label Sep 23, 2015
@tsenart tsenart deleted the fix-275 branch September 23, 2015 11:18
@tsenart
Copy link
Contributor Author

tsenart commented Sep 23, 2015

Oops. Forgot to add that log line back. I'll open a small PR for that.

@tsenart tsenart mentioned this pull request Sep 23, 2015
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants