Another way is using -mod=vendor 1. Create the vendor dir ln -sf /usr/share/gocode/src vendor 2. Build GO111MODULE=on GOPROXY=off GOSUMDB=off go build -mod=vendor -v ./ This way seems go tool will ignore the go.mod and go.sum. And works like what we do with GOPATH.