Since the CI job runs without the full git history, and since we
commonly get release notes from the annotated git tag, eliminate the
obsolete code path that tried to generate the changelog.
https://github.com/github/hub/runs/488291084
When unpacking the release .tar.gz of `hub` into a worktree (such as
MSYS2's `MINGW-packages` one), the version obtained via `git describe`
does not make sense.
Let's force Git to look only for `hub`'s Git info, if any.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
`go fmt` doesn't seem to respect `-mod=vendor`
https://github.com/golang/go/issues/27841
Instead try using `gofmt` which doesn't trigger downloading dependencies
in the first place. However, `gofmt` affects files under `vendor/`, so
we reset that before checking for changes.
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)
When packaging for distributions (particularly RPM), it is common
for the packaging tool to install all of the files into a chroot-
style directory structure as a non-privileged user. This is done
to avoid requiring root privileges for packaging (particularly to
avoid issues where the attempt to package causes changes to be
made to the packaging host.
The standard variable used for this (from autotools) is DESTDIR.
This patch adds DESTDIR before the prefix in install.sh to ensure
that when `make install` is run, it will direct output to the
proper location.
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
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.