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

Application version support #381

Closed
JiriSko opened this issue Mar 30, 2020 · 7 comments · Fixed by #506
Closed

Application version support #381

JiriSko opened this issue Mar 30, 2020 · 7 comments · Fixed by #506

Comments

@JiriSko
Copy link

JiriSko commented Mar 30, 2020

Hi, thanks for this great tool.

Would be possible to add application version support in standard way? I mean to add --version CLI option which shows revive version.

@mgechev
Copy link
Owner

mgechev commented Apr 9, 2020

Maybe revive -help can show the current SHA. In general, I am hoping us to not have to stick to a particular version. Instead, revive is supposed to be an "evergreen" tool that anyone can use the last version of. That's one of the reasons I was originally against introducing semver to the project.

@JiriSko
Copy link
Author

JiriSko commented Apr 9, 2020

That would be helpful. I just want to see in my pipeline which version I'm using and this would be enough.

@nano-adhara
Copy link

+1 golint doesnt provide any information and i was hoping for this tool to provide such information on top of golint

@nvuillam
Copy link

@mgechev I also need --version for Mega-Linter , please :)

@Clivern
Copy link
Contributor

Clivern commented Mar 16, 2021

I can do this if this PR (#503) got approved/released, since goreleaser already provide these info from git as ldflags during build. it is just a matter of adding the following vars to main.go and create a command to return them.

var (
	version = "dev"
	commit  = "none"
	date    = "unknown"
	builtBy = "unknown"
)

// in the --version or --help command handler
fmt.Sprintf(
	`Current revive Version %v Commit %v, Built @%v By %v.`,
	version,
	commit,
	date,
	builtBy,
),

if you're building revive manually, then it is your responsibility to provide the version during build (eg. go build -v -ldflags="-X 'main.version=v1.0.0' -X 'main.commit=46f65914e3b26f7044ffe6842ecce10b58e2c2aa' -X 'main.date=@2021-03-21T21:37:16Z' -X 'main.builtBy=clivern'") or it will be unknown, same goes for commit, date, builtBy

@chavacava
Copy link
Collaborator

@Clivern #503 is merged ;)

@Clivern
Copy link
Contributor

Clivern commented Mar 21, 2021

yeah, i will take care of this request then @chavacava

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants