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

ci: upgrade go to 1.22 #21940

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
23 changes: 6 additions & 17 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,14 @@ in {
xcodeWrapper = callPackage ./pkgs/xcodeenv/compose-xcodewrapper.nix { } {
versions = ["16.0" "16.1" "16.2"];
};
go = super.go_1_21;
go = super.go_1_22;
clang = super.clang_15;
buildGoPackage = super.buildGo121Package;
buildGoModule = super.buildGo121Module;
gomobile = (super.gomobile.overrideAttrs (old: {
patches = [
(self.fetchurl { # https://github.com/golang/mobile/pull/84
url = "https://github.com/golang/mobile/commit/f20e966e05b8f7e06bed500fa0da81cf6ebca307.patch";
sha256 = "sha256-TZ/Yhe8gMRQUZFAs9G5/cf2b9QGtTHRSObBFD5Pbh7Y=";
})
(self.fetchurl { # https://github.com/golang/go/issues/58426
url = "https://github.com/golang/mobile/commit/406ed3a7b8e44dc32844953647b49696d8847d51.patch";
sha256 = "sha256-dqbYukHkQEw8npOkKykOAzMC3ot/Y4DEuh7fE+ptlr8=";
})
];
})).override {
# FIXME: No Android SDK packages for aarch64-darwin.
withAndroidPkgs = stdenv.system != "aarch64-darwin";
buildGoPackage = super.buildGo122Package;
buildGoModule = super.buildGo122Module;
gomobile = callPackage ./pkgs/gomobile {
#FIXME: No Android SDK packages for aarch64-darwin.
androidPkgs = self.androidEnvCustom.compose;
withAndroidPkgs = stdenv.system != "aarch64-darwin";
};

# Android environment
Expand Down
85 changes: 85 additions & 0 deletions nix/pkgs/gomobile/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
stdenv,
lib,
fetchgit,
fetchurl,
buildGo122Module,
zlib,
makeWrapper,
xcodeenv,
androidenv,
xcodeWrapperArgs ? { },
xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs,
withAndroidPkgs ? stdenv.system != "aarch64-darwin",
androidPkgs ? (
androidenv.composeAndroidPackages {
includeNDK = true;
}
),
}:
buildGo122Module {
pname = "gomobile";
version = "0-unstable-2024-12-13";

src = fetchgit {
name = "gomobile";
url = "https://go.googlesource.com/mobile";
rev = "a87c1cf6cf463f0d4476cfe0fcf67c2953d76e7c";
hash = "sha256-7j4rdmCZMC8tn4vAsC9x/mMNkom/+Tl7uAY+5gkSvfY=";
};

vendorHash = "sha256-6ycxEDEE0/i6Lxo0gb8wq3U2U7Q49AJj+PdzSl57wwI=";

CGO_ENABLED = "1";

subPackages = [
"bind"
"cmd/gobind"
"cmd/gomobile"
];

# Fails with: go: cannot find GOROOT directory
doCheck = false;

nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodeWrapper ];

# Prevent a non-deterministic temporary directory from polluting the resulting object files
postPatch = ''
substituteInPlace cmd/gomobile/env.go --replace-quiet \
'tmpdir, err = ioutil.TempDir("", "gomobile-work-")' \
'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "gomobile-work")'
substituteInPlace cmd/gomobile/init.go --replace-quiet \
'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \
'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "work")'

# To fix unable to import bind: no Go package in golang.org/x/mobile/bind
substituteInPlace cmd/gomobile/init.go --replace \
'golang.org/x/mobile/cmd/gobind@latest' \
'golang.org/x/mobile/cmd/gobind'
'';

# Necessary for GOPATH when using gomobile.
postInstall = ''
mkdir -p $out/src/golang.org/x
ln -s $src $out/src/golang.org/x/mobile
'';

postFixup = ''
for prog in gomobile gobind; do
wrapProgram $out/bin/$prog \
--suffix GOPATH : $out \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" \
${lib.optionalString withAndroidPkgs ''
--prefix PATH : "${androidPkgs.androidsdk}/bin" \
--set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk"
''}
done
'';

meta = {
description = "Tool for building and running mobile apps written in Go";
homepage = "https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile";
license = with lib.licenses; [ bsd3 ];
maintainers = with lib.maintainers; [ jakubgs ];
};
}
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v9.2.0",
"commit-sha1": "41743c6ca0bb0a1ff4510bfa3575948d477e6284",
"src-sha256": "1awd04bsxkglbgd0nk5mdz2sm17pxkcj47hfslczsppww7yhmc9n"
"version": "bump-go-to-1-23",
"commit-sha1": "71a04fe168be2d4de9cf155f2768cf8082ddec85",
"src-sha256": "03i75sdw4866713nj68k2ficmj37p10q70vksc33kqzgm03rccjz"
}