aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.tool/lint44
-rw-r--r--Makefile26
2 files changed, 49 insertions, 21 deletions
diff --git a/.tool/lint b/.tool/lint
new file mode 100755
index 000000000..a62044255
--- /dev/null
+++ b/.tool/lint
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# Create the linter path for use later
+LINTER=${GOPATH}/bin/gometalinter
+
+# Make sure gometalinter is installed
+if [ ! -f ${LINTER} ]; then
+ echo >&2 "gometalinter must be installed. Please run 'make install.tools' and try again"
+ exit 1
+fi
+
+PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*')
+
+# Execute the linter
+${LINTER} \
+ --concurrency=4\
+ --enable-gc\
+ --vendored-linters\
+ --deadline=600s --disable-all\
+ --enable=deadcode\
+ --enable=errcheck\
+ --enable=goconst\
+ --enable=gofmt\
+ --enable=golint\
+ --enable=ineffassign\
+ --enable=interfacer\
+ --enable=megacheck\
+ --enable=misspell\
+ --enable=structcheck\
+ --enable=varcheck\
+ --enable=vet\
+ --enable=vetshadow\
+ --exclude='error return value not checked.*\(errcheck\)$'\
+ --exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$'\
+ --exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$'\
+ --exclude='duplicate of.*_test.go.*\(dupl\)$'\
+ --exclude='cmd\/client\/.*\.go.*\(dupl\)$'\
+ --exclude='vendor\/.*'\
+ --exclude='server\/seccomp\/.*\.go.*$'\
+ ${PKGS[@]}
diff --git a/Makefile b/Makefile
index 235ea4a22..bf3dd44cf 100644
--- a/Makefile
+++ b/Makefile
@@ -69,7 +69,7 @@ lint: .gopathok
gofmt:
@./hack/verify-gofmt.sh
-conmon:
+bin/conmon:
$(MAKE) -C $@
test/bin2img/bin2img: .gopathok $(wildcard test/bin2img/*.go)
@@ -81,7 +81,7 @@ test/copyimg/copyimg: .gopathok $(wildcard test/copyimg/*.go)
test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
$(GO) build $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/checkseccomp
-kpod: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/kpod $(PROJECT))
+bin/kpod: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/kpod $(PROJECT))
$(GO) build $(LDFLAGS_KPOD) -tags "$(BUILDTAGS)" -o bin/$@ $(PROJECT)/cmd/kpod
clean:
@@ -89,7 +89,7 @@ ifneq ($(GOPATH),)
rm -f "$(GOPATH)/.gopathok"
endif
rm -rf _output
- rm -f docs/*.1 docs/*.5 docs/*.8
+ rm -f docs/*.1
rm -fr test/testdata/redis-image
find . -name \*~ -delete
find . -name \#\* -delete
@@ -114,7 +114,7 @@ testunit:
localintegration: clean binaries test-binaries
./test/test_runner.sh ${TESTFLAGS}
-binaries: conmon kpod
+binaries: bin/conmon bin/kpod
test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp
MANPAGES_MD := $(wildcard docs/*.md)
@@ -123,12 +123,6 @@ MANPAGES := $(MANPAGES_MD:%.md=%)
docs/%.1: docs/%.1.md .gopathok
(go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@)
-docs/%.5: docs/%.5.md .gopathok
- (go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@)
-
-docs/%.8: docs/%.8.md .gopathok
- (go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@)
-
docs: $(MANPAGES)
install: .gopathok install.bin install.man
@@ -139,11 +133,7 @@ install.bin:
install.man:
install ${SELINUXOPT} -d -m 755 $(MANDIR)/man1
- install ${SELINUXOPT} -d -m 755 $(MANDIR)/man5
- install ${SELINUXOPT} -d -m 755 $(MANDIR)/man8
install ${SELINUXOPT} -m 644 $(filter %.1,$(MANPAGES)) -t $(MANDIR)/man1
- install ${SELINUXOPT} -m 644 $(filter %.5,$(MANPAGES)) -t $(MANDIR)/man5
- install ${SELINUXOPT} -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8
install.config:
install ${SELINUXOPT} -D -m 644 seccomp.json $(ETCDIR_CRIO)/seccomp.json
@@ -156,13 +146,7 @@ install.completions:
uninstall:
rm -f $(LIBEXECDIR)/crio/conmon
for i in $(filter %.1,$(MANPAGES)); do \
- rm -f $(MANDIR)/man8/$$(basename $${i}); \
- done
- for i in $(filter %.5,$(MANPAGES)); do \
- rm -f $(MANDIR)/man5/$$(basename $${i}); \
- done
- for i in $(filter %.8,$(MANPAGES)); do \
- rm -f $(MANDIR)/man8/$$(basename $${i}); \
+ rm -f $(MANDIR)/man1/$$(basename $${i}); \
done
.PHONY: .gitvalidation