Ignore vendor folder with mod=readonly

This commit is contained in:
Matthew Holt 2022-09-30 11:26:05 -06:00
parent e4c5f53dd2
commit e09becb9d1
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
2 changed files with 4 additions and 2 deletions

View file

@ -42,6 +42,8 @@ The `xcaddy` command will use the latest version of Caddy by default. You can cu
As usual with `go` command, the `xcaddy` command will pass the `GOOS`, `GOARCH`, and `GOARM` environment variables through for cross-compilation.
Note that `xcaddy` will ignore the `vendor/` folder with `-mod=readonly`.
### Custom builds

View file

@ -183,7 +183,7 @@ func runDev(ctx context.Context, args []string) error {
// and since this tool is a carry-through for the user's actual
// go.mod, we need to transfer their replace directives through
// to the one we're making
cmd := exec.Command(utils.GetGo(), "list", "-m", "-json", "all")
cmd := exec.Command(utils.GetGo(), "list", "-mod=readonly", "-m", "-json", "all")
cmd.Stderr = os.Stderr
out, err := cmd.Output()
if err != nil {
@ -318,7 +318,7 @@ func parseGoListJson(out []byte) (currentModule, moduleDir string, replacements
for _, idx := range unjoinedReplaces {
unresolved := string(replacements[idx].New)
resolved := filepath.Join(moduleDir, unresolved)
log.Printf("[INFO] Resolved relative replacement %s to %s", unresolved, resolved)
log.Printf("[INFO] Resolved previously-unjoined relative replacement %s to %s", unresolved, resolved)
replacements[idx].New = xcaddy.ReplacementPath(resolved)
}
return