Go and Bazel Development Setup
This guide is for developers contributing to Michelangelo's Go backend services (API server, controller manager, worker). If you're building ML pipelines with the Python SDK, see Python IDE Setup instead.
Go IDE Setup
VS Code / Cursor
- Install Go and verify with
go version. - Install gopls (the Go language server).
- Open the michelangelo root folder in VS Code / Cursor.
- When you open a
.gofile, you should see "Setting up workspace: Loading packages..." in the status bar. Once complete, autocomplete, go-to-definition, and other language server features will work.
GoLand / IntelliJ
- Install the Bazel for IntelliJ plugin: GoLand > Settings > Plugins > search "Bazel for IntelliJ".
- Open the workspace root directory (not the
/godirectory) as your project root. - The plugin indexes dependency libraries and proto-generated Go files automatically.
- After changing Bazel files (e.g., after running Gazelle), click the green Bazel icon in the top-right corner to re-sync.
Bazel Configuration
macOS C++ Compiler
If Bazel fails with C++ build errors on macOS, add these lines to your ~/.zshrc:
export CC=clang
export CXX=clang++
Then restart your terminal or run source ~/.zshrc.
GoLand Bazel Wrapper
GoLand doesn't automatically load .envrc files. To make it use the command-line tools in the tools/ directory, create a wrapper script:
#!/usr/bin/env bash
# GoLand always calls bazel from the project root directory.
export PATH=${PWD}/tools:${PATH}
bazel "$@"
Save this script (e.g., as ~/bin/bazel-goland.sh), make it executable with chmod +x, and set it as the Bazel binary in GoLand > Settings > Other Settings > Bazel Settings.