CI: also use go tool for gosimports

This commit is contained in:
ziggie authored and yyforyongyu committed 2025-11-12 22:54:02 +08:00
1 parent d2d56f2968
commit b6dd3a32f7
2 files changed
+7 -8

No files matched your search

+6 -7
View File
@@ -1,16 +1,19 @@
PKG := github.com/lightningnetwork/lnd PKG := github.com/lightningnetwork/lnd
MOBILE_PKG := $(PKG)/mobile MOBILE_PKG := $(PKG)/mobile
TOOLS_DIR := tools TOOLS_DIR := tools
TOOLS_MOD := $(TOOLS_DIR)/go.mod
GOCC ?= go GOCC ?= go
PREFIX ?= /usr/local PREFIX ?= /usr/local
GOTOOL := GOWORK=off $(GOCC) tool -modfile=$(TOOLS_MOD)
BTCD_PKG := github.com/btcsuite/btcd BTCD_PKG := github.com/btcsuite/btcd
GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports
GO_BIN := ${GOPATH}/bin GO_BIN := ${GOPATH}/bin
BTCD_BIN := $(GO_BIN)/btcd BTCD_BIN := $(GO_BIN)/btcd
GOIMPORTS_BIN := $(GO_BIN)/gosimports
GOMOBILE_BIN := $(GO_BIN)/gomobile GOMOBILE_BIN := $(GO_BIN)/gomobile
MOBILE_BUILD_DIR :=${GOPATH}/src/$(MOBILE_PKG)/build MOBILE_BUILD_DIR :=${GOPATH}/src/$(MOBILE_PKG)/build
@@ -88,10 +91,6 @@ $(BTCD_BIN):
@$(call print, "Installing btcd.") @$(call print, "Installing btcd.")
cd $(TOOLS_DIR); $(GOCC) install -trimpath $(BTCD_PKG) cd $(TOOLS_DIR); $(GOCC) install -trimpath $(BTCD_PKG)
$(GOIMPORTS_BIN):
@$(call print, "Installing goimports.")
cd $(TOOLS_DIR); $(GOCC) install -trimpath $(GOIMPORTS_PKG)
# ============ # ============
# INSTALLATION # INSTALLATION
# ============ # ============
@@ -315,9 +314,9 @@ fuzz:
# ========= # =========
#? fmt: Format source code and fix imports #? fmt: Format source code and fix imports
fmt: $(GOIMPORTS_BIN) fmt:
@$(call print, "Fixing imports.") @$(call print, "Fixing imports.")
gosimports -w $(GOFILES_NOVENDOR) $(GOTOOL) $(GOIMPORTS_PKG) -w $(GOFILES_NOVENDOR)
@$(call print, "Formatting source.") @$(call print, "Formatting source.")
gofmt -l -w -s $(GOFILES_NOVENDOR) gofmt -l -w -s $(GOFILES_NOVENDOR)
+1 -1
View File
@@ -232,5 +232,5 @@ tool (
// Once golangci-lint v2.4.1 update it here. // Once golangci-lint v2.4.1 update it here.
// Also don't forget to update the .custom-gcl.yml file. // Also don't forget to update the .custom-gcl.yml file.
github.com/golangci/golangci-lint/v2/cmd/golangci-lint github.com/golangci/golangci-lint/v2/cmd/golangci-lint
github.com/rinchsan/gosimports github.com/rinchsan/gosimports/cmd/gosimports
) )