about summary refs log tree commit diff
path: root/nix/buildGo/external/default.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-04-05T09·41+0200
committerProfpatsch <mail@profpatsch.de>2021-04-23T16·35+0000
commit2224731e0d007fbff27f31f4e1771aad723b603f (patch)
treec351da2b34ad1e97bac7e6f03f783bf5069fe87e /nix/buildGo/external/default.nix
parent77c09076eccf343e7f14ed389719c0866de3d649 (diff)
feat(nix/buildGo): add the import position to errmsg r/2535
When a foreign dep is missing a dependency, it is good to have a
context.

e.g. the `github.com/charmbracelet/bubblegum` package has a lot of
dependencies that are only used in its `examples/` dir; this is not
obvious, unless we also print where the imports come from.

New error message:

```
error: missing foreign dependency 'github.com/containerd/console' in 'github.com/charmbracelet/bubbletea, imported at /nix/store/0cry4sg6bzxqwk5zl2nxhas6k5663svg-source/tea.go:22:2'
```

Change-Id: If34a3c62b9d77d4aea108b5e011e16fbd03e8554
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2852
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix/buildGo/external/default.nix')
-rw-r--r--nix/buildGo/external/default.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nix/buildGo/external/default.nix b/nix/buildGo/external/default.nix
index de29df4164..6540faf04c 100644
--- a/nix/buildGo/external/default.nix
+++ b/nix/buildGo/external/default.nix
@@ -56,8 +56,8 @@ let
         throw "missing local dependency '${lib.concatStringsSep "." d}' in '${path}'"
       ) self) entry.localDeps;
 
-      foreignDeps = map (d: lib.attrByPath [ d ] (
-        throw "missing foreign dependency '${d}' in '${path}'"
+      foreignDeps = map (d: lib.attrByPath [ d.path ] (
+        throw "missing foreign dependency '${d.path}' in '${path}, imported at ${d.position}'"
       ) depMap) entry.foreignDeps;
 
       args = {