Skip to content

Commit dc24403

Browse files
authored
Merge pull request #4012 from norio-nomura/usrlocalsharelima-Dir-once
`usrlocalsharelima`: execute `Dir()` once
2 parents 4027d4a + f8abb3d commit dc24403

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/usrlocalsharelima/usrlocalsharelima.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var executableViaArgs0 = sync.OnceValues(func() (string, error) {
4444
// Dir returns the location of the <PREFIX>/lima/share directory, relative to the location
4545
// of the current executable. It checks for multiple possible filesystem layouts and returns
4646
// the first candidate that contains the native guest agent binary.
47-
func Dir() (string, error) {
47+
var Dir = sync.OnceValues(func() (string, error) {
4848
selfPaths := []string{}
4949

5050
selfViaArgs0, err := executableViaArgs0()
@@ -119,7 +119,7 @@ func Dir() (string, error) {
119119

120120
return "", fmt.Errorf("failed to find \"lima-guestagent.%s-%s\" binary for %v, attempted %v",
121121
ostype, arch, selfPaths, gaCandidates)
122-
}
122+
})
123123

124124
// GuestAgentBinary returns the absolute path of the guest agent binary, possibly with ".gz" suffix.
125125
func GuestAgentBinary(ostype limatype.OS, arch limatype.Arch) (string, error) {

0 commit comments

Comments
 (0)