From 233246714dad52b2fe27fbc99e2def70afdb793b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 24 Aug 2018 18:27:53 -0700 Subject: [PATCH 1/4] build+docs: bump to golang 1.11 --- .travis.yml | 2 +- docs/INSTALL.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a9086ce..d2ea1d12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - "1.9.4" - "1.10" + - "1.11" sudo: required install: - sudo add-apt-repository -y ppa:bitcoin/bitcoin -y diff --git a/docs/INSTALL.md b/docs/INSTALL.md index f7a4737c..43880710 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -7,14 +7,14 @@ * **Go:** `lnd` is written in Go. To install, run one of the following commands: - **Note**: The minimum version of Go supported is Go 1.9. We recommend that + **Note**: The minimum version of Go supported is Go 1.10. We recommend that users use the latest version of Go, which at the time of writing is - [`1.10`](https://blog.golang.org/go1.10). + [`1.11`](https://blog.golang.org/go1.11). On Linux: ``` - sudo apt-get install golang-1.10-go + sudo apt-get install golang-1.11-go ``` > Note that golang-1.10-go puts binaries in /usr/lib/go-1.10/bin. If you want them on your PATH, you need to make that change yourself. Alternatively, you can run: ``` From d8e6085c1749a5b8a75a16b82fe2e49c3bf24c92 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 7 Oct 2018 11:34:32 +0900 Subject: [PATCH 2/4] multi: update to go 1.11 gofmt --- autopilot/graph.go | 4 ++-- channeldb/graph_test.go | 14 +++++++------- htlcswitch/circuit_test.go | 4 ++-- htlcswitch/switch.go | 2 +- lnd.go | 2 +- routing/notifications_test.go | 2 +- routing/pathfind_test.go | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/autopilot/graph.go b/autopilot/graph.go index 9834c8b4..17e771bf 100644 --- a/autopilot/graph.go +++ b/autopilot/graph.go @@ -229,7 +229,7 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *btcec.PublicKey, MinHTLC: 1, FeeBaseMSat: 10, FeeProportionalMillionths: 10000, - Flags: 0, + Flags: 0, } if err := d.db.UpdateEdgePolicy(edgePolicy); err != nil { @@ -243,7 +243,7 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *btcec.PublicKey, MinHTLC: 1, FeeBaseMSat: 10, FeeProportionalMillionths: 10000, - Flags: 1, + Flags: 1, } if err := d.db.UpdateEdgePolicy(edgePolicy); err != nil { return nil, nil, err diff --git a/channeldb/graph_test.go b/channeldb/graph_test.go index eb6db864..92fcd4f1 100644 --- a/channeldb/graph_test.go +++ b/channeldb/graph_test.go @@ -704,9 +704,9 @@ func TestEdgeInfoUpdates(t *testing.T) { MinHTLC: 2342135, FeeBaseMSat: 4352345, FeeProportionalMillionths: 3452352, - Node: secondNode, - ExtraOpaqueData: []byte("new unknown feature2"), - db: db, + Node: secondNode, + ExtraOpaqueData: []byte("new unknown feature2"), + db: db, } edge2 := &ChannelEdgePolicy{ SigBytes: testSig.Serialize(), @@ -717,9 +717,9 @@ func TestEdgeInfoUpdates(t *testing.T) { MinHTLC: 2342135, FeeBaseMSat: 4352345, FeeProportionalMillionths: 90392423, - Node: firstNode, - ExtraOpaqueData: []byte("new unknown feature1"), - db: db, + Node: firstNode, + ExtraOpaqueData: []byte("new unknown feature1"), + db: db, } // Next, insert both nodes into the database, they should both be @@ -796,7 +796,7 @@ func newEdgePolicy(chanID uint64, op wire.OutPoint, db *DB, MinHTLC: lnwire.MilliSatoshi(prand.Int63()), FeeBaseMSat: lnwire.MilliSatoshi(prand.Int63()), FeeProportionalMillionths: lnwire.MilliSatoshi(prand.Int63()), - db: db, + db: db, } } diff --git a/htlcswitch/circuit_test.go b/htlcswitch/circuit_test.go index b693ebe7..7743768d 100644 --- a/htlcswitch/circuit_test.go +++ b/htlcswitch/circuit_test.go @@ -101,7 +101,7 @@ func newCircuitMap(t *testing.T) (*htlcswitch.CircuitMapConfig, onionProcessor := newOnionProcessor(t) circuitMapCfg := &htlcswitch.CircuitMapConfig{ - DB: makeCircuitDB(t, ""), + DB: makeCircuitDB(t, ""), ExtractErrorEncrypter: onionProcessor.ExtractErrorEncrypter, } @@ -660,7 +660,7 @@ func restartCircuitMap(t *testing.T, cfg *htlcswitch.CircuitMapConfig) ( // Reinitialize circuit map with same db path. cfg2 := &htlcswitch.CircuitMapConfig{ - DB: makeCircuitDB(t, dbPath), + DB: makeCircuitDB(t, dbPath), ExtractErrorEncrypter: cfg.ExtractErrorEncrypter, } cm2, err := htlcswitch.NewCircuitMap(cfg2) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 66283d8b..7c12f621 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -282,7 +282,7 @@ type Switch struct { // New creates the new instance of htlc switch. func New(cfg Config, currentHeight uint32) (*Switch, error) { circuitMap, err := NewCircuitMap(&CircuitMapConfig{ - DB: cfg.DB, + DB: cfg.DB, ExtractErrorEncrypter: cfg.ExtractErrorEncrypter, }) if err != nil { diff --git a/lnd.go b/lnd.go index e323e95d..fe2ffc8c 100644 --- a/lnd.go +++ b/lnd.go @@ -564,7 +564,7 @@ func genCertPair(certFile, keyFile string) error { KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - IsCA: true, // so can sign self. + IsCA: true, // so can sign self. BasicConstraintsValid: true, DNSNames: dnsNames, diff --git a/routing/notifications_test.go b/routing/notifications_test.go index 2fa12274..8214050f 100644 --- a/routing/notifications_test.go +++ b/routing/notifications_test.go @@ -78,7 +78,7 @@ func randEdgePolicy(chanID *lnwire.ShortChannelID, MinHTLC: lnwire.MilliSatoshi(prand.Int31()), FeeBaseMSat: lnwire.MilliSatoshi(prand.Int31()), FeeProportionalMillionths: lnwire.MilliSatoshi(prand.Int31()), - Node: node, + Node: node, } } diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index a014bfb2..fb0ab984 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -973,7 +973,7 @@ func TestNewRoute(t *testing.T) { return &ChannelHop{ ChannelEdgePolicy: &channeldb.ChannelEdgePolicy{ - Node: &channeldb.LightningNode{}, + Node: &channeldb.LightningNode{}, FeeProportionalMillionths: feeRate, FeeBaseMSat: baseFee, TimeLockDelta: timeLockDelta, From 8bc61693bf8a6ab31abfb79ae2dbf897af9f49fe Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 7 Oct 2018 13:59:29 +0900 Subject: [PATCH 3/4] build: update build file to exclude go 1.10 from linting In this commit, we modify our build file to only lint under go 1.11. We do this as there's been a breaking change in gofmt between go 1.10 and go 1.11 that causes files which pass the linter under go 1.10, to fail the linter under go 1.11. In the end, we only really need to lint using one version of go. In order to achieve this, we "unroll" the build matrix to enumerate each version and the environment variables that it should be run with. We then modify the Makefile to only include the lint directive if the particular env variable is set ($(USE_LINT)). With these two changes, we'll now only lint under go 1.11. --- .travis.yml | 17 ++++++++++------- Makefile | 13 +++++++++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2ea1d12..1922f6d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,20 @@ language: go -go: - - "1.10" - - "1.11" +matrix: + include: + - go: "1.11" + env: RACE=FALSE USE_LINT=TRUE + - go: "1.11" + env: RACE=FALSE USE_LINT=TRUE + - go: "1.10" + env: RACE=TRUE USE_LINT=FALSE + - go: "1.10" + env: RACE=FALSE USE_LINT=FALSE sudo: required install: - sudo add-apt-repository -y ppa:bitcoin/bitcoin -y - sudo apt-get update -q - sudo apt-get install bitcoind -y - export PATH=$PATH:$PWD/linux-amd64/ -env: - matrix: - - RACE=false - - RACE=true script: - export PATH=$PATH:$GOPATH/bin - make travis diff --git a/Makefile b/Makefile index 2c7b4aa2..f8427ce8 100644 --- a/Makefile +++ b/Makefile @@ -182,16 +182,25 @@ flake-unit: # TRAVIS # ====== -ifeq ($(RACE), false) +ifeq ($(RACE)$(USE_LINT), FALSETRUE) travis: dep lint build itest unit-cover $(GOVERALLS_BIN) @$(call print, "Sending coverage report.") $(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci endif -ifeq ($(RACE), true) +ifeq ($(RACE)$(USE_LINT), FALSEFALSE) +travis: dep build itest unit-cover $(GOVERALLS_BIN) + @$(call print, "Sending coverage report.") + $(GOVERALLS_BIN) -coverprofile=profile.cov -service=travis-ci +endif + +ifeq ($(RACE)$(USE_LINT), TRUETRUE) travis: dep lint btcd unit-race endif +ifeq ($(RACE)$(USE_LINT), TRUEFALSE) +travis: dep btcd unit-race +endif # ========= # UTILITIES From f07260afbc2225bf9a8ea542e0fac5523fe4f92c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 7 Oct 2018 14:36:09 +0900 Subject: [PATCH 4/4] htlcswitch: fix lint under go 1.11 --- htlcswitch/link_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 142ee8c7..2fe1dabf 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -53,7 +53,7 @@ func (c *concurrentTester) Fatalf(format string, args ...interface{}) { c.mtx.Lock() defer c.mtx.Unlock() - c.T.Fatalf(format, args) + c.T.Fatalf(format, args...) } // messageToString is used to produce less spammy log messages in trace mode by