fix(mkreleaselog): make robust against running in different working directories

1. Cd into the repo root before running `go list`.
2. Make sure the repo lives in the GOPATH.
This commit is contained in:
Steven Allen 2020-05-12 22:30:53 -07:00
parent 8e7cead9af
commit 048c1c37b3

View File

@ -161,7 +161,13 @@ recursive_release_log() {
local start="${1:-$(git tag -l | sort -V | grep -v -- '-rc' | grep 'v'| tail -n1)}"
local end="${2:-$(git rev-parse HEAD)}"
local repo_root="$(git rev-parse --show-toplevel)"
local package="$(go list)"
local package="$(cd "$repo_root" && go list)"
if ! [[ "${GOPATH}/${package}" != "${repo_root}" ]]; then
echo "This script requires the target package and all dependencies to live in a GOPATH."
return 1
fi
(
local result=0
local workspace="$(mktemp -d)"