1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Add lint Makefile target

This commit is contained in:
Achilleas Anagnostopoulos 2017-05-15 06:55:14 +01:00
parent be529349bb
commit 1c17562f07
3 changed files with 28 additions and 5 deletions

View File

@ -5,6 +5,7 @@ go:
before_install: before_install:
- go get -t -v ./... - go get -t -v ./...
script: script:
- make lint
- bash coverage.sh - bash coverage.sh
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)

View File

@ -112,3 +112,29 @@ endif
clean: clean:
@test -d $(BUILD_DIR) && rm -rf $(BUILD_DIR) || true @test -d $(BUILD_DIR) && rm -rf $(BUILD_DIR) || true
lint: lint-check-deps
@echo "[gometalinter] linting sources"
@gometalinter.v1 \
--disable-all \
--enable=deadcode \
--enable=errcheck \
--enable=gosimple \
--enable=ineffassign \
--enable=misspell \
--enable=staticcheck \
--enable=vet \
--enable=vetshadow \
--enable=unconvert \
--enable=varcheck \
--enable=golint \
--deadline 300s \
--exclude 'return value not checked' \
--exclude 'possible misuse of unsafe.Pointer' \
./...
lint-check-deps:
@go get -u gopkg.in/alecthomas/gometalinter.v1
@gometalinter.v1 --install >/dev/null
test:

View File

@ -1,14 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
go test -v -race ./...
echo "" > coverage.txt echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do for d in $(go list ./... | grep -v vendor); do
# Running with -race and -covermode=atomic generates false positives so go test -race -coverprofile=profile.out -covermode=atomic $d
# we run the -race bit separately
go test -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then if [ -f profile.out ]; then
cat profile.out >> coverage.txt cat profile.out >> coverage.txt
rm profile.out rm profile.out