Skip to content

Commit

Permalink
fix: overlapped local replacement
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yihuang committed May 4, 2024
1 parent 872b63d commit ab23a11
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ab23a11

Please sign in to comment.