Skip to content

Commit c3cad46

Browse files
committed
multi: fix linter issues
1 parent 843a3fc commit c3cad46

File tree

10 files changed

+14
-29
lines changed

10 files changed

+14
-29
lines changed

cmd/litd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77

88
"github.com/jessevdk/go-flags"
9-
"github.com/lightninglabs/lightning-terminal"
9+
terminal "github.com/lightninglabs/lightning-terminal"
1010
)
1111

1212
// main starts the lightning-terminal application.

config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,12 @@ func buildTLSConfigForHttp2(config *Config) (*tls.Config, error) {
758758
log.Infof("Listening for Let's Encrypt challenges on "+
759759
"%v", config.LetsEncryptListen)
760760

761-
err := http.ListenAndServe(
762-
config.LetsEncryptListen,
763-
manager.HTTPHandler(nil),
764-
)
761+
srv := &http.Server{
762+
Addr: config.LetsEncryptListen,
763+
ReadHeaderTimeout: 3 * time.Second,
764+
Handler: manager.HTTPHandler(nil),
765+
}
766+
err := srv.ListenAndServe()
765767
if err != nil {
766768
log.Errorf("Error starting Let's Encrypt "+
767769
"HTTP listener on port 80: %v", err)

itest/litd_mode_integrated_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ func runUIPasswordCheck(t *testing.T, hostPort, tlsCertPath, uiPassword string,
495495
// provide a dummy macaroon but still the UI password must be
496496
// correct to pass.
497497
ctxm = uiPasswordContext(ctxt, uiPassword, true)
498-
resp, err = makeRequest(ctxm, rawConn)
498+
_, err = makeRequest(ctxm, rawConn)
499499

500500
require.Error(t, err)
501501
require.Contains(

itest/litd_node.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,6 @@ func (hn *HarnessNode) waitForState(conn grpc.ClientConnInterface,
728728
}()
729729

730730
select {
731-
732731
case <-started:
733732
case err = <-errChan:
734733

@@ -888,7 +887,6 @@ func (hn *HarnessNode) waitTillServerStarted() error {
888887
return nil
889888
}
890889
}
891-
892890
}
893891

894892
// initLightningClient constructs the grpc LightningClient from the given client
@@ -1258,7 +1256,6 @@ func (hn *HarnessNode) lightningNetworkWatcher() {
12581256

12591257
for {
12601258
select {
1261-
12621259
// A new graph update has just been received, so we'll examine
12631260
// the current set of registered clients to see if we can
12641261
// dispatch any requests.
@@ -1779,7 +1776,6 @@ func (hn *HarnessNode) getChannelPolicies(include bool) policyUpdateMap {
17791776
policyUpdates := policyUpdateMap{}
17801777

17811778
for _, e := range graph.Edges {
1782-
17831779
policies := policyUpdates[e.ChanPoint]
17841780

17851781
// If the map[op] is nil, we need to initialize the map first.

itest/litd_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,8 @@ func TestLightningTerminal(t *testing.T) {
9494
// case should naturally as a result and we log the server error here to
9595
// help debug.
9696
go func() {
97-
for {
98-
select {
99-
case err, more := <-litdHarness.ProcessErrors():
100-
if !more {
101-
return
102-
}
103-
ht.Logf("litd finished with error (stderr):\n%v",
104-
err)
105-
}
97+
for err := range litdHarness.ProcessErrors() {
98+
ht.Logf("litd finished with error (stderr):\n%v", err)
10699
}
107100
}()
108101

itest/network_harness.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ out:
234234

235235
if aliceResp.ConfirmedBalance == expectedBalance &&
236236
bobResp.ConfirmedBalance == expectedBalance {
237+
237238
break out
238239
}
239240
case <-balanceTimeout:
@@ -259,7 +260,6 @@ func (n *NetworkHarness) TearDown() error {
259260
func (n *NetworkHarness) Stop() {
260261
close(n.lndErrorChan)
261262
close(n.quit)
262-
263263
}
264264

265265
// NewNode initializes a new HarnessNode.
@@ -420,7 +420,6 @@ func (n *NetworkHarness) EnsureConnected(t *testing.T, a, b *HarnessNode) {
420420
predErr = err
421421
return false
422422
}
423-
424423
}, lntest.DefaultTimeout)
425424
if err != nil {
426425
return fmt.Errorf("connection not succeeded within 15 "+
@@ -959,6 +958,7 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode,
959958
// not.
960959
filterChannel := func(node *HarnessNode,
961960
op wire.OutPoint) (*lnrpc.Channel, error) {
961+
962962
listResp, err := node.ListChannels(ctx, listReq)
963963
if err != nil {
964964
return nil, err

itest/test_harness.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func (h *harnessTest) Fatalf(format string, a ...interface{}) {
7979
// RunTestCase executes a harness test case. Any errors or panics will be
8080
// represented as fatal.
8181
func (h *harnessTest) RunTestCase(testCase *testCase) {
82-
8382
h.testCase = testCase
8483
defer func() {
8584
h.testCase = nil

session/metadata.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func syncVersions(db *bbolt.DB) error {
8181
"db_version=%v", latestDBVersion, currentVersion)
8282

8383
switch {
84-
8584
// If the database reports a higher version that we are aware of, the
8685
// user is probably trying to revert to a prior version of lnd. We fail
8786
// here to prevent reversions and unintended corruption.

session/tlv.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828

2929
// typeMacaroon is no longer used, but we leave it defined for backwards
3030
// compatibility.
31-
typeMacaroon tlv.Type = 8
31+
typeMacaroon tlv.Type = 8 // nolint
3232

3333
typeMacPerms tlv.Type = 1
3434
typeMacCaveats tlv.Type = 2
@@ -182,7 +182,6 @@ func DeserializeSession(r io.Reader) (*Session, error) {
182182
// macaroonRecipeEncoder is a custom TLV encoder for a MacaroonRecipe record.
183183
func macaroonRecipeEncoder(w io.Writer, val interface{}, buf *[8]byte) error {
184184
if v, ok := val.(*MacaroonRecipe); ok {
185-
186185
var recipeTLVBytes bytes.Buffer
187186
tlvStream, err := tlv.NewStream(
188187
tlv.MakeDynamicRecord(
@@ -225,7 +224,6 @@ func macaroonRecipeDecoder(r io.Reader, val interface{}, buf *[8]byte,
225224
l uint64) error {
226225

227226
if v, ok := val.(*MacaroonRecipe); ok {
228-
229227
// Using this information, we'll create a new limited
230228
// reader that'll return an EOF once the end has been
231229
// reached so the stream stops consuming bytes.

session/tlv_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import (
1313
)
1414

1515
var (
16-
testRootKey = []byte("54321")
17-
testID = []byte("dummyId")
18-
testLocation = "lnd"
16+
testRootKey = []byte("54321")
1917

2018
perms = []bakery.Op{
2119
{

0 commit comments

Comments
 (0)