hack: fix v-prefixing in pseudo-version tool

pre-release versions and release versions behaved differently.
This lead to a duplicate v prefix in the cli's version.
This commit is contained in:
Otto Bittner 2023-04-27 18:35:29 +02:00
parent e72fb954f1
commit caa0732955
5 changed files with 12 additions and 6 deletions

View file

@ -95,9 +95,15 @@ func main() {
default:
if !strings.Contains(*base, "pre") {
// "v2.7.0" inside the version.txt will lead to "v2.7.0" as version
fmt.Println(*base)
// "2.7.0" inside the version.txt will lead to "2.7.0" as version
if *skipV {
fmt.Println(strings.TrimPrefix(*base, "v"))
} else {
fmt.Println(*base)
}
} else {
// "2.7.0-pre" inside the version.txt will lead to "v2.7.0-pre.0.20230313121936-bab76e8a9acf" as version
// "v2.7.0-pre" inside the version.txt will lead to "v2.7.0-pre.0.20230313121936-bab76e8a9acf" as version
// "2.7.0-pre" inside the version.txt will lead to "v0.0.0-20230313121936-bab76e8a9acf" as version
fmt.Println(version)
}
}