You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go's builds are not reproducible by default. In fact, the missing piece was only added to the upcoming 1.13 a couple of weeks ago: #16860
So I'm not sure why you'd expect the binaries to be exactly the same before and after, given that modules and dep store dependency source files in different locations on disk.
oh really? I know the dependency source files are in different locations on disk and thought they are the same version(same files in different location) therefore I expect the binaries to have the same hash value.
A build with “same files in different location” does not produce the same resulting binary, because (by default) the debug information for the binary embeds the absolute paths to the source files: simply moving the file changes the resulting binary.
That makes debugging easier, especially in an IDE, but comes at the cost of reproducibility.
Using a go toolchain built from head, you can either use go build -trimpath explicitly, or set GOFLAGS=-trimpath to get reproducible builds by default.
First, I use
dep ensure
and then build the projecthere I get the build result and sum it's md5:
Then, try to remove folder vendor and enable go mod by running :
now to sum the md5 of build output again:
It is different with previous one
How to make sure build result is identical after migrate dep to go mod?
What version of
dep
are you using (dep version
)?v0.5.0
What
dep
command did you run?dep ensure
What did you expect to see?
build output should be identical no matter use dep or gomod
What did you see instead?
build output is different after migrate from dep to go module
The text was updated successfully, but these errors were encountered: