riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.34k stars 89 forks source link

Add CLI version subcommand and flag #537

Closed brandur closed 3 weeks ago

brandur commented 3 weeks ago

I was trying to help which River CLI I had installed and realized there's no easy way to know this currently because it can't currently reveal its version information in any built-in way.

Here, add a river version subcommand that prints the version of the Go module it's distributed as, along with the version of Go used to build it, making accessing version information easy.

I also added support for a river --version flag. There's no common standard on whether version should be revealed by subcommand or flag, and since --version's (unlike -v) never going to be used for anything else, we may as well be permissable in what we accept.

I also add a basic framework for a CLI "integration" test suite that allows CLI commands to be tested from the level of the Cobra command, which is useful for checking flags and such. It has the downside in that there's no way to inject a test transaction into it, so it's not always appropriate for use right now.

brandur commented 3 weeks ago

Thanks!

Also, I had to tie golangci-lint to 1.60.1. It was upgrading to the new 1.60.2 in CI (not even available yet on Homebrew) which despite a patch-level release, came with a bunch of breaking changes. Ugh.

ccoVeille commented 3 weeks ago

Thanks!

Also, I had to tie golangci-lint to 1.60.1. It was upgrading to the new 1.60.2 in CI (not even available yet on Homebrew) which despite a patch-level release, came with a bunch of breaking changes. Ugh.

Yes, golangci-lint 1.60.2 is quite broken.