Fix Go version discovery on Ubuntu versions#785
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the RPM spec packaging to reliably pick a sufficiently new Go toolchain on Ubuntu (notably 22.04), avoiding builds accidentally using the golang metapackage version that is too old for the codebase.
Changes:
- On Ubuntu 22.04, require the versioned Go package (
golang-%{go_version}-go) instead of relying ongolang >= .... - In the build step on Ubuntu, discover the Go binary by selecting the highest
/usr/lib/go-*/binversion instead of assuming a single fixed path.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
meaksh
reviewed
May 7, 2026
deneb-alpha
force-pushed
the
fix_ubuntu_go
branch
2 times, most recently
from
May 7, 2026 14:17
de24d48 to
54d0711
Compare
cbosdo
approved these changes
May 7, 2026
meaksh
reviewed
May 7, 2026
deneb-alpha
force-pushed
the
fix_ubuntu_go
branch
from
May 18, 2026 12:19
9c480fa to
7177372
Compare
deneb-alpha
force-pushed
the
fix_ubuntu_go
branch
from
May 18, 2026 12:50
7177372 to
64a4a4b
Compare
deneb-alpha
marked this pull request as ready for review
May 18, 2026 12:57
deneb-alpha
marked this pull request as draft
May 18, 2026 13:02
cbosdo
reviewed
May 18, 2026
cbosdo
left a comment
Contributor
There was a problem hiding this comment.
The whole logic added here seems like an overkill to me… do we really need all of this?
deneb-alpha
force-pushed
the
fix_ubuntu_go
branch
from
May 18, 2026 13:42
64a4a4b to
ecb3282
Compare
deneb-alpha
force-pushed
the
fix_ubuntu_go
branch
from
May 18, 2026 13:59
ecb3282 to
e834d74
Compare
|
| if test -d /usr/lib/go-%{go_version}/bin/; then | ||
| go_path=/usr/lib/go-%{go_version}/bin/ | ||
| # Pinpoint the highest binary | ||
| go_path=$(find /usr/lib/go-*/bin/go 2>/dev/null | sort | tail -n 1) |
Comment on lines
+86
to
+88
| # On Ubuntu 22.04, the metapackage golang is too old (1.18) and | ||
| # we must use the versioned package name specifically for this OS version. | ||
| %if 0%{?ubuntu} == 2204 |
Comment on lines
+346
to
+348
| [ -z "$max_patch" ] && max_patch=0 | ||
| [ -z "$max_minor" ] && max_minor=0 | ||
| if [ "$max_major" -lt "$req_major" ] || { [ "$max_major" -eq "$req_major" ] && [ "$max_minor" -lt "$req_minor" ]; }; then |
Contributor
Author
cbosdo
approved these changes
May 18, 2026
meaksh
approved these changes
May 18, 2026
mcalmer
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What does this PR change?
follow-up of #775
The build for Ubuntu 22.04 was failing with the error undefined:
fmt.Appendf. This occurred because the codebase requires Go 1.19+ (wherefmt.Appendfwas introduced), but the Ubuntu 22.04 build environment was defaulting to Go 1.18.The failure was caused by two main factors:
BuildRequires: golang >= 1.22, the package manager falls back to the only available package named golang (1.18) if a higher version isn't found under that exact name.Changes done:
Codespace
Check if you already have a running container clicking on
Test coverage
Manual tests: https://build.suse.de/package/show/home:deneb_alpha:uyuni-tools_ubuntu_fixgo/uyuni-tools
DONE
Links
Issue(s): #775
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test(see below)Before you merge
Check How to branch and merge properly!