From d2a320cc2ae781413703098e5980c0e8349a54de Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin <tomasz@maczukin.pl> Date: Fri, 18 Oct 2024 12:29:23 +0200 Subject: [PATCH] Fix home directory detection With 452ac0a2eb7bdf2895467b2cdab95d5f253e8d48 we changed how HOME directory detection and "fixing" is working, but now it's causing runner to fail in cases it didn't before. The change was done because previously we've been using a deprecated function from the `homedir` package. It was, however, done wrong. This commit reverts code to the previous version. --- helpers/cli/fix_home.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/helpers/cli/fix_home.go b/helpers/cli/fix_home.go index 43244e2c472..b250461288f 100644 --- a/helpers/cli/fix_home.go +++ b/helpers/cli/fix_home.go @@ -12,11 +12,9 @@ func FixHOME(app *cli.App) { appBefore := app.Before app.Before = func(c *cli.Context) error { - // Fix home - key, err := os.UserHomeDir() - if err != nil { - return fmt.Errorf("failed to get user home dir: %w", err) - } + //nolint:staticcheck + key := homedir.Key() + if os.Getenv(key) == "" { value := homedir.Get() if value == "" { -- GitLab