Go build using modules is ignoring vendor directory

I’d appreciate an extra pair of eyes, because this is causing my build and test to fail.

Sample execution: https://travis-ci.com/Stackdriver/stackdriver-prometheus-sidecar/builds/122187097

I converted my project from govendor to go mod. I set up the Makefile so that tests use the contents of the vendor directory regardless of where the code is located (inside GOPATH or outside). I verified this in my local environment. However, when the test runs in the Travis environment, it tries to download the modules, which often fails due to timeouts talking to github.com.

I don’t understand why it even tries to download the dependencies, since it is passing -mod=vendor to the command, as I’d expect: go test -v -coverprofile=coverage.out -mod=vendor ./...

I have GO111MODULE=on both in the Travis configuration and in the Makefile.

This is the Travis configuration included in the PR being testd: https://github.com/Stackdriver/stackdriver-prometheus-sidecar/blob/2652809166d232fabb382c6310d098a523dac6d1/.travis.yml

Imprint