Hey there, I was working on updating a piece of software I maintain tonight to use Go 1.9, specifically I needed the monotonic time source in time.Time. I decided I wanted to prevent my software from being compiled on anything less than Go 1.9, because the behavior could be unexpected when a leap second occurs, so I tried to figure out how to do that.
I ended up coming up with a package called "goconstraint", which allows you to use a blank import to require a minimum Go version at compile time: - https://github.com/theckman/goconstraint It uses a build tag, a constant, and a blank variable identifier to do the version constraint check at compile time. I've implemented an import for all versions, that can be restricted by build tags (go1.1 - go1.9), and plan on adding new versions as they are released. There's also a `latest` meta-constraint that I've created, and plan to update as new versions come out, but I _may_ remove it because it seems like it could be painful if someone were to use it. Someone in the Gopher Slack group recommended that I relicense the constraint imports in to the Public Domain, so that people can copy the code instead of depending on my package. This package is super simple, and it seems like a great idea, so I plan on trying to make time to do this either tomorrow or Monday. I'm curious what the community thinks of this package. Is there another / better way to do this that I haven't realized? Cheers! -Tim -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.