Skip to content

Commit 739637f

Browse files
committed
mod+tools: add dummy import for CLI dependencies
With go 1.16 something changed in how the content of go.sum is calculated. The "go mod tidy" command now removes dependencies for packages that aren't directly referenced through the main package. Therefore if we compile another binary (such as the CLI binaries we ship together with LiT) some of their dependencies might have been pruned from go.sum. To avoid that, we add dummy imports for those packages under a build tag that we don't actually use. The "tools" tag seems to be the idiomatic tag for such tooling depencencies.
1 parent 4e8db16 commit 739637f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
335335
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
336336
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
337337
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
338+
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
338339
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
339340
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
340341
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc h1:yUaosFVTJwnltaHbSNC3i82I92quFs+OFPRl8kNMVwo=

tools.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// +build tools
2+
3+
package terminal
4+
5+
import (
6+
// This is a workaround to make sure go mod keeps around the
7+
// dependencies in the go.sum file that we only use during compilation
8+
// of the CLI binaries that are delivered together with LiT.
9+
_ "github.com/lightninglabs/faraday/cmd/frcli"
10+
_ "github.com/lightninglabs/loop/cmd/loop"
11+
_ "github.com/lightninglabs/pool/cmd/pool"
12+
_ "github.com/lightningnetwork/lnd/cmd/lncli"
13+
)

0 commit comments

Comments
 (0)