question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optionally be able to work with leading 'v'

See original GitHub issue

Currently

semver.parse_version_info("v0.1.0")

fails with

ValueError: v0.1.0 is not valid SemVer string

However the leading v is not included in the semver spec (https://semver.org), but the master branch of semver/semver has the following faq section - https://github.com/semver/semver/blob/master/semver.md#is-v123-a-semantic-version :

Is “v1.2.3” a semantic version? No, “v1.2.3” is not a semantic version. However, prefixing a semantic version with a “v” is a common way (in English) to indicate it is a version number. Abbreviating “version” as “v” is often seen with version control. Example: git tag v1.2.3 -m “Release version 1.2.3”, in which case “v1.2.3” is a tag name and the semantic version is “1.2.3”.

The golang and go modules requires the leading v and almost every project relies with the convention (for example kubernetes/kubernetes, docker/docker and etc.).

Masterminds/semver (the golang equivalent of this project) can optionally work with a v prefix.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tomschrcommented, Jan 19, 2020

That issue looks very similar to #210 which I’ve done lately. We’ve come to the conclusion that we do not want to support a function which doesn’t adhere to the semver specification. That means, we avoid partial parsing of a version string.

However, to support our developers, we think to add some recommendations to our documentation is a good idea. As such, I’ve written a short section into our documentation (see PR #215: “Dealing with Invalid Versions”).

@scls19fr With that background, I think, we can close this issue, right?

1reaction
kxepalcommented, Aug 4, 2019

Why not just normalize version string (strip any v-like prefixes) before pass it to semver? This is quite simple operation and requires no changes for this project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cobra/user_guide.md at main · spf13/cobra - GitHub
To manually implement Cobra you need to create a bare main.go file and a rootCmd file. You will optionally provide additional commands as...
Read more >
meaning - "can optionally be" vs. "can be optionally"
1 Answer 1 · There is no indication in OP's question that "be" is an auxiliary verb. It might be a main verb....
Read more >
How to conditionally run Github workflow action only for tags ...
You will have to decide if you want to run the workflow only for tags and then filter out anything else than master:...
Read more >
Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called is ...
Read more >
Optional CLI Arguments - Typer - tiangolo
By using Optional your editor will be able to know that the value could be None , and will be able to warn...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found