Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit 6319b94

Browse files
committed
Add CI
1 parent c989459 commit 6319b94

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
22
bin
3+
.vscode

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: go
2+
3+
go:
4+
- 1.12.x
5+
env:
6+
- GO111MODULE=on
7+
script:
8+
- ./ci/ensuremod.sh
9+
- ./ci/lint.sh
10+
- go test -v ./...

ci/ensuremod.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# inspired by nhooyr's days as CI overlord
4+
5+
set -eou pipefail
6+
7+
function help() {
8+
echo
9+
echo "you may need to update go.mod/go.sum via:"
10+
echo "go list all > /dev/null"
11+
echo "go mod tidy"
12+
exit 1
13+
}
14+
15+
go list -mod=readonly all > /dev/null
16+
17+
go mod tidy
18+
19+
if [[ $(git diff --name-only) != "" ]]; then
20+
git diff
21+
help
22+
fi

ci/lint.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Inspired by nhooyr's days as CI overlord.
4+
5+
set -euo pipefail
6+
7+
files=$(gofmt -l -s .)
8+
9+
if [ ! -z "$files" ];
10+
then
11+
echo "The following files need to be formatted:"
12+
echo "$files"
13+
echo "Please run 'gofmt -w -s .'"
14+
exit 1
15+
fi
16+
17+
go vet -composites=false .

0 commit comments

Comments
 (0)