Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoreader should detect when it's out of date #632

Open
jkomoros opened this issue Jun 29, 2018 · 3 comments
Open

autoreader should detect when it's out of date #632

jkomoros opened this issue Jun 29, 2018 · 3 comments

Comments

@jkomoros
Copy link
Owner

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.

@jkomoros
Copy link
Owner Author

jkomoros commented Aug 7, 2018

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`")
  }
}

@jkomoros
Copy link
Owner Author

jkomoros commented Aug 7, 2018

  • Implement boardgame-util version (later, should verify when running that each package's CodeGenVersion is that version or higher), use https://github.com/blang/semver

@jkomoros
Copy link
Owner Author

jkomoros commented Sep 1, 2018

A 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant