Skip to content

Commit

Permalink
add ".exe" when cross compiling for windows (#179)
Browse files Browse the repository at this point in the history
* add ".exe" when cross compiling for windows

* add ".exe" when cross compiling for windows or on windows without cross-compiling

* wait until 1.23 is released
  • Loading branch information
WeidiDeng authored May 6, 2024
1 parent 85e12f8 commit bff6878
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ func runBuild(ctx context.Context, args []string) error {

func getCaddyOutputFile() string {
f := "." + string(filepath.Separator) + "caddy"
if runtime.GOOS == "windows" {
// compiling for Windows or compiling on windows without setting GOOS, use .exe extension
if os.Getenv("GOOS") == "windows" || (os.Getenv("GOOS") == "" && runtime.GOOS == "windows") {
f += ".exe"
}
return f
Expand Down

0 comments on commit bff6878

Please sign in to comment.