Given that:
The manifest describes user intent, and the lock describes computed outputs. There's flexibility in manifests that isn't present in locks..., as the "branch": "master" constraint will match whatever revision master HAPPENS to be at right now, whereas the lock is nailed down to a specific revision.
This flexibility is important because it allows us to provide easy commands (e.g. dep ensure -update) that can manage an update process for you, within the constraints you specify, AND because it allows your project, when imported by someone else, to collaboratively specify the constraints for your own dependencies.
Reference: https://github.com/golang/dep/blob/master/docs/FAQ.md
The Gopkg. lock file is generated by dep ensure and dep init . It is the output of the solving function: a transitively complete snapshot of a project's dependency graph, expressed as a series of [[project]] stanzas. That means: Every package a project needs to compile.
If we wanted to express the dep ensure guarantee as a sentence, it would go something like this: "Hey dep, please make sure that my project is in sync: that Gopkg. lock satisfies all the imports in my project, and all the rules in Gopkg. toml , and that vendor/ contains exactly what Gopkg.
The Gopkg. toml file is initially generated by dep init , and is primarily hand-edited. It contains several types of rule declarations that govern dep's behavior: Dependency rules: constraints and overrides allow the user to specify which versions of dependencies are acceptable, and where they should be retrieved from.
dep init will make educated guesses about what versions to use for your dependencies, generate sane Gopkg.
Yes, in order to ensure a reproducible build.
There's flexibility in manifests that isn't present in locks..., as the "branch": "master" constraint will match whatever revision master HAPPENS to be at right now, whereas the lock is nailed down to a specific revision.
Anyone cloning your Go project repository with a lock file will get the exact SHA1 of the dependencies.
You can still update that lock file anytime you want, and version its updated content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With