So make build, make install and goreleaser build produce the exact same binary.
The fix consists mainly of tuning the ldflags of the Makefile and of the .goreleaser file:
arguments must be in the same order
removed -X main.commit and -X main.date because this is the default ldflags of goreleaser and they were probably blindly reported in the customized version, but they are actually useless since there's no commit nor date field in the main package of the application.
replaced tendermint/tendermint by cometbft/cometbft
A couple of other tiny things had to be updated:
aligning the version name when there's no tag (snapshot.template_name in goreleaser and VERSION var in Makefile)
fix Makefile VERSION var when there's a tag
add CGO_ENABLED=0 in Makefile
remove double quotes around the BuildTags ldflag because it's useless and goreleaser doesn't use double quotes.
Quick demo:
$ make build install # produce build/govgend and $GOBIN/govgend
$ goreleaser build --single-target --clean --snapshot # produce dist/govgend_linux_amd64_v1/govgend
$ sha256sum $GOBIN/govgend build/govgend dist/govgend_linux_amd64_v1/govgend
77c3249d8b6ae81b4bf9d0d1b683ba7658a63db2fff517c50837e91e73e248da /home/tom/go/bin/govgend
77c3249d8b6ae81b4bf9d0d1b683ba7658a63db2fff517c50837e91e73e248da build/govgend
77c3249d8b6ae81b4bf9d0d1b683ba7658a63db2fff517c50837e91e73e248da dist/govgend_linux_amd64_v1/govgend
So
make build
,make install
andgoreleaser build
produce the exact same binary.The fix consists mainly of tuning the ldflags of the Makefile and of the .goreleaser file:
-X main.commit
and-X main.date
because this is the default ldflags of goreleaser and they were probably blindly reported in the customized version, but they are actually useless since there's nocommit
nordate
field in the main package of the application.A couple of other tiny things had to be updated:
Quick demo: