myitcv / gobin

gobin is an experimental, module-aware command to install/run main packages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cached binaries should be invalidated on Go version changes

stk0vrfl0w opened this issue · comments

The gobin cache for a given binary isn't invalidated when the version of Go has changed. In practice, this leads to issues when the compilation behavior differs.

As a concrete example, module builds of swagger-go @ 0.20.1 with go 1.12 results in a perfectly fine working binary whereas go 1.13 creates a binary that throws stack traces when trying to generate models. Due to gobin's current caching behavior, one may be lead to falsely believe that the go 1.13 toolchain works fine for building the 0.20.1 version of swagger-go.

Please can you confirm the version of gobin you are using?

I'm installing via "go get", which should be the latest commit: f2461c8

I'm minded to agree with your suggestion here. Indeed I'm somewhat surprised we didn't do this to start with.

gobin needs a bit of a rewrite and so I'll bundle this up that work.

I just ran into this issue as well. I suspect a simple fix here is to just change the gobinCache location to include runtime.Version() in its path (or alternatively use the version reported by go version). If that is an acceptable fix, I can probably send a PR..