mirror of
https://github.com/lightninglabs/faraday.git
synced 2026-08-13 12:33:35 +02:00
multi: add check for imports order and add to travis
Use external to to verify that imports are in the following groups: - standard packages - external packages - faraday packages
This commit is contained in:
parent
2415b5d866
commit
562c26c096
2 changed files with 14 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ jobs:
|
|||
- make mod-check
|
||||
- make rpc-check
|
||||
- make build
|
||||
- make imports
|
||||
name: Build and lint
|
||||
- stage: Tests
|
||||
script: make unit
|
||||
|
|
|
|||
13
Makefile
13
Makefile
|
|
@ -5,10 +5,14 @@ LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
|
|||
GOVERALLS_PKG := github.com/mattn/goveralls
|
||||
GOACC_PKG := github.com/ory/go-acc
|
||||
|
||||
IMPORTS_PKG := github.com/pavius/impi/cmd/impi
|
||||
IMPORTS_COMMIT := 3cdbde3d3cbb0ead2b9491272bccb5c652174656
|
||||
|
||||
GO_BIN := ${GOPATH}/bin
|
||||
GOVERALLS_BIN := $(GO_BIN)/goveralls
|
||||
LINT_BIN := $(GO_BIN)/golangci-lint
|
||||
GOACC_BIN := $(GO_BIN)/go-acc
|
||||
IMPORTS_BIN := $(GO_BIN)/impi
|
||||
|
||||
COMMIT := $(shell git describe --abbrev=40 --dirty)
|
||||
LDFLAGS := -ldflags "-X $(PKG).Commit=$(COMMIT)"
|
||||
|
|
@ -55,6 +59,10 @@ $(GOACC_BIN):
|
|||
@$(call print, "Fetching go-acc")
|
||||
$(DEPGET) $(GOACC_PKG)@$(GOACC_COMMIT)
|
||||
|
||||
$(IMPORTS_BIN):
|
||||
@$(call print, "Fetching imports check")
|
||||
$(DEPGET) $(IMPORTS_PKG)@$(IMPORTS_COMMIT)
|
||||
|
||||
# ============
|
||||
# INSTALLATION
|
||||
# ============
|
||||
|
|
@ -118,6 +126,11 @@ fmt:
|
|||
@$(call print, "Formatting source.")
|
||||
gofmt -l -w -s $(GOFILES_NOVENDOR)
|
||||
|
||||
imports: $(IMPORTS_BIN)
|
||||
@$(call print, "Checking imports.")
|
||||
$(IMPORTS_BIN) --local github.com/lightninglabs/faraday/ --scheme stdThirdPartyLocal --ignore-generated=true *
|
||||
|
||||
|
||||
lint: $(LINT_BIN)
|
||||
@$(call print, "Linting source.")
|
||||
$(LINT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue