Why weren't the newest version of dependencies fetched?

I have added dependencies in a Rust project like this:

rust_wheel = { git = "https://github.com/jiangxiaoqiang/rust_wheel.git" }

When I built this project in GitHub Actions, I found it got the legacy version of rust_wheel:

   Compiling rust_wheel v0.1.0 (https://github.com/jiangxiaoqiang/rust_wheel.git#5dffd2f5)
error[E0412]: cannot find type `Json` in module `content`
  --> /usr/local/cargo/git/checkouts/rust_wheel-8476ff1b418e67f8/5dffd2f/src/common/util/model_convert.rs:35:50
   |
35 | pub fn box_rest_response<T>(data: T) -> content::Json<String> where T: Serialize + Default {
   |                                                  ^^^^ not found in `content`
   |
help: consider importing one of these items
   |
1  | use diesel::pg::types::sql_types::Json;

GitHub Actions got the version 5dffd2f5, but the newest version of rust_wheel was 52bccd9a4a3ece5cf9416510b7f8a4274d205da1. Why didn’t it get the newest one? What should I do to make it get the newest versions of dependencies?

>Solution :

Likely you have a Cargo.lock file, which is designed to prevent updating dependencies from under your nose by keeping track of the specific versions you’re using. If there are changes in the git repository that you want to use, you can update the Cargo.lock file using cargo update:

cargo update -p rust_wheel

Another option is to explicitly define the revision to use in your Cargo.toml:

rust_wheel = { git = "https://github.com/jiangxiaoqiang/rust_wheel.git", rev = "52bccd9a" }

Leave a Reply