Merge pull request #30 from matrix-org/rav/go_mod_prep
Preparation for switching to go modules
This commit is contained in:
commit
cd504c24e6
3 changed files with 13 additions and 8 deletions
|
@ -1,10 +1,8 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- "1.9"
|
|
||||||
- "1.10"
|
|
||||||
- "1.11"
|
- "1.11"
|
||||||
install:
|
install:
|
||||||
- go get github.com/constabulary/gb/...
|
- go get github.com/constabulary/gb/...
|
||||||
- go get github.com/golang/lint/golint
|
- go get golang.org/x/lint/golint
|
||||||
- go get github.com/fzipp/gocyclo
|
- go get github.com/fzipp/gocyclo
|
||||||
script: ./hooks/pre-commit
|
script: ./hooks/pre-commit
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Web service which collects and serves bug reports.
|
Web service which collects and serves bug reports.
|
||||||
|
|
||||||
rageshake requires Go version 1.9 or later.
|
rageshake requires Go version 1.11 or later.
|
||||||
|
|
||||||
To run it, do:
|
To run it, do:
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# make the GIT_DIR and GIT_INDEX_FILE absolute, before we change dir
|
# make git_dir and GIT_INDEX_FILE absolute, before we change dir
|
||||||
export GIT_DIR=$(readlink -f `git rev-parse --git-dir`)
|
#
|
||||||
|
# (don't actually set GIT_DIR, because it messes up `go get`, and several of
|
||||||
|
# the go commands run `go get` indirectly)
|
||||||
|
#
|
||||||
|
git_dir=$(readlink -f `git rev-parse --git-dir`)
|
||||||
if [ -n "${GIT_INDEX_FILE:+x}" ]; then
|
if [ -n "${GIT_INDEX_FILE:+x}" ]; then
|
||||||
export GIT_INDEX_FILE=$(readlink -f "$GIT_INDEX_FILE")
|
export GIT_INDEX_FILE=$(readlink -f "$GIT_INDEX_FILE")
|
||||||
fi
|
fi
|
||||||
|
@ -19,7 +23,7 @@ cd "$tmpdir"
|
||||||
# get a clean copy of the index (ie, what has been `git add`ed), so that we can
|
# get a clean copy of the index (ie, what has been `git add`ed), so that we can
|
||||||
# run the checks against what we are about to commit, rather than what is in
|
# run the checks against what we are about to commit, rather than what is in
|
||||||
# the working copy.
|
# the working copy.
|
||||||
git checkout-index -a
|
git --git-dir="${git_dir}" checkout-index -a
|
||||||
|
|
||||||
# run our checks
|
# run our checks
|
||||||
golint src/...
|
golint src/...
|
||||||
|
@ -28,6 +32,9 @@ go tool vet --shadow ./src
|
||||||
gocyclo -over 12 src/
|
gocyclo -over 12 src/
|
||||||
gb test
|
gb test
|
||||||
|
|
||||||
|
# we're done with go so can set GIT_DIR
|
||||||
|
export GIT_DIR="$git_dir"
|
||||||
|
|
||||||
# if there are no changes from the index, we are done
|
# if there are no changes from the index, we are done
|
||||||
git diff --quiet && exit 0
|
git diff --quiet && exit 0
|
||||||
|
|
||||||
|
|
Reference in a new issue