Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary version clarification #41

Closed
mertssmnoglu opened this issue Jan 19, 2025 · 0 comments · Fixed by #45
Closed

Binary version clarification #41

mertssmnoglu opened this issue Jan 19, 2025 · 0 comments · Fixed by #45
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@mertssmnoglu
Copy link
Member

Enhancement

We need to know the version of the binary by using a command like capture --version. Without knowing the exact version of capture, we cannot be 100% certain about its behavior.

It's very important for troubleshooting.

How to implement?

package main

import (
	"flag"
	"fmt"
	"os"
)

var version = "develop" // We can modify the version variable on the compile time using go build flags

func main() {
	showVersion := flag.Bool("version", false, "Display the version of the capture")
	flag.Parse()

	// Check if the version flag is provided
	if *showVersion {
		fmt.Printf("capture version: %s\n", version)
		os.Exit(0)
	}
	// rest of it
}
@mertssmnoglu mertssmnoglu added enhancement New feature or request good first issue Good for newcomers labels Jan 19, 2025
@mertssmnoglu mertssmnoglu added this to the v1.1 milestone Jan 19, 2025
@mertssmnoglu mertssmnoglu self-assigned this Jan 19, 2025
mertssmnoglu added a commit that referenced this issue Feb 1, 2025
Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>
mertssmnoglu added a commit that referenced this issue Feb 1, 2025
Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>
mertssmnoglu added a commit that referenced this issue Feb 2, 2025
* feat(main): Add version flag to display application version #41

Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>

* feat(goreleaser): Add versioning support and static build flags

- s
- w
- extldflags static
- X main.Version = APP_VERSION

Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>

---------

Signed-off-by: Mert Şişmanoğlu <mert190737fb@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant