mirror of
https://github.com/caddyserver/xcaddy.git
synced 2024-11-08 10:19:59 +00:00
Fix runDev when running on windows (#33)
Extract default output file to a function and reuse it in both runBuild and runDev
This commit is contained in:
parent
53742c9c2d
commit
13c49c3566
1 changed files with 9 additions and 6 deletions
|
@ -99,11 +99,7 @@ func runBuild(ctx context.Context, args []string) error {
|
||||||
|
|
||||||
// ensure an output file is always specified
|
// ensure an output file is always specified
|
||||||
if output == "" {
|
if output == "" {
|
||||||
if runtime.GOOS == "windows" {
|
output = getCaddyOutputFile()
|
||||||
output = "caddy.exe"
|
|
||||||
} else {
|
|
||||||
output = "caddy"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform the build
|
// perform the build
|
||||||
|
@ -141,8 +137,15 @@ func runBuild(ctx context.Context, args []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getCaddyOutputFile() string {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "caddy.exe"
|
||||||
|
}
|
||||||
|
return "caddy"
|
||||||
|
}
|
||||||
|
|
||||||
func runDev(ctx context.Context, args []string) error {
|
func runDev(ctx context.Context, args []string) error {
|
||||||
const binOutput = "./caddy"
|
binOutput := getCaddyOutputFile()
|
||||||
|
|
||||||
// get current/main module name
|
// get current/main module name
|
||||||
cmd := exec.Command("go", "list", "-m")
|
cmd := exec.Command("go", "list", "-m")
|
||||||
|
|
Loading…
Reference in a new issue