shurcooL / binstale

binstale tells you whether the binaries in your GOPATH/bin are stale or up to date.
MIT License
146 stars 4 forks source link

what does `(build ID mismatch)` mean exactly? #11

Open Dieterbe opened 7 years ago

Dieterbe commented 7 years ago

when I run binstale i'm getting a lot of (build ID mismatch) messages, but it's unclear what these mean. I've been a fulltime go programmer for a few years but somehow never ran into this term, I presume I'm far from alone. Some quick google searching was also unfruitful, so I think it would be really useful if this program (or the documentation) was more clear and detailed.

thanks

dmitshur commented 7 years ago

This is an external phrase that's coming from the Go build tool.

Try running:

go list -f '{{.ImportPath}} - {{.Stale}} - {{.StaleReason}}' github.com/something/stale

The way modern Go determines if a package is stale or not is by comparing a small build ID, a hash of sorts. If it doesn't match, that means something in the package has changed (the source code, set of files, build tags, etc.).

See its source:

https://github.com/golang/go/blob/ab5a2173f91c1e2779cdf49a2fc8a7abafecd5f1/src/cmd/go/pkg.go#L1484-L1495

StaleReason field was added in Go 1.7, so it's quite recent. See https://golang.org/doc/go1.7#cmd_go.