Adds support for Go modules by detecting a go.mod file and, if
available, using it. In addition, to continue supporting vendoring (and
avoid the need for git on all module builds), if a package includes
a vendor directory, the module mode will switch to vendor mode if not
already set. This will use vendored source code for dependencies
instead of downloading that code again using the descriptions under
go.mod.
go_mod_mode=vendor also skips the go.sum check because nothing is
downloaded that isn't already verified, so this fixes packages with
vendored code that have checksum mismatches due to Go 1.11.4 module
checksum changes.
[ci skip]
Closes: #6036 [via git-merge-pr]
Go 1.5 doesn't permit our use of GOBIN anymore, breaking
cross-compilation (for details, see
https://github.com/golang/go/issues/9769)
In retrospect, I'm not sure why we set GOBIN in the first place;
GOPATH/bin should suffice.
Closes#2337