Hi everyone,
Thanks for taking the time to read this.
I'm looking for help in improving the development loop for the following setup (which I'm happy to change) for the following actions. My problem is around the in-efficiency importing a new dependency in Go.
The setup:
* I'm using Bazel to manage dependencies and build.
* I'm using Gazelle to generate Bazel files and update dependencies from `go.mod`.
* I'm using IntelliJ with the Bazel plugin.
The current development loop to import something (that already has a dependency in our WORKSPACE):
1. I have to use the import first in the Go file (so IntelliJ doesn't remove it).
2. I have to then import manually in the Go file (because IntelliJ + Bazel Plugin doesn't know it exists).
3.
Then, run `gazelle` to update the build files, which will update the
build file for the Go file we are editing. It will add the dependency
for us.
4. Then, in Intellij, run "Menu Bar > Bazel > Sync > Sync Project with BUILD files".
This allows IntelliJ to know about the import via the BUILD.bazel file.
Therefore allowing me to have auto-completion and documentation.
If we don't have the dependency, we can add two steps between 2 & 3, which I'll add the full method here:
1. I have to use the import first in the Go file (so IntelliJ doesn't remove it).
2. I have to then import manually in the Go file (because IntelliJ + Bazel Plugin doesn't know it exists).
3. I can then `go get ...`, I could've done this first, but it doesn't matter.
4. Then, run `gazelle update-repos` to update `deps.bzl`, which is all of my deps which is imported into my WORKSPACE.
5. Then, run `gazelle` to update the build files, which will update the build file for the Go file we are editing. It will add the dependency for us.
6. Then, in Intellij, run "Menu Bar > Bazel > Sync > Sync Project with BUILD files". This allows IntelliJ to know about the import via the BUILD.bazel file. Therefore allowing me to have auto-completion and documentation.
Usually, I can just start using the import in IntelliJ and it will auto-import it for me. I'm wondering if there is anything I can do to get closer to that user experience... it's a lot slower and a lot more tedious at the moment.
I've tried finding something, but nothing yet. I'll report back if I do find something.
Thank you and kind regards,
Scott