When go autodetects that it is being run as a go mod, and that there is
a vendor directory, it will still try to redownload all sources over the
network, unless you use -mod=vendor to tell it to use that. Additionally,
when using -mod=vendor the compiler will nicely avoid messing with
$GOPATH at all, since it can operate in a completely self-contained
manner.
Take advantage of this, when the detected go version is at least 1.11
(when the -mod flag was introduced).
golang does not natively respect LDFLAGS, but you can pass them on the
command line using -ldflags=-extldflags=...
This is important for distributions, in order to provide common
functionality such as hardening flags.
Also strip the prefixed root source directory from the embedded source
file paths. This is not important information for the debugger, which
should only care about paths relative to $GOPATH, and results in less
build environment metadata leaking into the final binary. (This also
aids in reproducible builds when using different build directories, see
e.g. https://github.com/golang/go/issues/16860)
This was from the time when we tried to have hub build even if it wasn't
checkout out within a local GOPATH. This change assumes a working Go
environment.
The only thing that has substansively changed is that Go 1.8 handles
redirect logic more safely than previous versions. This means we can
drop our special handling to avoid following redirects to other
domains. We were only doing that to protect against the possibility
of leaking auth headers. With Go 1.8, the auth headers are not
forwarded when following a redirect to another domain, so we don't
need our special handling any more.
As long as people are attempting to build with the Makefile, the new
check_go_version script should cause the build to stop if our
collaborators aren't using at least version 1.8 of go.
This is helpful for when TMPDIR already has a trailing slash. We can't
be sure that it will on all operating systems, but this will remove it
if it is there.
This adds hub version to crash report. It includes refactoring of hub version to the `version` package for reusability in `commands` package and `github` package.
We need to run the packaging script for every platform using a Vagrant box. During the packaging step, cukes are run. However, the workspace is shared between host and the Vagrant box. Instead of cleaning up the built binary for each platform, build it into a temporary dir.
Old `script/bootstrap` & `script/build` were unfriendly to Go newbies
because they require the user having GOPATH set in their environment,
and either `godep` installed or `hg` to be able to fetch godep.
However, since dependencies are vendored, we don't have any real build
dependencies except Go itself.
- `script/bootstrap` now checks Go and installs Ruby test bundle
- `script/build` skips compiling if binary is up to date
- `script/test` runs both Go and Cucumber test suites