Skip to content

build: preserve version when build via go install#81

Merged
mroth merged 1 commit intomainfrom
versioninfo
Jul 23, 2025
Merged

build: preserve version when build via go install#81
mroth merged 1 commit intomainfrom
versioninfo

Conversation

@mroth
Copy link
Copy Markdown
Owner

@mroth mroth commented Jul 23, 2025

No description provided.

@mroth mroth requested a review from Copilot July 23, 2025 14:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves version handling by implementing a fallback mechanism to use embedded version information when the application is built via go install, ensuring proper version reporting in both production and development builds.

  • Extracted version variables from main.go to dedicated version.go file
  • Added dependency on versioninfo/v2 package for automatic version detection
  • Updated GoReleaser configuration to use -trimpath flag and additional build metadata

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
version.go New file containing version variables and Version() function with fallback logic
options.go Updated version flag handler to use the new Version() function
main.go Removed version variables (moved to version.go)
go.mod Added versioninfo/v2 dependency
.goreleaser.yml Enhanced build configuration with trimpath and additional ldflags

Comment thread .goreleaser.yml Outdated
@mroth mroth merged commit 1342929 into main Jul 23, 2025
5 checks passed
@mroth mroth deleted the versioninfo branch July 23, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants