mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-30 10:35:32 +02:00
Merge pull request #8014 from Roasbeef/go-loop-exp
build: prep for Go 1.22 by using GOEXPERIMENT=loopvar for tests
This commit is contained in:
14
Makefile
14
Makefile
@ -21,9 +21,17 @@ ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Lndmobile.aar
|
|||||||
|
|
||||||
COMMIT := $(shell git describe --tags --dirty)
|
COMMIT := $(shell git describe --tags --dirty)
|
||||||
|
|
||||||
GOBUILD := go build -v
|
GO_VERSION := $(shell go version | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
|
||||||
GOINSTALL := go install -v
|
GO_VERSION_MINOR := $(shell echo $(GO_VERSION) | cut -d. -f2)
|
||||||
GOTEST := go test
|
|
||||||
|
LOOPVARFIX :=
|
||||||
|
ifeq ($(shell expr $(GO_VERSION_MINOR) \>= 21), 1)
|
||||||
|
LOOPVARFIX := GOEXPERIMENT=loopvar
|
||||||
|
endif
|
||||||
|
|
||||||
|
GOBUILD := $(LOOPVARFIX) go build -v
|
||||||
|
GOINSTALL := $(LOOPVARFIX) go install -v
|
||||||
|
GOTEST := $(LOOPVARFIX) go test
|
||||||
|
|
||||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")
|
||||||
|
|
||||||
|
@ -163,6 +163,8 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, nodeAnn := range nodeAnnsInHorizon {
|
for _, nodeAnn := range nodeAnnsInHorizon {
|
||||||
|
nodeAnn := nodeAnn
|
||||||
|
|
||||||
// Ensure we only forward nodes that are publicly advertised to
|
// Ensure we only forward nodes that are publicly advertised to
|
||||||
// prevent leaking information about nodes.
|
// prevent leaking information about nodes.
|
||||||
isNodePublic, err := c.graph.IsPublicNode(nodeAnn.PubKeyBytes)
|
isNodePublic, err := c.graph.IsPublicNode(nodeAnn.PubKeyBytes)
|
||||||
|
@ -2134,18 +2134,33 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
|
|||||||
name: "active to passive",
|
name: "active to passive",
|
||||||
entrySyncType: ActiveSync,
|
entrySyncType: ActiveSync,
|
||||||
finalSyncType: PassiveSync,
|
finalSyncType: PassiveSync,
|
||||||
assert: func(t *testing.T, msgChan chan []lnwire.Message,
|
assert: func(t *testing.T, mChan chan []lnwire.Message,
|
||||||
g *GossipSyncer) {
|
g *GossipSyncer) {
|
||||||
|
|
||||||
|
// When we first boot up, we expect that we
|
||||||
|
// send out a message that indicates we want
|
||||||
|
// all the updates from here on.
|
||||||
|
firstTimestamp := uint32(time.Now().Unix())
|
||||||
|
assertMsgSent(
|
||||||
|
t, mChan, &lnwire.GossipTimestampRange{
|
||||||
|
FirstTimestamp: firstTimestamp,
|
||||||
|
TimestampRange: math.MaxUint32,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// When transitioning from active to passive, we
|
// When transitioning from active to passive, we
|
||||||
// should expect to see a new local update
|
// should expect to see a new local update
|
||||||
// horizon sent to the remote peer indicating
|
// horizon sent to the remote peer indicating
|
||||||
// that it would not like to receive any future
|
// that it would not like to receive any future
|
||||||
// updates.
|
// updates.
|
||||||
assertMsgSent(t, msgChan, &lnwire.GossipTimestampRange{
|
assertMsgSent(
|
||||||
FirstTimestamp: uint32(zeroTimestamp.Unix()),
|
t, mChan, &lnwire.GossipTimestampRange{
|
||||||
TimestampRange: 0,
|
FirstTimestamp: uint32(
|
||||||
})
|
zeroTimestamp.Unix(),
|
||||||
|
),
|
||||||
|
TimestampRange: 0,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
syncState := g.syncState()
|
syncState := g.syncState()
|
||||||
if syncState != chansSynced {
|
if syncState != chansSynced {
|
||||||
@ -2182,6 +2197,8 @@ func TestGossipSyncerSyncTransitions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
test := test
|
||||||
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ function check_tag_correct() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build lnd to extract version.
|
# Build lnd to extract version.
|
||||||
go build ${PKG}/cmd/lnd
|
env GOEXPERIMENT=loopvar go build ${PKG}/cmd/lnd
|
||||||
|
|
||||||
# Extract version command output.
|
# Extract version command output.
|
||||||
lnd_version_output=$(./lnd --version)
|
lnd_version_output=$(./lnd --version)
|
||||||
@ -177,8 +177,8 @@ function build_release() {
|
|||||||
pushd "${dir}"
|
pushd "${dir}"
|
||||||
|
|
||||||
green " - Building: ${os} ${arch} ${arm} with build tags '${buildtags}'"
|
green " - Building: ${os} ${arch} ${arm} with build tags '${buildtags}'"
|
||||||
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lnd
|
env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lnd
|
||||||
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli
|
env GOEXPERIMENT=loopvar CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Add the hashes for the individual binaries as well for easy verification
|
# Add the hashes for the individual binaries as well for easy verification
|
||||||
|
Reference in New Issue
Block a user