Bazel with Go for Monorepos.
- Install Bazel
brew install bazel- Create a WORKSPACE file in the route of the project
- Create a BUILD file in the route
- Run Gazelle
bazel run //:gazelle - Update project dependencies (if needed)
bazel run //:gazelle --update-repos -from_file=go.mod- Might need to
chmodthe shell file
sudo chmod 755 status.sh- Run with stamp
bazel build --stamp --workspace_status_command=$(pwd)/status.sh //... - Run the binaries
bazel-bin/cmd/a/a_/a
bazel-bin/cmd/b/b_/b
bazel-bin/cmd/c/c_/c- Update a single binary and recheck the stamps