Resolve relative replacements for xcaddy build as well (#48)

This commit is contained in:
Francis Lavoie 2021-02-15 13:28:34 -05:00 committed by GitHub
parent 5734acdd58
commit c2133748db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,6 +75,14 @@ func runBuild(ctx context.Context, args []string) error {
Version: ver,
})
if repl != "" {
// adjust relative replacements in current working directory since our temporary module is in a different directory
if !filepath.IsAbs(repl) {
repl, err = filepath.Abs(repl)
if err != nil {
log.Fatalf("[FATAL] %v", err)
}
log.Printf("[INFO] Resolved relative replacement %s to %s", args[i], repl)
}
replacements = append(replacements, xcaddy.NewReplace(mod, repl))
}