gh-extension-precompile icon indicating copy to clipboard operation
gh-extension-precompile copied to clipboard

Setting a version number with ldflags

Open chelnak opened this issue 3 years ago • 5 comments

Hey!

Would you consider using ldflags to allow developers to bake a version number in to the binaries?

https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications

It could be an optional parameter for the action coupled with some documentation.

I'd be happy to submit a PR if it's something you think could be useful.

chelnak avatar Jan 14 '22 22:01 chelnak

Here is a version of your bash script that I am using to achieve the above:

https://github.com/chelnak/gh-environments/blob/32d3ee6f12638a6f8ab5577ba89b838254abd0b7/build.sh

Resulting in a binary that has a version number

image

chelnak avatar Jan 15 '22 17:01 chelnak

@josebalius

MdAbulHossain1 avatar Jan 17 '22 03:01 MdAbulHossain1

@chelnak It's a solid proposal, but I'm thinking of a better solution to having each individual extension bake their version number in: since GitHub CLI knows the version number (or git SHA) of every extension installed, how about making a change to GitHub CLI so that gh <extension-command> --version just returns the installed version without ever consulting the extension executable itself?

mislav avatar Jun 08 '22 12:06 mislav

That could be really neat!

I'd actually forgotten about this PR and ended up using goreleaser for my extension.

I wonder what happens if the extension wants to check for version updates. It's handy having the current version within the context of the app for this purpose..

You could call back in to the main cli with the SDK I guess.. or even implement a helper method.

What do you think?

chelnak avatar Jun 08 '22 12:06 chelnak

Hey!

Would you consider using ldflags to allow developers to bake a version number in to the binaries?

https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications No i don't want to b apart of this I'm here cuz my psycho ex has stolen my identity and started all this stuff on github and I'm trying to remove everything cuz wat ever she did follows me from phone to phone and she's messing with my 7yr old daughter and steals from my family and i so please don't include me in that I'm trying to figure out how to get rid of all these tags and extensions

ghost avatar Oct 04 '22 17:10 ghost