Skip to content

Commit 88d054a

Browse files
committed
replaced usages of usr.HomeDir
Signed-off-by: kairveeehh <[email protected]>
1 parent 2624718 commit 88d054a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pkg/qemu/qemu.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ func FindVirtiofsd(qemuExe string) (string, error) {
10061006
Binary string `json:"binary"`
10071007
}
10081008

1009-
currentUser, err := user.Current()
1009+
homeDir, err := os.UserHomeDir()
10101010
if err != nil {
10111011
return "", err
10121012
}
@@ -1015,7 +1015,7 @@ func FindVirtiofsd(qemuExe string) (string, error) {
10151015

10161016
binDir := filepath.Dir(qemuExe) // "/usr/local/bin"
10171017
usrDir := filepath.Dir(binDir) // "/usr/local"
1018-
userLocalDir := filepath.Join(currentUser.HomeDir, ".local") // "$HOME/.local"
1018+
userLocalDir := filepath.Join(homeDir, ".local") // "$HOME/.local"
10191019

10201020
candidates := []string{
10211021
filepath.Join(userLocalDir, relativePath),
@@ -1267,4 +1267,4 @@ func getFirmwareVars(qemuExe string, arch limayaml.Arch) (string, error) {
12671267
}
12681268

12691269
return "", fmt.Errorf("could not find firmware vars for %q", arch)
1270-
}
1270+
}

pkg/store/instance.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"fmt"
1010
"io"
1111
"os"
12-
"os/user"
1312
"path/filepath"
1413
"runtime"
1514
"strconv"
@@ -355,11 +354,10 @@ func PrintInstances(w io.Writer, instances []*Instance, format string, options *
355354
}
356355
fmt.Fprintln(w)
357356

358-
u, err := user.Current()
357+
homeDir, err := os.UserHomeDir()
359358
if err != nil {
360359
return err
361360
}
362-
homeDir := u.HomeDir
363361

364362
for _, instance := range instances {
365363
dir := instance.Dir

0 commit comments

Comments
 (0)