Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle projects using Go module vendoring #1668

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 9, 2023

  1. 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/project:
            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.
    davidjb committed May 9, 2023
    Configuration menu
    Copy the full SHA
    795a294 View commit details
    Browse the repository at this point in the history