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:
parent
be529349bb
commit
1c17562f07
@ -5,6 +5,7 @@ go:
|
||||
before_install:
|
||||
- go get -t -v ./...
|
||||
script:
|
||||
- make lint
|
||||
- bash coverage.sh
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
26
Makefile
26
Makefile
@ -112,3 +112,29 @@ endif
|
||||
|
||||
clean:
|
||||
@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:
|
||||
|
@ -1,14 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
go test -v -race ./...
|
||||
|
||||
echo "" > coverage.txt
|
||||
|
||||
for d in $(go list ./... | grep -v vendor); do
|
||||
# Running with -race and -covermode=atomic generates false positives so
|
||||
# we run the -race bit separately
|
||||
go test -coverprofile=profile.out -covermode=atomic $d
|
||||
go test -race -coverprofile=profile.out -covermode=atomic $d
|
||||
if [ -f profile.out ]; then
|
||||
cat profile.out >> coverage.txt
|
||||
rm profile.out
|
||||
|
Loading…
x
Reference in New Issue
Block a user