gdk update breaks on gitlab-shell v14.35.0
Overview
If you run gdk update when gitlab-shell has been compiled for v14.35.0, you'll see these errors:
go: errors parsing go.mod:
go.mod:5: unknown directive: <<<<<<<
go.mod:7: unknown directive: =======
go.mod:8: repeated toolchain statement
go.mod:9: unknown directive: >>>>>>>
make[2]: *** [bin/gitlab-shell] Error 1
make[1]: *** [gitlab-shell-setup] Error 2
make: *** [gitlab-shell-update-timed] Error 2
:x:️ ERROR: Failed to update.
It appears this happens because v14.35.0 has .tool-versions set for golang 1.22.2, but go.mod wasn't updated to reflect that. You can reproduce the issue by doing this in the GDK dir:
git -C gitlab-shell checkout v14.35.0
make -C gitlab-shell
gdk update
The issue is after the first make call, go.mod has been updated by Go 1.22.2:
diff --git a/go.mod b/go.mod
index 513ccc4..0d84080 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,8 @@
module gitlab.com/gitlab-org/gitlab-shell/v14
-go 1.20
+go 1.21
+
+toolchain go1.22.2
require (
github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240402115927-f0b226fa61cc
When gdk update runs, it attempts to run git stash save and then git stash pop. The git stash pop fails because the modified go.mod conflicts with the changes in v14.36.0.
I wonder what the best way to solve this. In general, if there are conflicts after git stash pop, perhaps we should force a rollback to the last known version and warn the user that intervention may be needed.
Impacted categories
The following categories relate to this issue:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Steps to replicate (optional)
Proposal (optional)
Environment (optional)
- Operating system name:
<!-- output of `uname -a` command --> - Architecture:
<!-- output of `arch` command --> - The contents of your
gdk.yml(if any) - Ruby version:
<!-- output of `ruby --version` command --> - GDK version:
<!-- output of `git rev-parse --short HEAD` command -->