tweag / gazelle_haskell_modules

A gazelle extension to generate haskell_module rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal error when trying to use gazelle_cabal and gazelle_haskell_modules together

googleson78 opened this issue · comments

While trying to smash gazelle_cabal and gazelle_haskell_modules together in a single gazelle invocation, I get the following golang exception:

panic: interface conversion: interface {} is gazelle_cabal.ImportData, not *gazelle_haskell_modules.HRuleImportData

goroutine 1 [running]:
github.com/tweag/gazelle_haskell_modules/gazelle_haskell_modules.(*gazelleHaskellModulesLang).Resolve(0x0, 0xc000170420, 0x400?, 0xc0006bf360?, 0xc00006e980, {0x9b8940?, 0xc000082720?}, {{0xc00015a019, 0x15}, {0x0, ...}, ...})
        external/io_tweag_gazelle_haskell_modules/gazelle_haskell_modules/lang.go:175 +0x21f
main.runFixUpdate({0xc00002a01a, 0x28}, 0x7ffcbae73675?, {0xc000132010, 0x0, 0x0})
        external/bazel_gazelle/cmd/gazelle/fix-update.go:376 +0x1356
main.run({0xc00002a01a?, 0x28?}, {0xc000132010?, 0x1?, 0x1?})
        external/bazel_gazelle/cmd/gazelle/gazelle.go:95 +0x1f3
main.main()
        external/bazel_gazelle/cmd/gazelle/gazelle.go:72 +0xdd

Adding gazelle_haskell_modules as a different target and running them in order works out fine.

Is this workflow of using a single target for both ("@io_tweag_gazelle_cabal//gazelle_cabal" and "@io_tweag_gazelle_haskell_modules//gazelle_haskell_modules" added to languages for the same target) simply not supported? If so, perhaps we should extend the README to indicate this. Additionally, it might be nice to add some better error instead of showing the internal golang exception. I guess this could be an issue for gazelle_cabal instead though.

Since gazelle_cabal generates rules that gazelle_haskell_modules needs to analyse, they are not straight-forward to run in a single gazelle invocation. I think it is good idea to say something about it in the readme.