Description
Apologies for not adhering to the default issue template, the issue is not a "bug" per se and not an issue with Go itself, so all those version and env infos would be useless.
gomobile
added module support recently, which works spectacularly. One thing, however, that I did notice, is that if I call gomobile bind
on a package that has heavy dependencies, those get rebuilt from scratch for every build, making the build very painful.
E.g. Binding https://github.com/coronanet/go-coronanet will take 30 mins as it needs to build a dependent package that contains a huge C library (Tor). However, trying to call bind again with zero modifications will again take 30 mins. This is in contrast with building simply with Go locally, which will take 5 mins for the first run, but will be ~instantaneous afterwards (only link time is left).
My best guess until now is that gomobile bind
creates its own temporary working directory /tmp/gomobile-work-xxxxxxxx
and thus all code operations are short circuited into that folder, away from the system caches. This results in all object files produced by one build run to be deleted at the end.
Issue opened per @hajimehoshi 's request in #27234 (comment).
Continuing a thread from the above issue:
Aha, gobind, which is invoked by gomobile, generates a source code from Go packages for binding, and they are not cached indeed. Did you mean 'cache' of them?
No, I'm not referring to caching the generated files, rather the module dependencies of them, which should most definitely be cacheable.