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

Update to Go 1.21.6 and Alpine 3.19 #102

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Conversation

mrfelton
Copy link
Contributor

@mrfelton mrfelton commented Jan 19, 2024

Update to Go to v1.21.6

There was quite a bit required to get this to work, including:

Updating Go

Go has been updated to v1.21.6, and as a result we're also now running on the latest Alpine build, which address a number of known security vulnerabilities.

Updating all dependencies

In order to hit all of the transient dependencies that have known security issues, most of the direct dependencies had to be updated to latest versions.

Switching to doing linting using the golangci-lint official prebuilt docker image

To update to Go 1.21, we also had to update the linter. I spent a lot of time trying to get the existing linting setup to work, however unfortunately I just could not get it to build cleanly as things are. Given that the maintainers recommend against building from source and recognise that it often doesn't work, instead I have switched to using one of their recommended approaches as per https://golangci-lint.run/usage/install/. For some context, see

Disabled some lint rules

With the linter updated, a number of new/changed rules started throwing issues. I fixed a couple of them but it was turning into a distraction. So, I have disabled three rules which we're currently not passing. depguard, goconst, gosec. My Go skill are lacking, so fixing these will take too long for me right now. Maybe someone that's more familiar with Go can re-enable these and fix the offending issues.

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!
The package updates you mentioned could go into this PR as well if you feel like it. Or a separate one, whatever you prefer.

go.mod Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@mrfelton mrfelton force-pushed the update-go branch 3 times, most recently from 2e3ba58 to 29d35f6 Compare January 19, 2024 18:28
@mrfelton
Copy link
Contributor Author

I've updated the PR to move to latest Go version (1.21.6). In order to do that, a lot of the other dependencies needed to be updated, so the scope of the PR has grown somewhat. But this does now address almost all of the known security issues from our dependencies. But there are some caveats - see updated issue description for details.

@mrfelton mrfelton changed the title Update to Go 1.19 and Alpine 3.19 Update to Go 1.21.6 and Alpine 3.19 Jan 19, 2024
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your investigations! Unfortunately the linter is a bit of a pain to handle sometimes...

go.mod Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
collectors/htlcs_collector.go Show resolved Hide resolved
@mrfelton mrfelton force-pushed the update-go branch 2 times, most recently from 41571fb to db36b8f Compare January 22, 2024 09:50
Copy link
Contributor Author

@mrfelton mrfelton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All updates made @guggero . Thanks for the pointer on the linter issues. Removing the tools tag worked

.golangci.yml Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
@mrfelton mrfelton requested a review from guggero January 22, 2024 09:54
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, LGTM 🎉

@Roasbeef Roasbeef merged commit f7d3fdf into lightninglabs:master Jan 24, 2024
1 check passed
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 this pull request may close these issues.

3 participants