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

go.mod: Force 1.22.4 as min go version #4407

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/opencontainers/runc

go 1.22
// We need min 1.22.4 due to a fix in golang for nsexec.
// For more info, see: #4233
go 1.22.4
Copy link
Member

Choose a reason for hiding this comment

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

I don't know whether there are some projects which require runc lib, but they don't use nsexec, and can't upgrade to 1.22.4 or higher version.
These projects will compile failure?

Copy link
Member

Choose a reason for hiding this comment

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

Could we use a per file version constraint instead so the parts of runc that do need 1.22+ fail to build without it but everything else can still be used?

Copy link
Member

Choose a reason for hiding this comment

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

It seems like golang doesn't support minimal version grammer in the go compile directives.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, we could specify //go:build go1.22 (which means 1.22+) but not go1.22.4, I see 😞

Copy link
Member Author

@rata rata Sep 20, 2024

Choose a reason for hiding this comment

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

I might be missing something, but I can't see why this is a problem. For several reasons:

  1. We are already specifying go 1.22, so go 1.22.0 is enforced as the min go version (unless you are using a very old version of go, in which case go 1.22 or 1.22.4 doesn't change anything)
  2. Go < 1.22 is not supported upstream. I don't understand why we should worry about that
  3. I'm quite sure we are using features of go 1.22 or 1.21, so some parts of the code won't build with older versions of go (besides the nsexec issue)

Here we are changing from enforce go 1.22.0 to enforce 1.22.4 as min go version, that is all. People that can't use go 1.22 can't use runc main today either (unless they use really older versions and in that case, this change doesn't change them anything either)

Am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

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

So they will have to update the minimum version to 1.22.4, right? What is the issue? I don't really understand.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know why they didn't update the minimum version of go, maybe there are some issues in their project, I don't know.
Before this patch, they can compile in 1.22.2 successful, so you mean it's the job of their own, if they want to bump runc to 1.2.0-*, they need to update the min go version. We should not consider such type projects which require runc (without nsexec).

Copy link
Member Author

Choose a reason for hiding this comment

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

And that is only if they don't merge this PR before upgrading the runc module: cri-o/cri-o#8597

The runc 1.2.0 final release won't be finished in the next few days.

Copy link
Member Author

@rata rata Sep 20, 2024

Choose a reason for hiding this comment

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

@lifubang I don't understand where that would be a problem. Sure, you need a newer version of go, instead of 1.22.2, you need 1.22.4. When that is an issue that we really want to let users compile this with 1.22 < 1.22.4?

I mean, 1.22.4 is out for some time (1.22.7 is the latest now), if it introduced a regression, they didn't report it and then all the go 1.22.x > 2 cause an issue for them... Sure, this will be problematic. If they reported the regression, it seems likely that by 1.22.7 it was already fixed.

I think it is unlikely, and we can revisit this decision if some user is actually in such a weird situation.

(and again, I doubt cri-o is in that situation, given that they have a PR open to change the min go version to 1.23 already. The one I linked in my previous comment).

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, taking a step back I think I see what you mean. It's just about projects using "1.22" in the go line that will need to change it when upgrading runc, and maybe that change is not even needed (as they are not using nsexec).

Luckily, that is why the go team added the "toolchain" line with this min go version change. We can suggest go 1.22.4 (using toolchain 1.22.4) when compiling runc, but for projects that use it as a module the go line applies.

I'll update the PR to do that later. I'll mark it as draft until then.

Thanks for the feedback :)

Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment line to explain why 1.22.0-1.22.3 are purposely omitted?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks!


require (
github.com/checkpoint-restore/go-criu/v6 v6.3.0
Expand Down
Loading