Skip to content

Conversation

danvergara
Copy link
Owner

@danvergara danvergara commented Oct 22, 2024

Improve the version handling

Description

The other day I was reading about how to add a version flag in Go and remembered that the current way to update the version flag sucks, so I went ahead and implemented what I read on the article adding some minor improvements for my use case.

Changes:

  • There's a new --version flag which behaves exactly like the version command
  • If dblab is installed using go install, the command's output will be like this dblab version v0.26.0
  • If installed using brew or directly downloading the files in the release, the output will be the same as above
  • If build locally, the output will show the latest commit revision dblab version rev: b7b59ff

References:

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested it using different scenarios.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@danvergara danvergara self-assigned this Oct 22, 2024
@danvergara danvergara added the kind/enhancement New feature or request label Oct 22, 2024
@danvergara danvergara marked this pull request as ready for review October 22, 2024 16:02
@danvergara danvergara merged commit b64994b into main Oct 23, 2024
8 checks passed
@danvergara danvergara deleted the improve-version-flag branch October 23, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants