Open jkomoros opened 6 years ago
Also captured in #655, which now makes more sense given that more is moving to that tool.
This is actually pretty easy: boardgame should have the main version as a public field. Autoreader emits something like this at the top of auto_reader.go:
func init() {
if !boardgame.Version.Equivalent(semvar.Version("BAKED VERSION STRING") {
panic("Package uses an autoreader generated by an old version of boardgame-util. Re-run `go generate`")
}
}
boardgame-util version
(later, should verify when running that each package's CodeGenVersion is that version or higher), use https://github.com/blang/semverA similar thing should happen for boardgame-util
in general. It should check and verify if it's the most recent boardgame-util version or if it needs to be reinstalled.
Note that keeping the version in the main package up to date with the version that it is as far as go get
is concerned will be interesting
In case there's a new version of the library and you're about to overwrite with an old version.
The easiest approach is probably to emit a structure comment in autoreader output that contains the version number of autoreader that created it, and then before we overwrite a file, check to see if it was saved with a newer version of autoreader before, and if so, refuse to overwrite and provide instructions to updgrade autoreader.