← BYTES
Go·Starter·Ref: 10.1.20

What is the purpose of the `go.sum` file that sits alongside `go.mod` in a Go module?

Have a question about this video? Mention reference 10.1.20 when you contact us.

a.It records cryptographic checksums of every dependency module version the build actually uses, so Go can verify downloaded dependencies haven't been tampered with or altered since they were first fetched
b.It is a human-editable changelog of what changed in each dependency version
c.It stores the compiled binary output of all dependencies
d.It is an optional file with no effect on builds, kept only for historical reasons
go.sum is a security/integrity file: for every dependency (and version) go.mod references, go.sum records a cryptographic hash of its contents, and the go command verifies downloaded module code against these hashes on every build -- protecting against a dependency silently changing contents under the same version number, whether through tampering or a compromised module source.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES10120#Go