Skip to content

Commit 62448c7

Browse files
authored
Merge pull request #1069 from carapace-sh/uid-gcompat
uid: gcompat workaround
2 parents 0f537c0 + 63e7a57 commit 62448c7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pkg/uid/uid.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ func Flag(cmd *cobra.Command, flag *pflagfork.Flag) *url.URL {
4949

5050
// Executable returns the name of the executable.
5151
func Executable() string {
52-
if executable, err := os.Executable(); err != nil {
52+
executable, err := os.Executable()
53+
if err != nil {
5354
return "echo" // safe fallback that should never happen
54-
} else if filepath.Base(executable) == "cmd.test" {
55+
}
56+
switch base := filepath.Base(executable); base {
57+
case "cmd.test":
5558
return "example" // for `go test -v ./...`
56-
} else {
57-
return filepath.Base(executable)
59+
case "ld-musl-x86_64.so.1":
60+
return filepath.Base(os.Args[0]) // alpine container workaround (gcompat)
61+
default:
62+
return base
5863
}
5964
}
6065

0 commit comments

Comments
 (0)