<#22097 Use go.mod local "replace" semantics to in...
# github-notifications
c
#22097 Use go.mod local "replace" semantics to infer dependencies across modules Issue created by fabric-peter Is your feature request related to a problem? Please describe. The dependency inference of the Go plugin could be improved to support multiple modules which refer to each other. Without inference, of course the
dependencies
field of the
go_package
target can be manually updated, but the addition would reduce the overhead of using Pants in a repository with multiple, dependent Go modules. Describe the solution you'd like The current dependency inference within the Go plugin allows inference between
go_package
targets within the same module. Within Go, modules may depend on each other within the same repository by pairing a
require <repo> <version>
line with a
replace <repo> => <relative-path>
described here in the Go documentation. The
analyze_module_dependencies
Rule currently parses
go.mod
dependencies and its output is used by the
download_and_analyze_third_party_packages
. I would recommend adding a
first_party_modules
member to the
ModuleDescriptors
class. The
analyze_module_dependencies
can populate this field, the value can be ignored by existing rules, but used by
infer_go_dependencies
rule to create additional inferred dependencies. Describe alternatives you've considered • Manual dependency inference: current behavior • Separate rule for discovering these relationships: requires parsing the same file multiple times instead of making use of the cache. Additional context PR #22091 Issue #14996 pantsbuild/pants