Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Commit

Permalink
Basic installer script + sha256 checksums.
Browse files Browse the repository at this point in the history
Fixes #421.

Also see install script mention in #418.
  • Loading branch information
alecthomas committed Jan 9, 2018
1 parent bd390c8 commit 88d47c6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go:
- 1.9.x
script: go test -v . ./regressiontests
before_deploy:
- ./package.sh
- ./scripts/package.sh
deploy:
provider: releases
api_key:
Expand All @@ -18,7 +18,10 @@ deploy:
file:
- dist/gometalinter-*.zip
- dist/gometalinter-*.tar.bz2
- dist/gometalinter-*.sha256
skip_cleanup: true
on:
tags: true
repo: alecthomas/gometalinter
condition: $TRAVIS_GO_VERSION =~ ^1\.9\.[0-9]+$

25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

<!-- MarkdownTOC -->

- [Installing](#installing)
- [Editor integration](#editor-integration)
- [Supported linters](#supported-linters)
- [Configuration file](#configuration-file)
- [Installing](#installing)
- [`Format` key](#format-key)
- [Format Methods](#format-methods)
- [Adding Custom linters](#adding-custom-linters)
- [Comment directives](#comment-directives)
- [Quickstart](#quickstart)
- [FAQ](#faq)
Expand Down Expand Up @@ -39,6 +42,16 @@ eg.

It is intended for use with editor/IDE integration.

## Installing

There are two options for installing gometalinter.

1. Install a stable version, eg. `go get -u gopkg.in/alecthomas/gometalinter.v2`.
I will generally only tag a new stable version when it has passed the Travis
regression tests. The downside is that the binary will be called `gometalinter.v2`.
2. Install from HEAD with: `go get -u github.com/alecthomas/gometalinter`.
This has the downside that changes to gometalinter may break.

## Editor integration

- [SublimeLinter plugin](https://github.com/alecthomas/SublimeLinter-contrib-gometalinter).
Expand Down Expand Up @@ -161,16 +174,6 @@ Example:
$ gometalinter --linter='vet:go tool vet -printfuncs=Infof,Debugf,Warningf,Errorf:PATH:LINE:MESSAGE' .
```

## Installing

There are two options for installing gometalinter.

1. Install a stable version, eg. `go get -u gopkg.in/alecthomas/gometalinter.v2`.
I will generally only tag a new stable version when it has passed the Travis
regression tests. The downside is that the binary will be called `gometalinter.v2`.
2. Install from HEAD with: `go get -u github.com/alecthomas/gometalinter`.
This has the downside that changes to gometalinter may break.

## Comment directives

gometalinter supports suppression of linter messages via comment directives. The
Expand Down
28 changes: 28 additions & 0 deletions scripts/installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
set -e

TAR_FILE="/tmp/gometalinter.tar.gz"
RELEASES_URL="https://github.com/gometalinter/gometalinter/releases"
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"

last_version() {
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
rev |
cut -f1 -d'/'|
rev
}

download() {
test -z "$VERSION" && VERSION="$(last_version)"
test -z "$VERSION" && {
echo "Unable to get gometalinter version." >&2
exit 1
}
rm -f "$TAR_FILE"
curl -s -L -o "$TAR_FILE" \
"$RELEASES_URL/download/$VERSION/gometalinter_$(uname -s)_$(uname -m).tar.gz"
}

download
tar -xf "$TAR_FILE" -C "$TMPDIR"
"${TMPDIR}/gometalinter" "$@"
18 changes: 7 additions & 11 deletions package.sh → scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ function install_go_binary() {

function packager() {
if [ "$GOOS" = "windows" ]; then
zip -9 -r -o "${1}".zip "${1}"
zip -9 -r -o "${1}".zip "${1}" 1>&2
echo "${1}".zip
else
tar cvfj "${1}".tar.bz2 "${1}"
tar cvfj "${1}".tar.bz2 "${1}" 1>&2
echo "${1}".tar.bz2
fi
}

Expand All @@ -78,14 +80,7 @@ for GOOS in linux darwin windows; do
DEST="${PWD}/dist/gometalinter-${TAG}-${GOOS}-${GOARCH}"
install -d -m 755 "${DEST}/linters"
install -m 644 COPYING "${DEST}"
cat << EOF > "${DEST}/README.txt"
gometalinter is a tool to normalise the output of Go linters.
See https://github.com/alecthomas/gometalinter for more information.
This is a binary distribution of gometalinter ${TAG}.
All binaries must be installed in the PATH for gometalinter to operate correctly.
EOF
install -m 644 README.md "${DEST}"
echo "${DEST}"
export GOOS GOARCH

Expand All @@ -99,6 +94,7 @@ EOF
install_go_binary $(basename ${LINTER}) "${DEST}/linters"
done

(cd "${DEST}/.." && packager "$(basename ${DEST})")
OUTPUT="$(cd "${PWD}/dist" && packager "$(basename ${DEST})")"
(cd "${PWD}/dist" && shasum -a 256 "${OUTPUT}" > "${OUTPUT}.sha256")
done
done

0 comments on commit 88d47c6

Please sign in to comment.