Description
openedon Mar 15, 2023
Problem
I would like to depend on Hashicorp's nomad_client
, provided as a Git dependency here: https://github.com/hashicorp/nomad-openapi/blob/main/clients/rust/reqwest/v1/Cargo.toml
The trouble is, Cargo is unable to resolve this dependency reliably, because the repository contains multiple crates named nomad_client
:
% cargo build
Updating git repository `https://github.com/hashicorp/nomad-openapi`
warning: skipping duplicate package `nomad_client` found at `/Users/owen/.cargo/git/checkouts/nomad-openapi-7f8fcd3b1b2636d4/98be39a/clients/rust/hyper/v1`
Today, Cargo happens to select the nomad_client
crate that I want, but that could change if the order of traversal changes. (In fact, I think this ambiguity should be a hard error.)
Proposed Solution
If I were able to specify the specific subtree, I would be able to reliably tell Cargo which of the two nomad_client
crates to import.
Notes
Hashicorp's own instructions suggest copying the client library into my project, and using a path
dependency. This works, but it makes dependency updates much more complicated.
This proposal is similar to #1462. However, the solution in that issue requires that the crate name be unique within the repository. That's not the case here.
Obviously, the Right Answer is for Hashicorp to fix the crate names and ideally even to publish them to Crates.io. I've proposed that here, but I'd like to move forwards while I wait for a response.