From e09becb9d17a7e5f59c067ed3345665ee32ae2d5 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 30 Sep 2022 11:26:05 -0600 Subject: [PATCH] Ignore vendor folder with mod=readonly --- README.md | 2 ++ cmd/main.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ba7ea2..09b635c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cmd/main.go b/cmd/main.go index c9bc76e..36bb2c8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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