What changed, and why it matters
This commit is a routine build/CI maintenance change. It switches how a code-formatting tool (gosimports) is invoked in the project's Makefile, using Go's newer 'go tool' mechanism instead of installing a separate binary. There is no security-relevant change to the actual Lightning Network Daemon software or its users.
No security action required. Treat as normal CI/tooling hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies the Makefile to invoke gosimports via ‘GOWORK=off $(GOCC) tool -modfile=tools/go.mod github.com/rinchsan/gosimports/cmd/gosimports’ rather than pre-installing a $(GOPATH)/bin/gosimports binary. It also updates tools/go.mod to reference the full command path ‘github.com/rinchsan/gosimports/cmd/gosimports’ under the ‘tool’ directive. This is a tooling/dependency-management refactor with no functional code changes to lnd itself.
Changed components
Makefiletools/go.modInspect captured patch +7 / −8
diff --git a/Makefile b/Makefile
index 0b18ac4..dcef899 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,19 @@
PKG := github.com/lightningnetwork/lnd
MOBILE_PKG := $(PKG)/mobile
TOOLS_DIR := tools
+TOOLS_MOD := $(TOOLS_DIR)/go.mod
GOCC ?= go
PREFIX ?= /usr/local
+GOTOOL := GOWORK=off $(GOCC) tool -modfile=$(TOOLS_MOD)
+
+
BTCD_PKG := github.com/btcsuite/btcd
GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports
GO_BIN := ${GOPATH}/bin
BTCD_BIN := $(GO_BIN)/btcd
-GOIMPORTS_BIN := $(GO_BIN)/gosimports
GOMOBILE_BIN := $(GO_BIN)/gomobile
MOBILE_BUILD_DIR :=${GOPATH}/src/$(MOBILE_PKG)/build
@@ -88,10 +91,6 @@ $(BTCD_BIN):
@$(call print, "Installing btcd.")
cd $(TOOLS_DIR); $(GOCC) install -trimpath $(BTCD_PKG)
-$(GOIMPORTS_BIN):
- @$(call print, "Installing goimports.")
- cd $(TOOLS_DIR); $(GOCC) install -trimpath $(GOIMPORTS_PKG)
-
# ============
# INSTALLATION
# ============
@@ -315,9 +314,9 @@ fuzz:
# =========
#? fmt: Format source code and fix imports
-fmt: $(GOIMPORTS_BIN)
+fmt:
@$(call print, "Fixing imports.")
- gosimports -w $(GOFILES_NOVENDOR)
+ $(GOTOOL) $(GOIMPORTS_PKG) -w $(GOFILES_NOVENDOR)
@$(call print, "Formatting source.")
gofmt -l -w -s $(GOFILES_NOVENDOR)
diff --git a/tools/go.mod b/tools/go.mod
index e0dd635..e97047c 100644
--- a/tools/go.mod
+++ b/tools/go.mod
@@ -232,5 +232,5 @@ tool (
// Once golangci-lint v2.4.1 update it here.
// Also don't forget to update the .custom-gcl.yml file.
github.com/golangci/golangci-lint/v2/cmd/golangci-lint
- github.com/rinchsan/gosimports
+ github.com/rinchsan/gosimports/cmd/gosimports
)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.