I’m finding the various Rust guides well written — or perhaps just well written for me. This bit in the Cargo Guide (Rust’s package manager and build tool) on Cargo.lock
files was particularly succinct.
If you’re building a non-end product, such as a rust library that other rust packages will depend on, put
Cargo.lock
in your.gitignore
. If you’re building an end product, […] like a command-line tool or an application, or a system library with crate-type ofstaticlib
orcdylib
, checkCargo.lock
intogit
. If you’re curious about why that is, see “Why do binaries have Cargo.lock in version control, but not libraries?” in the FAQ.
I remember learning about package manager .lock
files for composer and npm, and most of what was written about them was selling you on a particular use case.
This is why you must use
.lock
files_
or
Using a
.lock
file? Here’s 10 reasons you’re history’s greatest a monster
The Rust docs are great here because they lay out simple rules for a beginner to follow, but then back that rule up more in-depth documentation elsewhere.