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

Commit 88d47c6

Browse files
committed
Basic installer script + sha256 checksums.
Fixes #421. Also see install script mention in #418.
1 parent bd390c8 commit 88d47c6

File tree

4 files changed

+53
-23
lines changed

4 files changed

+53
-23
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ go:
99
- 1.9.x
1010
script: go test -v . ./regressiontests
1111
before_deploy:
12-
- ./package.sh
12+
- ./scripts/package.sh
1313
deploy:
1414
provider: releases
1515
api_key:
@@ -18,7 +18,10 @@ deploy:
1818
file:
1919
- dist/gometalinter-*.zip
2020
- dist/gometalinter-*.tar.bz2
21+
- dist/gometalinter-*.sha256
2122
skip_cleanup: true
2223
on:
2324
tags: true
2425
repo: alecthomas/gometalinter
26+
condition: $TRAVIS_GO_VERSION =~ ^1\.9\.[0-9]+$
27+

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
<!-- MarkdownTOC -->
55

6+
- [Installing](#installing)
67
- [Editor integration](#editor-integration)
78
- [Supported linters](#supported-linters)
89
- [Configuration file](#configuration-file)
9-
- [Installing](#installing)
10+
- [`Format` key](#format-key)
11+
- [Format Methods](#format-methods)
12+
- [Adding Custom linters](#adding-custom-linters)
1013
- [Comment directives](#comment-directives)
1114
- [Quickstart](#quickstart)
1215
- [FAQ](#faq)
@@ -39,6 +42,16 @@ eg.
3942

4043
It is intended for use with editor/IDE integration.
4144

45+
## Installing
46+
47+
There are two options for installing gometalinter.
48+
49+
1. Install a stable version, eg. `go get -u gopkg.in/alecthomas/gometalinter.v2`.
50+
I will generally only tag a new stable version when it has passed the Travis
51+
regression tests. The downside is that the binary will be called `gometalinter.v2`.
52+
2. Install from HEAD with: `go get -u github.com/alecthomas/gometalinter`.
53+
This has the downside that changes to gometalinter may break.
54+
4255
## Editor integration
4356

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

164-
## Installing
165-
166-
There are two options for installing gometalinter.
167-
168-
1. Install a stable version, eg. `go get -u gopkg.in/alecthomas/gometalinter.v2`.
169-
I will generally only tag a new stable version when it has passed the Travis
170-
regression tests. The downside is that the binary will be called `gometalinter.v2`.
171-
2. Install from HEAD with: `go get -u github.com/alecthomas/gometalinter`.
172-
This has the downside that changes to gometalinter may break.
173-
174177
## Comment directives
175178

176179
gometalinter supports suppression of linter messages via comment directives. The

scripts/installer.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
set -e
3+
4+
TAR_FILE="/tmp/gometalinter.tar.gz"
5+
RELEASES_URL="https://github.com/gometalinter/gometalinter/releases"
6+
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
7+
8+
last_version() {
9+
curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" |
10+
rev |
11+
cut -f1 -d'/'|
12+
rev
13+
}
14+
15+
download() {
16+
test -z "$VERSION" && VERSION="$(last_version)"
17+
test -z "$VERSION" && {
18+
echo "Unable to get gometalinter version." >&2
19+
exit 1
20+
}
21+
rm -f "$TAR_FILE"
22+
curl -s -L -o "$TAR_FILE" \
23+
"$RELEASES_URL/download/$VERSION/gometalinter_$(uname -s)_$(uname -m).tar.gz"
24+
}
25+
26+
download
27+
tar -xf "$TAR_FILE" -C "$TMPDIR"
28+
"${TMPDIR}/gometalinter" "$@"

package.sh renamed to scripts/package.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ function install_go_binary() {
5959

6060
function packager() {
6161
if [ "$GOOS" = "windows" ]; then
62-
zip -9 -r -o "${1}".zip "${1}"
62+
zip -9 -r -o "${1}".zip "${1}" 1>&2
63+
echo "${1}".zip
6364
else
64-
tar cvfj "${1}".tar.bz2 "${1}"
65+
tar cvfj "${1}".tar.bz2 "${1}" 1>&2
66+
echo "${1}".tar.bz2
6567
fi
6668
}
6769

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

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

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

0 commit comments

Comments
 (0)