# Even though we need Go >= 1.23, the Go toolchain is able to auto-update itself and download the correct version
# we need to build the source code.
# This works great on CI and local builds that have internet access. However, this build process won't work on
# Launchpad builds, as the runners there do not have internet access.
diff --git a/debian/control b/debian/control
index ccf213e0..40a2aa9f 100644
--- a/debian/control
+++ b/debian/control
@@ -2,10 +2,10 @@ Source: adsys
 Section: admin
 Priority: optional
 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
-Build-Depends: debhelper-compat (= 13),
+Build-Depends: debhelper-compat (= 12),
                dh-apport,
                dh-golang,
-               golang-go (>= 2:1.23~),
+               golang-1.22-go,
                apparmor,
                dbus,
                libdbus-1-dev,
diff --git a/debian/rules b/debian/rules
index f9705a3d..3513e53f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,9 +25,8 @@ export DH_GOLANG_INSTALL_ALL := 1
 # Tests needing sudo will be skipped automatically
 export ADSYS_SKIP_INTEGRATION_TESTS=1

-# We want to take whatever ubuntu propose to us (as it won’t download a newer version),
-# as long as it matches the go.mod go stenza which is the language requirement.
-export GOTOOLCHAIN := local
+# Run with Go 1.22
+export PATH := /usr/lib/go-1.22/bin/:$(PATH)

 %:
        dh $@ --buildsystem=golang --with=golang,apport
@@ -87,3 +86,5 @@ endif
        ln -s adsysd debian/tmp/sbin/adsysctl
        # Run go generate to install assets, but don’t regenerate them
        GENERATE_ONLY_INSTALL_TO_DESTDIR=$(CURDIR)/debian/tmp go generate -x $(GOFLAGS),tools ./...
+
+override_dh_dwz:

