mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
feat: add check unused package. (#85)
This commit is contained in:
parent
b5b13e8b72
commit
9651a4eb6c
@ -21,6 +21,7 @@ pipeline:
|
|||||||
- make vet
|
- make vet
|
||||||
- make lint
|
- make lint
|
||||||
# - make test
|
# - make test
|
||||||
|
- make test-vendor
|
||||||
- coverage all
|
- coverage all
|
||||||
- make coverage
|
- make coverage
|
||||||
- make build
|
- make build
|
||||||
|
14
Makefile
14
Makefile
@ -14,6 +14,7 @@ GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
|
|||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
TAGS ?=
|
TAGS ?=
|
||||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||||
|
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir')
|
||||||
|
|
||||||
ifneq ($(shell uname), Darwin)
|
ifneq ($(shell uname), Darwin)
|
||||||
EXTLDFLAGS = -extldflags "-static" $(null)
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
||||||
@ -39,6 +40,19 @@ fmt-check:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
.PHONY: test-vendor
|
||||||
|
test-vendor:
|
||||||
|
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
go get -u github.com/kardianos/govendor; \
|
||||||
|
fi
|
||||||
|
govendor list +unused | tee "$(TMPDIR)/wc-gitea-unused"
|
||||||
|
[ $$(cat "$(TMPDIR)/wc-gitea-unused" | wc -l) -eq 0 ] || echo "Warning: /!\\ Some vendor are not used /!\\"
|
||||||
|
|
||||||
|
govendor list +outside | tee "$(TMPDIR)/wc-gitea-outside"
|
||||||
|
[ $$(cat "$(TMPDIR)/wc-gitea-outside" | wc -l) -eq 0 ] || exit 1
|
||||||
|
|
||||||
|
govendor status || exit 1
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
$(GOFMT) -w $(GOFILES)
|
$(GOFMT) -w $(GOFILES)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user