yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
1.04k stars 96 forks source link

Feature: Print version on startup #130

Closed yonahd closed 11 months ago

yonahd commented 1 year ago

Is your feature request related to a problem? Please describe. When running in cluster we should be able to clearly see the version of kor on startup

Describe the solution you'd like Print the version on startup e.g. v0.2.7

sidkhuntia commented 1 year ago

Can i work on it ? and can you point me in some direction? Thank you

yonahd commented 1 year ago

Can i work on it ? and can you point me in some direction? Thank you

Sure.

Take a look at https://github.com/yonahd/kor/blob/main/pkg/utils/banner.go And https://github.com/yonahd/kor/blob/main/cmd/kor/root.go#L48

sidkhuntia commented 1 year ago

Hey, i just wanted to ask where can i get the current version number of kor running @yonahd

yonahd commented 1 year ago

This comes from the git tag. It would need to be embedded during build time possibly in the goreleaser https://www.reddit.com/r/golang/comments/udhml7/best_way_to_embed_version_info_into_binary/?rdt=40697

sidkhuntia commented 1 year ago

Sorry, it is taking me some time, as i have some tests coming up in my class. I will try my best to fix the issue, i need some time

yonahd commented 1 year ago

No rush

sidkhuntia commented 1 year ago

@yonahd I plan to update the .goreleaser.yml to add

builds:
  - id: OS
    ldflags:
      - -X github.com/yonahd/kor/pkg/utils.version={{.Version}}
snapshot:
  name_template: "{{ .Version }}"

that way I guess I can access the version from the git tag Does this look good?

I wanted to ask where should I print the version and the format of it ?

yonahd commented 1 year ago

@yonahd I plan to update the .goreleaser.yml to add

builds:
  - id: OS
    ldflags:
      - -X github.com/yonahd/kor/pkg/utils.version={{.Version}}
snapshot:
  name_template: "{{ .Version }}"

that way I guess I can access the version from the git tag Does this look good?

I wanted to ask where should I print the version and the format of it ?

I would need to test this. I want to add it in the utils just like the printing of the kor banner

sidkhuntia commented 1 year ago

image

is this formatting okay ?

yonahd commented 1 year ago

Perfect