Masterminds / Masterminds/semver

Regression in v3 or unexpected breaking behavior for NewConstraint(str)

Open
#143 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
1.4k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

I experienced a downstream issue in Helm v3 that worked well in Helm v2. This issue relates to a change of masterminds/semver v2 to v3.

The downstream issue is described here briefly, but it is really an upstream issue of masterminds/semver, and is reproducible in this Go Playground.

In short, the 001 variant of the following versions are now causing an issue for the NewConstraint() function.

	var version = ""
	version = "0.9.0-alpha.100" // OK
	version = "0.9.0-alpha.001" // ERROR
	var err error
	
	_, err = semver.NewConstraint(version)
	if err != nil {
		fmt.Println(err)
	} else {
        	fmt.Println("Everything is OK!")
	}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Go Playground example with masterminds/semver and compare NewConstraint("0.9.0-alpha.100") with NewConstraint("0.9.0-alpha.001"). Trace the constraint parsing and validation for numeric prerelease components; done means the 001 variant is handled consistently without regressing the working example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.