Open paboum opened 1 week ago
Are you sure you installed go 1.22 correctly? If you run go version
do you get 1.22.4?
Older versions (I think before 1.20) will not understand the new 3-part go version in go.mod
. And since you're mentioning go 1.19.8
I assume your old installation of that version is still being used.
$ go version
go version go1.19.8 linux/arm64
$ go1.22.4 version
go version go1.22.4 linux/arm64
As mentioned in https://github.com/lightningnetwork/lnd/issues/6489, I was using hardcoded go version in Makefile until early this year. Since all the Makefile was recently reinvented, today I'm using the original one from the repo.
Since changing
go 1.21.4
in go.mod
to:
go 1.21
helps building the project and it's even running, I refuse to accept that anything is wrong with my debian (raspbian, to be specific). It rather seems the go version dependency is too strict and the issue #6489 is still not resolved.
Official "Managing Go installations" docu says (https://go.dev/doc/manage-install):
To run go commands with the newly-downloaded version, append the version number to the go command, as follows:
$ go1.10.7 version go version go1.10.7 linux/amd64
To be super-precise here, I checked lnd
docu on how to install Go:
lnd is written in Go, with a minimum version of 1.19. To install, run one of the following commands for your OS:
If it matches, then proceed to install Go:
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin
Not only it seems not up-to-date (mentions 1.19) but also breaks user-wide compatibility of previous go binary with whatever other projects might be requiring go binary, possibly affects other users and is drastically different from the official Go project's recommendation whilst not providing any significant reason for why go should be installed like this. I can only guess it's "easier for the devs" but apparently the list of issues is growing.
and is drastically different from the official Go project's recommendation whilst not providing any significant reason for why go should be installed like this
If you go to the "Linux" tap on the official Go project's page, these are exactly the steps it uses to install go... https://go.dev/doc/install
Okay, I see. Your go 1.22.4
installation/binary is accessible as go1.22.4
instead of just go
. That's why the make command doesn't work, since it uses the old version.
The installation instructions were recently updated: https://github.com/lightningnetwork/lnd/pull/8856
So I guess this is a duplicate of https://github.com/lightningnetwork/lnd/issues/6489 then? Since the root cause is the same.
Not only it seems not up-to-date (mentions 1.19) but also breaks user-wide compatibility of previous go binary with whatever other projects might be requiring go binary, possibly affects other users and is drastically different from the official Go project's recommendation whilst not providing any significant reason for why go should be installed like this. I can only guess it's "easier for the devs" but apparently the list of issues is growing.
Go has a hard promise on backward compatibility. And there's no downside of using a newer version than a project requires. Therefore I don't think one project requiring a newer version (which is then installed system wide) should have any effect on other projects.
So I guess this is a duplicate of #6489 then? Since the root cause is the same.
Not exactly. #6489 would perhaps fix this one, but still there is a 1.21.4
dependency in go.mod
while requiring 1.21
works fine too and fixes the current issue. Edit: I guess it doesn't really matter as far as I'm providing 1.22.4
- then perhaps lnd
should require 1.22
as the most recent major version that includes 1.21.4
features?
Go has a hard promise on backward compatibility.
Perhaps the language definition is never introducing breaking changes, yes. But the toolchain is frequently preventing old projects from building, e.g. requiring go.mod
files since 1.16
IIRC. As you can see, I built the project with 1.19
as system-default go with 1.22.4
only available via ~/go/bin
and it manages to find it, but requires go.mod
to use two-number version limit (which I guess makes sense because minor updates don't change language definition, right?). Thus it wouldn't hurt to update (patch from me: https://github.com/lightningnetwork/lnd/compare/master...paboum:lnd:patch-1 ).
PS. I've found upstream issue thread too: https://github.com/golang/go/issues/61888 - seems that there is a "new version format"?
Background
go.mod
seems to have a non-supported three-number version dependencyYour environment
lnd
v0.18.1-betauname -a
on *Nix) debianbtcd
,bitcoind
, or other backend n/ago install golang.org/dl/go1.22.4@latest ; go1.22.4 download
Steps to reproduce
git clone; make install
Expected behaviour
It should build
Actual behaviour
Removing
.4
from the file mentioned seems to fix the issue. It uses the system-widego1.19.8
to build however. I am curious to edit the Makefile to hardcode usinggo1.22.4
in the build, but it works wine with 1.19.8. This should be checked prior to starting the build since1.21
is supposedly the minimum supported version.