You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I heighliner version --long
Then I should see:
The project name
Server name
Version number
Commit hash
Build tags
Go version
List of build dependencies with versions
Title
Add Version Support for Heighliner
Description
Request to add version support to Heighliner to enhance user experience and supportability. This would allow users to quickly verify the version, commit hash, build tags, Go version, and dependencies used to build the heighliner binary.
Proposed Feature Details
Implement a new command heighliner version --long that outputs detailed version information, similar to the provided example. This should include:
The project name
Server name
Version number
Commit hash
Build tags
Go version
List of build dependencies with versions
Example Output
heighliner version --long
name: heighliner
server_name: heighlinerd
version: x.y.z
commit: <commit_hash>
build_tags: <tags>,
go: go version go1.x.x <platform>
build_deps:
- dependency1@version
- dependency2@version
...
This feature will assist in troubleshooting, enhance the development workflow, and ensure compatibility across different environments.
To typically add version support in a Go project, you would:
Define a Version Package: Create a package dedicated to managing version information. This package can contain variables for the version number, commit hash, build date, and other relevant information.
Populate Version Information at Build Time: Use Go's -ldflags option to inject version information at build time. This can be done within a build script or your CI/CD pipeline.
Implement the Version Command: In your application's command-line interface (usually using a package like cobra for Go CLI applications), implement a version command that outputs this information.
Retrieve and Display Version Information: Within the version command, retrieve the version information from the version package and display it to the user.
Example version.go in the version package might look like this:
package version
var (
Version="dev"// overridden at build timeCommit="none"// overridden at build timeBuildDate="unknown"// overridden at build time
)
When I
heighliner version --long
Then I should see:
Title
Add Version Support for Heighliner
Description
Request to add version support to Heighliner to enhance user experience and supportability. This would allow users to quickly verify the version, commit hash, build tags, Go version, and dependencies used to build the
heighliner
binary.Proposed Feature Details
Implement a new command
heighliner version --long
that outputs detailed version information, similar to the provided example. This should include:Example Output
This feature will assist in troubleshooting, enhance the development workflow, and ensure compatibility across different environments.
To typically add version support in a Go project, you would:
Define a Version Package: Create a package dedicated to managing version information. This package can contain variables for the version number, commit hash, build date, and other relevant information.
Populate Version Information at Build Time: Use Go's
-ldflags
option to inject version information at build time. This can be done within a build script or your CI/CD pipeline.go build -ldflags "-X main.version=1.0.0 -X main.commit=$(git rev-parse HEAD) -X main.date=$(date +%F)"
Implement the Version Command: In your application's command-line interface (usually using a package like
cobra
for Go CLI applications), implement aversion
command that outputs this information.Retrieve and Display Version Information: Within the
version
command, retrieve the version information from the version package and display it to the user.Example
version.go
in the version package might look like this:And in your CLI handling part:
Remember to replace
"yourproject/version"
with the actual import path of your version package.The text was updated successfully, but these errors were encountered: