Skip to content

Specify a go release minor version #4393

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

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

radsaq
Copy link
Contributor

@radsaq radsaq commented Mar 13, 2025

  • PR Description
    Since they started releasing .0 versions with 1.21.0, the go version need to be a full release version specifier and not a go language version. They relented and added support for defaulting to a .0 release if none is specified in later 1.23.x releases, but for users with local 1.21 or 1.22 toolchains the lack of a full release specifier breaks them. And going forwards this is more technically correct anyway.

See golang/go#62278 (comment)

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@stefanhaller stefanhaller added the maintenance For refactorings, CI changes, tests, version bumping, etc label Mar 15, 2025
@stefanhaller
Copy link
Collaborator

Makes sense to me. My only question is why you chose 1.24.1 and not 1.24.0; do we specifically require .1? Shouldn't we specify the minimum version that is required for building?

@radsaq
Copy link
Contributor Author

radsaq commented Mar 15, 2025

Makes sense to me. My only question is why you chose 1.24.1 and not 1.24.0; do we specifically require .1? Shouldn't we specify the minimum version that is required for building?

This is an application and not a library so as far as I can tell there's no reason not to specify the latest version to make sure the app gets built with the latest bug/security fixes. It seems like for a library, specifying a lower version with the go directive but then a higher version with the 'toolchain' directive would be the right thing to do? But that only benefits people importing your code.

@stefanhaller
Copy link
Collaborator

But the go directive in go.mod does not specify the exact version that will be (needs to be) used to build. It specifies the minimum required version. If I set this to 1.24.0, I can build locally without problems even though I only have the 1.24.1 toolchain installed.

This doesn't say anything about what version will be used by packagers to build their distributions. I'd hope that they always use the latest available go version.

My understanding of this version is that we update it whenever we want to use language features that aren't supported by the older version. We shouldn't have to update it when a new go point release (or even major release) comes out that only has, say, performance improvements or security fixes.

Or at least that's my understanding, not sure if I got some of this wrong.

@radsaq
Copy link
Contributor Author

radsaq commented Mar 18, 2025

Or at least that's my understanding, not sure if I got some of this wrong.

No, I'm pretty sure you're correct about all that. But also for anyone building the package (casual devs, people using go install to fetch directly from GH) with their GOTOOLCHAIN set to the default of auto, the app will compile using 1.24.0. So in that sense, it's not clear to me that keeping the version at .0 in the source actually benefits anyone. 🤔

