Uh oh!
There was an error while loading. Please reload this page.
config: don't call homedir on init() - #2161
Conversation
thaJeztah
commented
Oct 24, 2019
Can you elaborate on this? My $0.02: since golang |
thaJeztah
commented
Oct 24, 2019
arg; you're right; I was thinking the package was still using the runc / libcontainer stuff, but that was removed in moby/moby@a8608b5#diff-1b2f13bed97df1999bf7f922eb2f0909 |
thaJeztah
commented
Oct 25, 2019
@kolyshkin let me know what you think; I think it still makes sense to get this info lazily, but happy to close otherwise |
thaJeztah
commented
Oct 25, 2019
Actually; let me make one small change, and don't attempt to set the dir if it's non-empty (which could be if a user of this package calls |
8244019 to
59f9565Comparekolyshkin
commented
Oct 25, 2019
I don't like this change -- now you have two "run once" guards, and they are scattered. Maybe it's better to rewrite |
@kolyshkin it's a bit problematic; tbh I think this package is way too complex
It's a global / package level variable that can be set to a default, but also overwritten by a "setter". eg, someone could set the directory; Line 46 in 7a279af In which case we don't want to overwrite it with the default Someone could load the config, and specify the configDir Lines 82 to 85 in 7a279af In which case And worst case; if the specified location couldn't be found, in which case the current config location is neither the one specified, nor the default one, but a completely different path: Lines 108 to 112 in 7a279af |
jonjohnsonjr
commented
Oct 29, 2019
This tripped us up, so I had to land a workaround: google/go-containerregistry#568 I'm in favor of this change :) |
thaJeztah
commented
Mar 19, 2020
@kolyshkin PTAL |
59f9565 to
8b1e7dcCompareThis patch changes the package to lazily obtain the user's home- directory on first use, instead of when initializing the package. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
8b1e7dc to
8a30653Compare
The
homedir.Get()function can call out to external applications to get user information.This patch changes the package to lazily obtain the user's home-directory on first use, instead of when initializing the package.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)