Home > Blockchain >  Find the Pseudo-version of the current, main module
Find the Pseudo-version of the current, main module

Time:10-03

I have a Go codegen tool and while building it as a binary I want to inject it's own current Pseudo-version for it's main module at build time using Go the tools.

I know that for dependencies, I can find their pseudo-version using go list -m all or go list -m -f '{{ .Version }}' $MODULE. The version for the main module is listed as empty.

I know that I can probably calculate the current pseudo version with:

git describe --tags `git rev-list --tags --max-count=1`

and:

TZ=UTC git --no-pager show \
   --quiet \
   --abbrev=12 \
   --date='format-local:%Y%m%d%H%M%S' \
   --format="           
  • Related