From 7613de74ae7d25bd789fb994d493b819a806f5d6 Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Wed, 29 May 2024 21:23:24 +0530 Subject: [PATCH] Fix integration tests for MacOS (#20248) With go 1.20 its necessary to pass `lresolv` flag when building c-archives and `netgo` for networking on MacOS. This was the primary reason why integration tests were failing. ref -> https://github.com/golang/go/issues/58416 -> https://github.com/golang/go/issues/58159 This commit adds those flags to the derivation which builds status-go-library for integration tests and fixes the missing symbol crash. --- nix/status-go/library/default.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nix/status-go/library/default.nix b/nix/status-go/library/default.nix index 3a49a98a78..479bf9e725 100644 --- a/nix/status-go/library/default.nix +++ b/nix/status-go/library/default.nix @@ -1,9 +1,6 @@ -{ stdenv, meta, source, buildGo119Package, buildGo120Package }: -let - # https://github.com/status-im/status-mobile/issues/19802 - # only for Darwin to fix Integration Tests failing with missing symbols on go 1.20 - buildGoPackageIntegrationTest = if stdenv.isDarwin then buildGo119Package else buildGo120Package; -in buildGoPackageIntegrationTest { +{ lib, stdenv, meta, source, buildGoPackage }: + +buildGoPackage { pname = source.repo; version = "${source.cleanVersion}-${source.shortRev}"; @@ -25,11 +22,14 @@ in buildGoPackageIntegrationTest { ''; # Build the Go library + # ld flags and netgo tag are necessary for integration tests to work on MacOS + # https://github.com/status-im/status-mobile/issues/20135 buildPhase = '' runHook preBuild go build \ -buildmode='c-archive' \ - -tags='gowaku_skip_migrations gowaku_no_rln' \ + ${lib.optionalString stdenv.isDarwin "-ldflags=-extldflags=-lresolv"} \ + -tags='gowaku_skip_migrations gowaku_no_rln ${lib.optionalString stdenv.isDarwin "netgo"}' \ -o "$out/libstatus.a" \ $NIX_BUILD_TOP/main.go runHook postBuild