jstemmer / go-junit-report

Convert Go test output to JUnit XML
MIT License
776 stars 224 forks source link

`-version` info is "not as useful" as it may should've been #154

Open stdedos opened 1 year ago

stdedos commented 1 year ago

Version in the tagged version: https://github.com/jstemmer/go-junit-report/blob/7fde4641acef5b92f397a8baf8309d1a45d608cc/main.go#L14-L18

Version @https://github.com/jstemmer/go-junit-report/blob/master as of now: https://github.com/jstemmer/go-junit-report/blob/e939e4f1208c5433ce0aed4cec28d84bbdbcda8d/main.go#L18-L22

May I suggest something along the lines of:

//go:generate sh -c "git describe --tags --first-parent --abbrev=0 > commit.txt"
//go:embed commit.txt

for "rolling" builds, and "hardcoded" changes on tagged commits

joschi commented 3 months ago

This is not an issue in the compiled binary.

# https://github.com/jstemmer/go-junit-report/releases/tag/v2.0.0
❯ tar xfzv go-junit-report-v2.0.0-darwin-amd64.tar.gz 
x go-junit-report
❯ ./go-junit-report -version
go-junit-report v2.0.0 2022-07-01T22:11:51 (7fde4641acef5b92f397a8baf8309d1a45d608cc)

# https://github.com/jstemmer/go-junit-report/releases/tag/v2.1.0
❯ tar xfzv go-junit-report-v2.1.0-darwin-arm64.tar.gz
x go-junit-report
❯ ./go-junit-report -version
go-junit-report v2.1.0 2023-10-18T23:51:04 (14d61e6e75e3f3c74551d757ad936e8e88014464)

See also: https://github.com/jstemmer/go-junit-report/blob/85bf4716ac1f025f2925510a9f5e9f5bb347c009/Makefile#L1-L3