Comments (8)
Yep you're absolutely, a old (bad) habit of me, which never got fixed.
I will work on that the next days,
thx for pointing that out
from semver.
This is still a little inconsistent because in many cases the arguments are still pointers even though (again, they are not mutated).
from semver.
Yep, you were faster than me.
I will check if those are api breaking
from semver.
You might also want to double-check any benchmarks you do to make sure there isn't a performance impact. Just a thought.
from semver.
I'm not quite sure if changing from pointers to value arguments helps anyone.
For example:
func (v Version) Compare(o Version) int
Would no longer work if the o
Version is constructed using New(..)
or Parse(..)
Which could be avoided by returning values instead of pointers, since we don't often modify the version, but then we could not return nil,err
in case of failure.
Any ideas?
from semver.
In my opinion, Parse should return a value, not a pointer and the API should generally use values. This is essentially just struct with a few values. I normally only use pointers when I want to have a receiver that gets mutated.
As for the "we could not return nil, err
" comment, that isn't really an issue. If you return a value (not a pointer), just return Version{}, err
. Does that answer your question?
from semver.
Yep i know, but i'm (still) not fully convinced of the benefits because this will break the public api.
Anyway, i've changed to values-only in the v2
branch, have a look at c8864c2
I think this looks good and benchmarks are ok.
Also have a look at the v2
branch adding sorting of version slices.
feat_v2
I will probably merge this in a couple of days.
from semver.
Implemented in v2
from semver.
Related Issues (20)
- Support `^x.x.x`? HOT 2
- range issue perhaps? HOT 1
- support `~>`? HOT 2
- Help maintaining this library HOT 5
- Wrong module name HOT 2
- Support tildes, carets, hyphens, wildcards, etc
- ParseTolerant now fails on a valid semver HOT 2
- Bin Release
- proposal: remove pre-release versions >1.0.0 increment constraint HOT 5
- finalize version feature HOT 2
- Cannot install using go modules HOT 6
- How to compare the pre-release version? HOT 2
- 1.0.0-rc1 is greater then 1.0.0-rc11 HOT 2
- 0.2.10 is greater than v0.11.0 HOT 5
- Confusing behavior of Range with version with release tag HOT 1
- Fork with ^1.0.0 (caret), ~1.0.0 (tilda), 2 - 4 (subtraction range?) without any regex
- ParseTolerant "1.15-alpine3.14" returns error HOT 1
- Major version constraint circumvented by prerelease versions
- Using x in prerelease causes error
- Constraint check fails for .0 patch prereleases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from semver.