Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Strip leading 'v' from git tags if present. #221

Merged
merged 1 commit into from
May 14, 2020

Conversation

wadells
Copy link
Contributor

@wadells wadells commented May 13, 2020

As discussed at:

golang/go#32945
https://semver.org/#is-v123-a-semantic-version

Go and semver disagree about handling of a leading 'v' on version
strings. This patch allows robotest to play nicely with both.

I discovered this when I created the v2.0.0-alpha.1 tag in git.

Contributes to #200.

Testing Done

Before:

walt@work:~/git/robotest$ git describe --tags
v2.0.0-alpha.1
walt@work:~/git/robotest$ make version       
version metadata saved to version.go
Robotest Version: v2.0.0-alpha.1

After:

walt@work:~/git/robotest$ git describe --tags        
v2.0.0-alpha.1-1-g4ac1444
walt@work:~/git/robotest$ make version       
version metadata saved to version.go
Robotest Version: 2.0.0-alpha.1.1+4ac14441

With a non-v-prefixed tag:

walt@work:~/git/robotest$ git tag 3.fake.version
walt@work:~/git/robotest$ make version
version metadata saved to version.go
Robotest Version: 3.fake.version
walt@work:~/git/robotest$ git tag -d 3.fake.version 
Deleted tag '3.fake.version' (was 4ac1444)

@wadells wadells requested a review from a-palchikov May 13, 2020 17:20
version.sh Show resolved Hide resolved
As discussed at:

  golang/go#32945
  https://semver.org/#is-v123-a-semantic-version

Go and semver disagree about handling of a leading 'v' on version
strings.  This patch allows robotest to play nicely with both.

Contributes to gravitational#200.
@wadells wadells merged commit 9ccc9fe into gravitational:master May 14, 2020
@wadells wadells added this to Done in Robotest May 26, 2020
@wadells wadells moved this from Done to 2.0 in Robotest May 26, 2020
@wadells wadells deleted the go-semver-fix branch June 4, 2020 03:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants