add ".exe" when cross compiling for windows (#179)

* 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
This commit is contained in:
WeidiDeng 2024-05-07 01:38:01 +08:00 committed by GitHub
parent 85e12f87b2
commit bff687835e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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