-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(clipper/options): Enhance version handling and remove pointe…
…rs for improved usability (#37) * feat(version): implement dynamic versioning with build metadata This commit refactors the version management in Clipper: - Introduces package-level variables `Version` and `BuildMetadata` in `options.go` with "dev" and "git/source" defaults for development builds. - Adds the `GetVersion()` function to format the version string for display, incorporating build metadata when available. - Updates the Makefile to inject the correct version and build metadata using `-ldflags` during compilation. - Modifies `main.go` to use `GetVersion()` for consistent version display. Now, Clipper displays "dev git/source" when run from source and a tagged version with OS/ARCH information (e.g., "v1.5.0 linux/amd64") when run from a built binary. This improves clarity for users and maintainers alike. Issue #36 * refactor(options): remove pointers from Config struct This commit refactors the `options.Config` struct by changing the `DirectText` and `ShowVersion` fields from pointers (`*string` and `*bool`) to their corresponding value types (`string` and `bool`). The use of pointers was initially introduced to accommodate the return type of `flag.String` and `flag.Bool` in the `ParseFlags` function. However, it resulted in unnecessary complexity and the potential for nil pointer dereferences. By removing the pointers, the code becomes simpler, more readable, and less error-prone. It also eliminates the need to constantly dereference pointers when accessing the values of these fields. Issue #30: Refactor options.Config to Remove Pointer for DirectText (Improving Usability and Testing).
- Loading branch information
Showing
6 changed files
with
67 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters