Skip to content

Commit c213374

Browse files
Resolve relative replacements for xcaddy build as well (#48)
1 parent 5734acd commit c213374

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/xcaddy/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ func runBuild(ctx context.Context, args []string) error {
7575
Version: ver,
7676
})
7777
if repl != "" {
78+
// adjust relative replacements in current working directory since our temporary module is in a different directory
79+
if !filepath.IsAbs(repl) {
80+
repl, err = filepath.Abs(repl)
81+
if err != nil {
82+
log.Fatalf("[FATAL] %v", err)
83+
}
84+
log.Printf("[INFO] Resolved relative replacement %s to %s", args[i], repl)
85+
}
7886
replacements = append(replacements, xcaddy.NewReplace(mod, repl))
7987
}
8088

0 commit comments

Comments
 (0)