From ab23a11b3c4e7a551dcfdb56c9a1fe03e600a936 Mon Sep 17 00:00:00 2001 From: yihuang Date: Sat, 4 May 2024 09:15:43 +0800 Subject: [PATCH] fix: overlapped local replacement One golang standalone module can exists inside another module, when we replace such module to local directory, we'll try to create symbolic link inside the source directory and `ln` complains permission denied. For example, both `cosmossdk.io/x/accounts` and `cosmossdk.io/x/accounts/defaults/lockup` are standalone modules, if we do `replace cosmossdk.io/x/accounts => ./x/accounts`, we'll try to create two symbolic links like this: ``` $ ln -s ./x/accounts vendor/cosmossdk.io/x/accounts $ ln -s ./x/accounts/defaults/lockup vendor/cosmossdk.io/x/accounts/defaults/lockup ``` And the second one is inside source directory and fails. The temporary solution here is to simply ignore the symbolic link error, not ideal, but fix the issue at hand, and should have not side effect on existing projects. --- builder/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/default.nix b/builder/default.nix index d500555..c11d3ef 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -84,7 +84,8 @@ let (name: value: ( '' mkdir -p $(dirname vendor/${name}) - ln -s ${pwd + "/${value.path}"} vendor/${name} + # sometimes the symlink already exists, so we ignore the error + ln -s ${pwd + "/${value.path}"} vendor/${name} || true '' )) localReplaceAttrs);