bazel-contrib / bazel-contrib/rules_go

gopackagesdriver calls query which churns the analysis cache

Open
#3,533 8 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Due to https://github.com/bazelbuild/bazel/issues/3054 it's nearly impossible to avoid a `.bazelrc` file having lines that affect the analysis cache between `build` and `query`.

Since gopackagesdriver does `bazel query` in the background, it can cause mysterious churning where users `bazel build` commands are slow, and then the gopackagesdriver is also slow, as they churn back and forth (in particular, debugging this just now, I saw `go_repository` repo rules having to re-run gazelle every time)

I think the solution for most users is likely just to have gopackagesdriver use a distinct Bazel server by passing an `--output_base` flag to point to a separate folder. Maybe the resolution to this issue is just to better document the problem and that solution.

Contributor guide

Open the contributing guide

Research direction

Start by locating gopackagesdriver and the code that invokes bazel query; review how the Bazel server and .bazelrc affect the analysis cache. Compare using a separate --output_base with the current behavior, and verify that build and gopackagesdriver no longer churn the cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.