Skip to content

Split a large BUILD file into multiple files #3328

Answered by chrisnovakovic
linuxerwang asked this question in Q&A
Discussion options

You must be logged in to vote

You could probably do it with subincludes, but I wouldn't recommend it. There's a pretty clean alternative if you use go_module, though - you could split the module import paths on forward slash characters and have a separate intermediate directory for each component, e.g.

## third_party/go/github.com/agnivade/levenshtein/BUILD

go_module(
    name = "levenshtein",
    module = "github.com/agnivade/levenshtein",
    version = "v1.2.0",
)

You can then refer to the module as //third_party/go/github.com/agnivade/levenshtein. You'd have a lot of BUILD files this way, but each one would be tiny.

It doesn't work out as cleanly as this if you use go_repo, because go_repo defines a subrepo insid…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by toastwaffle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3321 on January 14, 2025 11:12.