Merge pull request #2162 from halseth/make-goimports

[Makefile] Define `make imports`
This commit is contained in:
Johan T. Halseth 2021-01-29 08:54:00 +01:00 committed by GitHub
commit 10a81e01e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

@ -46,7 +46,7 @@ GOINSTALL := GO111MODULE=on go install -v
GOTEST := GO111MODULE=on go test GOTEST := GO111MODULE=on go test
GOVERSION := $(shell go version | awk '{print $$3}') GOVERSION := $(shell go version | awk '{print $$3}')
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go")
RM := rm -f RM := rm -f
CP := cp CP := cp
@ -245,7 +245,9 @@ fuzz-run: $(GOFUZZ_BIN)
# UTILITIES # UTILITIES
# ========= # =========
fmt: fmt: goimports
@$(call print, "Fixing imports.")
goimports -w $(GOFILES_NOVENDOR)
@$(call print, "Formatting source.") @$(call print, "Formatting source.")
gofmt -l -w -s $(GOFILES_NOVENDOR) gofmt -l -w -s $(GOFILES_NOVENDOR)

@ -8,7 +8,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/grpc-ecosystem/go-grpc-prometheus" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lncfg"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
) )