Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release #101

Merged
merged 6 commits into from
Jul 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ env:
- GO_BOOTSTRAP_VERSION=1.7.5
- GOPATH="${HOME}/gopath"
- PATH="${HOME}/bin:${PATH}"
- SHELLCHECK_URL="https://s3.amazonaws.com/travis-blue-public/binaries/ubuntu/14.04/x86_64/shellcheck-0.4.4.tar.bz2"
- SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.0.0/shfmt_v1.0.0_linux_amd64"
- SHELLCHECK_URL="https://s3.amazonaws.com/travis-blue-public/binaries/ubuntu/14.04/x86_64/shellcheck-0.4.6.tar.bz2"
- SHFMT_URL="https://github.com/mvdan/sh/releases/download/v1.3.1/shfmt_v1.3.1_linux_amd64"
matrix:
- TARGET=native GO_VERSIONS="$(sed -n -e '/^[^#]/p' < .testdata/sample-binary-$UNAME) $(sed -n -e '/^[^#]/p' < .testdata/source-$UNAME)"
- TARGET=arm GO_VERSIONS="master"
Expand All @@ -34,9 +34,10 @@ script:
curl -sSL "${SHELLCHECK_URL}" | tar -C "${HOME}/bin" -xjf -;
shellcheck --version;
fi
- if ! command -v shfmt ; then
curl -sSL "${SHFMT_URL}" -o "${HOME}/bin/shfmt" ;
chmod +x "${HOME}/bin/shfmt" ;
- if [ $UNAME = linux ] && [[ $(shfmt -version 2>/dev/null) != v1.3.1 ]] ; then
curl -sSL "${SHFMT_URL}" -o "${HOME}/bin/shfmt";
chmod +x "${HOME}/bin/shfmt";
shfmt -version;
fi
- if [ $UNAME = linux ]; then make lint; fi
- git diff --exit-code
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## [1.2.0] - 2017-07-09

### Added
- support for `stable` alias which auto-updates to point at latest release
- flag/command `-k|--known|known` to list known go versions

### Fixed
- always set `GOROOT` when installing official binaries

## [1.1.0] - 2016-12-07
### Added
- Windows binary downloads
Expand Down Expand Up @@ -80,7 +103,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Initial release!

[Unreleased]: https://github.com/travis-ci/gimme/compare/v1.1.0...HEAD
[Unreleased]: https://github.com/travis-ci/gimme/compare/v1.2.0...HEAD
[1.2.0]: https://github.com/travis-ci/gimme/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/travis-ci/gimme/compare/v1.0.4...v1.1.0
[1.0.0]: https://github.com/travis-ci/gimme/compare/v0.2.4...v1.0.0
[0.2.4]: https://github.com/travis-ci/gimme/compare/v0.2.3...v0.2.4
Expand Down
26 changes: 15 additions & 11 deletions gimme
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ set -o pipefail

[[ ${GIMME_DEBUG} ]] && set -x

GIMME_VERSION="v1.1.0"
GIMME_VERSION="v1.2.0"
GIMME_COPYRIGHT="Copyright (c) 2016 Dan Buch, Tianon Gravi, Travis CI GmbH"
GIMME_LICENSE_URL="https://raw.githubusercontent.com/travis-ci/gimme/v1.1.0/LICENSE"
GIMME_LICENSE_URL="https://raw.githubusercontent.com/travis-ci/gimme/v1.2.0/LICENSE"
export GIMME_VERSION
export GIMME_COPYRIGHT
export GIMME_LICENSE_URL
Expand Down Expand Up @@ -101,7 +101,7 @@ _binary() {
urls=(
"${GIMME_DOWNLOAD_BASE}/go${version}.${GIMME_OS}-${arch}.tar.gz"
)
if [[ "${GIMME_OS}" = 'darwin' && "${GIMME_BINARY_OSX}" ]]; then
if [[ "${GIMME_OS}" == 'darwin' && "${GIMME_BINARY_OSX}" ]]; then
urls=(
"${GIMME_DOWNLOAD_BASE}/go${version}.${GIMME_OS}-${arch}-${GIMME_BINARY_OSX}.tar.gz"
"${urls[@]}"
Expand Down Expand Up @@ -155,8 +155,8 @@ _checkout() {
git reset -q --hard "origin/${1}" \
|| git reset -q --hard "origin/go${1}" \
|| { [ "${1}" = 'tip' ] && git reset -q --hard origin/master; } \
|| git reset -q --hard "refs/tags/${1}" \
|| git reset -q --hard "refs/tags/go${1}"
|| git reset -q --hard "refs/tags/${1}" \
|| git reset -q --hard "refs/tags/go${1}"
} 2>/dev/null)
}

