Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle projects using Go module vendoring
The call to install `github.com/icarus-sullivan/mock-lambda` will fail in a Go project that is using vendoring (https://go.dev/ref/mod#vendoring) as the subsequent `go build` command will error like so: go: inconsistent vendoring in /path/dev/nimble: github.com/icarus-sullivan/mock-lambda@v0.0.0-20220115083805-e065469e964a: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt To ignore the vendor directory, use -mod=readonly or -mod=mod. To sync the vendor directory, run: go mod vendor This change detects if `vendor/` is present and then will re-run `go mod vendor` after the installation of `mock-lambda` to ensure that building succeeds. This also raises any exceptions that occur within either of these install/build commands so it is obvious what problem is occurring. Previously, this error was swallowed and passed silently, until causing a failure to call the non-existent `./tmp` executable with `execa(`./tmp`)`: Error: Command failed with ENOENT: ./tmp spawn ./tmp ENOENT With this PR, the above error for `go mod vendor` is outputted instead.
- Loading branch information