fix(bazel): add build_directives to com_github_spf13_afero for golang.org/x/text deps#43906
Closed
fix(bazel): add build_directives to com_github_spf13_afero for golang.org/x/text deps#43906
Conversation
….org/x/text deps Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix missing strict dependencies for com_github_spf13_afero
fix(bazel): add build_directives to com_github_spf13_afero for golang.org/x/text deps
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI failing with
compilepkg: missing strict dependenciesforafero/util.goimportinggolang.org/x/text/{runes,transform,unicode/norm}— thego_repositorylackedbuild_directivesto resolve these against the already-pinned@org_golang_x_text.Change
build_directivestocom_github_spf13_aferoinbazel/dependency_imports.bzl, matching the pattern used inorg_golang_google_grpcand similar repos:Original prompt
Problem
CI is failing with
compilepkg: missing strict dependencieserrors forcom_github_spf13_afero:Execution result: https://envoy.cluster.engflow.com/actions/executions/ChDAJYdW09tcipWHDNppTfrREgdkZWZhdWx0GiUKIFU-Ms3kbpWOCl5kZ-ZOwLtmTWHOdQ7RhuvL8EsUHS3aEKsC
Root Cause
The
com_github_spf13_aferogo_repositoryinbazel/dependency_imports.bzldoes not havebuild_directivesto resolve thegolang.org/x/textsub-packages it imports against the already-pinned@org_golang_x_textrepository.Fix
Add
build_directivesto thecom_github_spf13_aferogo_repositorydefinition inbazel/dependency_imports.bzl(line 169-175), following the same pattern used fororg_golang_google_grpcand other repos that resolved similar issues (e.g., PR #40860).Change the existing definition from:
To:
Only the file
bazel/dependency_imports.bzlneeds to be changed.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ci just started failing ...
Configuration: f2fcbc7fec0f5a3043f1d0ef5128be9f0622a65d9e8354f2f7be6189b765633e
Execution platform: //bazel/platforms/rbe:linux_x64
Execution result: https://envoy.cluster.engflow.com/actions/executions/ChDAJYdW09tcipWHDNppTfrREgdkZWZhdWx0GiUKIFU-Ms3kbpWOCl5kZ-ZOwLtmTWHOdQ7RhuvL8EsUHS3aEKsC
compilepkg: missing strict dependencies:
/mnt/engflow/worker/work/7/exec/external/com_github_spf13_afero/util.go: import of "golang.org/x/text/runes"
/mnt/engflow/worker/work/7/exec/external/com_github_spf13_afero/util.go: import of "golang.org/x/text/transform"
/mnt/engflow/worker/work/7/exec/external/com_github_spf13_afero/util.go: import of "golang.org/x/text/unicode/norm"
we just fixed a bunch of these - so i think straightforward - no ?
Assistant:
Let me look at how similar strict dependency issues were recently fixed in the envoy repo, and examine the current state of the
com_github_spf13_aferodependency.Assistant: Now let me look at PR #40860 to see how the previous similar fix was done, and also check if
com_github_spf13_aferohas anydepsspecified:Assistant: Yes, this is exactly the same pattern as the previous fix in PR #40860. The
com_github_spf13_aferolibrary (github.com/spf13/afero) imports packages fromgolang.org/x/text(runes,transform,unicode/norm), but thego_repositorydefinition doesn't havebuild_directivesto resolve those dependencies against the already-pinned@org_golang_x_textrepo.The fix is to add
build_directivesto thecom_github_spf13_aferogo_repositoryinbazel/dependency_imports.bzl, similar to howorg_golang_google_grpcresolves its transitive deps. Specifically:This tells Gazelle to resolve the three
golang.org/x/textsub-packages thatafero/util.goimports against the already-pinned@org_golang_x_textrepository, rather than expecting them as direct strict dependencies.Want me to create a PR with this fix?
User: yes
Assistant: I'...
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.