Expand Down Expand Up @@ -253,12 +253,12 @@ _env() {
# Tools like `gimme` are the reason that GOROOT-in-env exists.

echo
if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTOS)" = "${GIMME_OS}" ]]; then
if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTOS)" == "${GIMME_OS}" ]]; then
echo 'unset GOOS;'
else
echo 'export GOOS="'"${GIMME_OS}"'";'
fi
if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTARCH)" = "${GIMME_ARCH}" ]]; then
if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTARCH)" == "${GIMME_ARCH}" ]]; then
echo 'unset GOARCH;'
else
echo 'export GOARCH="'"${GIMME_ARCH}"'";'
Expand All @@ -281,7 +281,7 @@ _env_alias() {
return
fi

if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTOS)" = "${GIMME_OS}" && "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTARCH)" = "${GIMME_ARCH}" ]]; then
if [[ "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTOS)" == "${GIMME_OS}" && "$(GOROOT="${1}" "${1}/bin/go" env GOHOSTARCH)" == "${GIMME_ARCH}" ]]; then
local dest="${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.env"
cp "${2}" "${dest}"
ln -sf "${dest}" "${GIMME_ENV_PREFIX}/latest.env"
Expand Down Expand Up @@ -390,7 +390,7 @@ _list_versions() {
local cleaned="${d##*/go}"
cleaned="${cleaned%%.${GIMME_OS}.*}"
echo -en "${cleaned}"
if [[ "${cleaned}" = "${current_version}" ]]; then
if [[ "${cleaned}" == "${current_version}" ]]; then
echo -en ' <= current' >&2
fi
echo
Expand Down Expand Up @@ -423,8 +423,12 @@ _realpath() {

_get_curr_stable() {
local stable="${GIMME_VERSION_PREFIX}/stable"
local now_secs
now_secs="$(date +%s)"
local stable_age
stable_age="$(_stat_unix "${stable}" 2>/dev/null || echo 0)"
local age
age=$(($(date +%s) - $(_stat_unix "${stable}" 2>/dev/null || echo 0)))
age=$((now_secs - stable_age))

if [[ "${age}" -gt 86400 ]]; then
_update_stable "${stable}"
Expand Down Expand Up @@ -610,7 +614,7 @@ case "${GIMME_ARCH}" in
echo >&2 "try go1.5 or newer"
exit 1
fi
if [[ "${GIMME_HOSTOS}" = "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then
if [[ "${GIMME_HOSTOS}" == "linux" && "${GIMME_HOSTARCH}" != "${GIMME_ARCH}" ]]; then
: "${GIMME_CC_FOR_TARGET:="aarch64-linux-gnu-gcc"}"
fi
;;
Expand Down
8 changes: 4 additions & 4 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _test_native() {
echo "---> eval \$(./gimme ${v})"
(
eval "$(./gimme "${v}")"
[[ "$(go env GOOS)" = "$(go env GOHOSTOS)" && "$(go env GOARCH)" = "$(go env GOHOSTARCH)" ]] || exit 1
[[ "$(go env GOOS)" == "$(go env GOHOSTOS)" && "$(go env GOARCH)" == "$(go env GOHOSTARCH)" ]] || exit 1
) || exit 1
done
}
Expand All @@ -31,7 +31,7 @@ _test_arm() {
echo "---> eval \$(GIMME_OS=linux GIMME_ARCH=arm ./gimme ${v})"
(
eval "$(GIMME_OS=linux GIMME_ARCH=arm ./gimme "${v}")"
[[ "$(go env GOOS)" = 'linux' && "$(go env GOARCH)" = 'arm' ]] || exit 1
[[ "$(go env GOOS)" == 'linux' && "$(go env GOARCH)" == 'arm' ]] || exit 1
) || exit 1
done
}
Expand All @@ -42,11 +42,11 @@ _test_arm64() {
echo "---> skipping ${v} because it probably won't work o_o"
continue
fi
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then cgo=1; else cgo=0; fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cgo=1; else cgo=0; fi
echo "---> eval \$(GIMME_OS=linux GIMME_ARCH=arm64 GIMME_CGO_ENABLED=$cgo ./gimme $v)"
(
eval "$(GIMME_OS=linux GIMME_ARCH=arm64 GIMME_CGO_ENABLED=$cgo ./gimme "${v}")"
[[ "$(go env GOOS)" = 'linux' && "$(go env GOARCH)" = 'arm64' ]] || exit 1
[[ "$(go env GOOS)" == 'linux' && "$(go env GOARCH)" == 'arm64' ]] || exit 1
) || exit 1
done
}
Expand Down