We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0f537c0 + 63e7a57 commit 62448c7Copy full SHA for 62448c7
pkg/uid/uid.go
@@ -49,12 +49,17 @@ func Flag(cmd *cobra.Command, flag *pflagfork.Flag) *url.URL {
49
50
// Executable returns the name of the executable.
51
func Executable() string {
52
- if executable, err := os.Executable(); err != nil {
+ executable, err := os.Executable()
53
+ if err != nil {
54
return "echo" // safe fallback that should never happen
- } else if filepath.Base(executable) == "cmd.test" {
55
+ }
56
+ switch base := filepath.Base(executable); base {
57
+ case "cmd.test":
58
return "example" // for `go test -v ./...`
- } else {
- 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
63
}
64
65
0 commit comments