(I believe the solution is for a user who cares to specify "go+auto" as their toolchain, but as someone who's new to this, it almost feels like that should be the default behavior if they're going to make downloading toolchains automatic. Maybe that's dumb? I dunno. 🤔)

@stefanhaller
Copy link
Collaborator

But also for anyone building the package (casual devs, people using go install to fetch directly from GH) with their GOTOOLCHAIN set to the default of auto, the app will compile using 1.24.0.

No, only for those users who are now using an older version. Users with a newer version will use their version to compile.

The go documentation is pretty clear about this:

The go line declares the minimum required Go version for using the module or workspace.
The toolchain line declares a suggested toolchain to use with the module or workspace.

So our go line should say 1.24.0. If we care about forcing users to use the latest security fixes, then we should add a toolchain directive, but then we also need to update it whenever a new go version is released. I don't think it makes sense for us to be doing that; every go application out there would have to.

To be honest I feel that this whole toolchain automatism is still a bit messed up (in several ways), but it's not our business to try to fix it.

@stefanhaller
Copy link
Collaborator

But also for anyone building the package (casual devs, people using go install to fetch directly from GH) with their GOTOOLCHAIN set to the default of auto, the app will compile using 1.24.0.

No, only for those users who are now using an older version. Users with a newer version will use their version to compile.

Oh, and for users who never bother to update their go installation, thinking that always downloading the latest toolchains is enough. With a GOTOOLCHAIN of "auto" they will compile with 1.24.0 even if they have newer toolchains installed. This feels really broken to me.

This actually just happened to me on my Windows box that I only use rarely; I forgot how I installed go there, and was too lazy to update it, thinking that downloading toolchains should be enough. With current lazygit master I can't even run commands like go version or even go --help:

$ go --help
go: downloading go1.24 (windows/amd64)
go: download go1.24 for windows/amd64: toolchain not available

(My local version is 1.22, so it does't have the fallback of appending .0 yet.)

What a mess. I now learned that I can fix this by doing go env -w GOTOOLCHAIN=go1.24.1+auto, and I just did, but it takes quite a bit of googling to figure this out.

But again, I don't think it's our job to find non-standard workarounds for all this. I would hope that package maintainers don't fall into this category of users that are too lazy to update their software.

@radsaq
Copy link
Contributor Author

radsaq commented Mar 21, 2025

But also for anyone building the package (casual devs, people using go install to fetch directly from GH) with their GOTOOLCHAIN set to the default of auto, the app will compile using 1.24.0.

No, only for those users who are now using an older version. Users with a newer version will use their version to compile.

The go documentation is pretty clear about this:

The go line declares the minimum required Go version for using the module or workspace.
The toolchain line declares a suggested toolchain to use with the module or workspace.

So our go line should say 1.24.0. If we care about forcing users to use the latest security fixes, then we should add a toolchain directive, but then we also need to update it whenever a new go version is released. I don't think it makes sense for us to be doing that; every go application out there would have to.

To be honest I feel that this whole toolchain automatism is still a bit messed up (in several ways), but it's not our business to try to fix it.

It also says this:

To choose the toolchain, the go command first obtains a list of available toolchains. For the auto form, the go command downloads a list of available toolchains. For the path form, the go command scans the PATH for any executables named for valid toolchains and uses a list of all the toolchains it finds. Using that list of toolchains, the go command identifies up to three candidates:

the latest release candidate of an unreleased Go language version (1.N₃rcR₃),
the latest patch release of the most recently released Go language version (1.N₂.P₂), and
the latest patch release of the previous Go language version (1.N₁.P₁).

Except that testing with a 1.23.2 install (from ubuntu) and 1.24.0 (downloaded tarball) I found that an app specifying 1.23.x would use the latest 1.23.x patch release but lazygit specifying 1.24 or 1.24.0 would always use 1.24.0 instead of 1.24.1. So yes, it does feel a bit messed up and at this point I gave up and decided you were right.

(There was another recent fix around calculating the version to use, but I can't tell if that buggy behavior was what I was hitting. 🤦)

I can open a new PR later.

@radsaq
Copy link
Contributor Author

radsaq commented Mar 21, 2025

What a mess. I now learned that I can fix this by doing go env -w GOTOOLCHAIN=go1.24.1+auto, and I just did, but it takes quite a bit of googling to figure this out.

But again, I don't think it's our job to find non-standard workarounds for all this. I would hope that package maintainers don't fall into this category of users that are too lazy to update their software.

Indeed, "what a mess" has been my thought repeatedly while researching this particular go language saga. 😓

@stefanhaller
Copy link
Collaborator

Why a new PR though? Just change this one.

@radsaq
Copy link
Contributor Author

radsaq commented Mar 21, 2025

Why a new PR though? Just change this one.

I'm out of the habit of force pushing because of my git usage for work. 😅

Since they started releasing .0 versions with 1.21.0, the go version
need to be a full release version specifier and not a go language
version. They relented and added support for defaulting to a .0 release
if none is specified in later 1.23.x releases, but for users with local
1.21 or 1.22 toolchains the lack of a full release specifier breaks
them. And going forwards this is more technically correct anyway.

See golang/go#62278 (comment)
@radsaq radsaq force-pushed the go-specify-patchlevel branch from 7eb20a2 to 14ba0e7 Compare March 21, 2025 12:29
@stefanhaller stefanhaller merged commit 4b4d82e into jesseduffield:master Mar 21, 2025
15 checks passed
@radsaq radsaq deleted the go-specify-patchlevel branch March 24, 2025 23:39
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.48.0` -> `v0.50.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary>

### [`v0.50.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.50.0)

[Compare Source](jesseduffield/lazygit@v0.49.0...v0.50.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.50.0 -->

#### What's Changed

##### Enhancements 🔥

-   Continue/abort a conflicted cherry-pick or revert by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4441
-   Show todo items for pending cherry-picks and reverts by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4442
-   Use "git cherry-pick" for implementing copy/paste of commits by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4443
-   Allow reverting a range of commits by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4444
-   Section headers for rebase todos and actual commits by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4463
-   Focus the main view by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4429
-   Auto-forward main branches after fetching by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4493
-   Add new command "Move commits to new branch" by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#3876
-   Strip the '+' and '-' characters when copying parts of a diff to the clipboard by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4519
-   Reduce memory consumption of graph (pipe sets) by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4498

##### Fixes 🔧

-   Fix truncation of branches when scrolling branches panel to the left by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4483
-   Fix nvim-remote commands for fish shell by [@&#8203;SavingFrame](https://github.com/SavingFrame) in jesseduffield/lazygit#4506
-   Disallow creating custom patches when the diff context size is 0 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4522
-   Remove double space between rebase todo and author columns by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4520

##### Maintenance ⚙️

-   Allow closing issues via github actions by [@&#8203;jesseduffield](https://github.com/jesseduffield) in jesseduffield/lazygit#4515

##### Docs 📖

-   Add Debian installation instructions alongside Ubuntu by [@&#8203;jmkim](https://github.com/jmkim) in jesseduffield/lazygit#4501
-   fix wording of random tip by [@&#8203;dawedawe](https://github.com/dawedawe) in jesseduffield/lazygit#4488

#### New Contributors

-   [@&#8203;jmkim](https://github.com/jmkim) made their first contribution in jesseduffield/lazygit#4501
-   [@&#8203;SavingFrame](https://github.com/SavingFrame) made their first contribution in jesseduffield/lazygit#4506
-   [@&#8203;dawedawe](https://github.com/dawedawe) made their first contribution in jesseduffield/lazygit#4488

**Full Changelog**: jesseduffield/lazygit@v0.49.0...v0.50.0

### [`v0.49.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.49.0)

[Compare Source](jesseduffield/lazygit@v0.48.0...v0.49.0)

<!-- Release notes generated using configuration in .github/release.yml at v0.49.0 -->

#### What's Changed

##### Enhancements 🔥

-   Support fish when running shell command by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4350
-   Add acme editor preset by [@&#8203;rakoo](https://github.com/rakoo) in jesseduffield/lazygit#4360
-   Support home and end as alternatives to '<' and '>' by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4396
-   Drop the git config cache when getting focus by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4376
-   Add a "Content of selected file" entry to the copy menu for commit files by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4341
-   Add root node in file tree by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4346
-   \[FEAT] Add Recursive Bulk Initialize and Update for Submodules by [@&#8203;cesarandr](https://github.com/cesarandr) in jesseduffield/lazygit#4259
-   Commit without pre-commit hooks action is independent on prefix by [@&#8203;kschweiger](https://github.com/kschweiger) in jesseduffield/lazygit#4374
-   Let users define custom icons and color for files on the config file by [@&#8203;hasecilu](https://github.com/hasecilu) in jesseduffield/lazygit#4395
-   Add "Absolute path" item to the file view's copy menu by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4410
-   Allow range drop stashes by [@&#8203;gaogao-qwq](https://github.com/gaogao-qwq) in jesseduffield/lazygit#4451
-   More navigation keybindings for confirmation panel by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4404
-   Resolve non-inline merge conflicts by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4431
-   Add `runCommand` function to Go template syntax + add support for templates in git `branchPrefix` setting by [@&#8203;ruudk](https://github.com/ruudk) in jesseduffield/lazygit#4438
-   Show "(hooks disabled)" in title bar of commit message editor by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4467
-   Add a command to select all commits of the current branch by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4448

##### Fixes 🔧

-   Use a waiting status for rewording a non-head commit by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4343
-   Fix layout of options view for non-english languages by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4359
-   Fix changing language while lazygit is running by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4361
-   URL encode gitlab brackets to make consistent with branch names by [@&#8203;ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4336
-   Fix commitPrefix setting with empty pattern by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4381
-   Commit only tracked files in tracked filter view by [@&#8203;parthokunda](https://github.com/parthokunda) in jesseduffield/lazygit#4386
-   Revert [#&#8203;4313](jesseduffield/lazygit#4313) (Skip post-checkout hook when discarding changes) by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4407
-   Enhance support for GPG signed tags by [@&#8203;ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4394
-   Fix checking out a file from a range selection of commits by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4423
-   Fix discarding submodule changes in nested folders by [@&#8203;brandondong](https://github.com/brandondong) in jesseduffield/lazygit#4317
-   Better support for shell aliases by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4385
-   Fix hyperlinks in last line of confirmation popups by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4454
-   Fix wrong main view content after pressing `e` in a stack of branches by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4450
-   fix: update vscode color to logo color by [@&#8203;PeterCardenas](https://github.com/PeterCardenas) in jesseduffield/lazygit#4459
-   Fix crash with drag selecting and staging by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4480
-   Escape special characters in filenames when git-ignoring files by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4475

##### Maintenance ⚙️

-   Fix linter warnings by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4352
-   Fix release schedule again by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4364
-   Update to go 1.24 by [@&#8203;radsaq](https://github.com/radsaq) in jesseduffield/lazygit#4377
-   Add an integration test for a config with a negative refspec by [@&#8203;radsaq](https://github.com/radsaq) in jesseduffield/lazygit#4382
-   Specify a go release minor version by [@&#8203;radsaq](https://github.com/radsaq) in jesseduffield/lazygit#4393
-   Fix flaky integration test by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4432
-   Some code cleanup by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4449
-   Bump the minimum required git version to 2.22 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4439
-   Bump go-git, and get rid of github.com/imdario/mergo by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4460
-   Skip date check when release worfklow is manually invoked by [@&#8203;jesseduffield](https://github.com/jesseduffield) in jesseduffield/lazygit#4484

##### Docs 📖

-   Include empty arrays and maps in config docs by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4413
-   Filter out deprecated user config fields from generated Config.md by [@&#8203;karimkhaleel](https://github.com/karimkhaleel) in jesseduffield/lazygit#4416
-   Corrected interactive rebase keybind example in README.md by [@&#8203;NewtonChutney](https://github.com/NewtonChutney) in jesseduffield/lazygit#4426
-   Update kidpix link in README to active url by [@&#8203;ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4425

##### I18n 🌎

-   Update translation files from Crowdin by [@&#8203;stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4473

#### New Contributors

-   [@&#8203;rakoo](https://github.com/rakoo) made their first contribution in jesseduffield/lazygit#4360
-   [@&#8203;radsaq](https://github.com/radsaq) made their first contribution in jesseduffield/lazygit#4377
-   [@&#8203;cesarandr](https://github.com/cesarandr) made their first contribution in jesseduffield/lazygit#4259
-   [@&#8203;kschweiger](https://github.com/kschweiger) made their first contribution in jesseduffield/lazygit#4374
-   [@&#8203;NewtonChutney](https://github.com/NewtonChutney) made their first contribution in jesseduffield/lazygit#4426
-   [@&#8203;gaogao-qwq](https://github.com/gaogao-qwq) made their first contribution in jesseduffield/lazygit#4451
-   [@&#8203;ruudk](https://github.com/ruudk) made their first contribution in jesseduffield/lazygit#4438

**Full Changelog**: jesseduffield/lazygit@v0.48.0...v0.49.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xMS4yIiwidXBkYXRlZEluVmVyIjoiNDAuMTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance For refactorings, CI changes, tests, version bumping, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants