Cargo.lockとは?
Cargo.lockの解説。何をするもので、CI/CDでどう重要かを含みます。
Cargo.lockは、Rustプロジェクトで解決されたすべての依存関係の正確なバージョンを記録します。
何であるか
再現可能なビルドを保証します。慣例として、バイナリ/アプリケーションではCargo.lockをcommitし、ライブラリでは任意です。
CI/CDで重要な理由
CIはcargo build --lockedを使うため、古いCargo.lockは新しいバージョンを黙って解決する代わりにビルドを失敗させます。
重要なポイント
- Cargo.lockはcrateの正確なバージョンを固定します。
- アプリケーションではcommitしましょう。
- CIでは--lockedを使いましょう。
関連ガイド
What Is Cargo.toml?Cargo.toml is the manifest for a Rust crate. Learn what it declares for CI builds.
What Is a Lockfile and Why Should You Commit It?A lockfile pins the exact versions of every dependency so builds are reproducible. Learn why committing it is…
What Is a Reproducible Build?A reproducible build produces byte-for-byte identical output from the same source, every time. Learn what bre…