Skip to content

Commit

Permalink
uid: gcompat workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 1, 2025
1 parent 0f537c0 commit 63e7a57
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/uid/uid.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ func Flag(cmd *cobra.Command, flag *pflagfork.Flag) *url.URL {

// Executable returns the name of the executable.
func Executable() string {
if executable, err := os.Executable(); err != nil {
executable, err := os.Executable()
if err != nil {
return "echo" // safe fallback that should never happen
} else if filepath.Base(executable) == "cmd.test" {
}
switch base := filepath.Base(executable); base {
case "cmd.test":
return "example" // for `go test -v ./...`
} else {
return filepath.Base(executable)
case "ld-musl-x86_64.so.1":
return filepath.Base(os.Args[0]) // alpine container workaround (gcompat)
default:
return base
}
}

Expand Down

0 comments on commit 63e7a57

Please sign in to comment.