Skip to content

Commit

Permalink
Ignore vendor folder with mod=readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Sep 30, 2022
1 parent e4c5f53 commit e09becb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e09becb

Please sign in to comment.