Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors on more recent Go compiler version (1.21.5) #3761

Closed
pdyraga opened this issue Jan 12, 2024 · 0 comments · Fixed by #3771
Closed

Compilation errors on more recent Go compiler version (1.21.5) #3761

pdyraga opened this issue Jan 12, 2024 · 0 comments · Fixed by #3771

Comments

@pdyraga
Copy link
Member

pdyraga commented Jan 12, 2024

When trying to compile the project on the (almost) most recent version of Go, the following build error happens:

$ make mainnet

(...)

Building Go code
GOOS= GOARCH= go build -ldflags "-X github.com/keep-network/keep-core/build.Version=v2.0.0-m6-15-g281685c3f -X github.com/keep-network/keep-core/build.Revision=281685c3f" -o ./keep-client -a .
# github.com/lucas-clemente/quic-go/internal/qtls
../../../go/pkg/mod/github.com/lucas-clemente/quic-go@v0.27.1/internal/qtls/go119.go:6:13: cannot use "The version of quic-go you're using can't be built on Go 1.19 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.19 yet. F...) as int value in variable declaration
make[1]: *** [build] Error 1
make: *** [mainnet] Error 2
$ go version
go version go1.21.5 darwin/arm64

The relevant link: https://github.com/quic-go/quic-go/wiki/quic-go-and-Go-versions

tomaszslabon added a commit that referenced this issue Feb 8, 2024
Refs: #3770
Closes: #3761

Here we upgrade all libp2p libraries to the recent versions. To make it
possible, we were also forced to bump the Go version from 1.18 to 1.20.
This is the minimum version supported by recent libp2p packages.

I recommend reviewing commit by commit where specific changes are
described in detail. Here is a brief summary of what has been done:

### Upgrade Go from 1.18 to 1.20

Upgrade of Go resulted in a need to:
- Adjust the return type of the `slices.SortFunc` compare function we
are using in one unit test. This is because the version of the
`golang.org/x/exp` package had to be bumped up as well. The returned
type of the compare function used in `slices.SortFunc` was changed from
`bool` to `int` somewhere between
(5a980c7)
- Fix the `TestCoordinationExecutor_Coordinate` which started to be
flaky due to a changed behavior of `ecdsa.GenerateKey`. [Since Go
1.20](golang/go#58637), the returned key no
longer depends deterministically on the bytes read from the provided
RNG, and may change between calls and/or between versions
(2ed7179)
- Fix the `TestWalletRegistry_getWalletByPublicKeyHash_NotFound` which
used a dummy curve point. Since Go 1.19, such a behavior leads to a
panic
(50b6bd6)
- Reformat code using the new `gofmt` version
(3c2274e)
- Adjust the Dockerfile
(8e07451)
- Bump `staticcheck` version used by CI and fix the new warnings about
deprecated standard library functions by replacing them as recommended
(a87eea3)

### Upgrade of libp2p libraries

Upgrade of libp2p packages forced us to:
- Adjust `go-libp2p-core` imports to be `go-libp/core` as this package
was moved to the `go-libp2p` monorepo
(95d60b8)
- Adjust our `transport` and `authenticatedConnection` implementations
to expose some additional functions required by libp2p interfaces
(ac01765)
- Set up our `transport` differently due to the changes around libp2p
`Security` option
(110fbb3,
6953b79)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant