Git Product home page Git Product logo

go-semver's People

Contributors

amerine avatar andyxning avatar bgilbert avatar coreosbot avatar crawford avatar dghubble avatar dthadi3 avatar ericchiang avatar gepoch avatar jonboulle avatar kyleconroy avatar marineam avatar miabbott avatar philips avatar r0mant avatar sofuture avatar sohankunkerkar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-semver's Issues

Comparing backwards compatible versions?

Thanks for the awesome library! One thing I noticed that's probably intentional is that Version.Equals returns false if the patch and minor versions are different but major is equal.

Equals might be the wrong method since it might imply strict equality, but maybe there should be another method that compares versions more closely to the semver spec? The first thing that came to mind is BackwardsCompatible or maybe Compatible if that's too wordy.

Thanks for your time!

Can't unmarshall from yaml

As you implemented Unmashler interface, but didn't implement Marshler interface for yaml.
So it's impossible to unmarshal it from yaml as it would fail with error: cannot unmarshal !!map into string

the solution would be to add

func (v Version) MarshalYAML() (interface{}, error) {
	return v.String(), nil
}

Unit test data looks wrong

In unit test TestBumpMajor (and in other places), the test data being used in Line 178 is:

1.0.0+build.1-alpha.1

Prerelease should come first and must have a prefix of -
Metadata should come in the end and must have a prefix of +.
This test data is the other way around.

Let's see what happens when we use this test data in an example:

package main

import "fmt"
import "github.com/coreos/go-semver/semver"

func main() {
    v := semver.New("1.0.0+build.1-alpha.1")
    fmt.Printf("PreRelease: %s\n", v.PreRelease)
    fmt.Printf("Metadata: %s\n", v.Metadata)
}

And the output is:

PreRelease: 
Metadata: build.1-alpha.1

Therefore the testing in Line 180 is not really effective, considering that PreRelease was "" to begin with.

I propose that the test data be changed to:

1.0.0-alpha.1+build.1

If you agree, let me know and I will work on a pull request.

does not seem to pre-release version for semver 2.0.0

Please see:

https://semver.org/

Steps to reproduce:

func TestSemVer(t *testing.T) {
	actual, err := semver.NewVersion("17.06.0-ce")
	if err != nil {
		t.Fatal(err.Error())
	}

	wanted, err := semver.NewVersion("17.06.0")
	if err != nil {
		t.Fatal(err.Error())
	}

	if actual.Compare(*wanted) < 0 {
		t.Fatal("not good")
	}
}

make LessThan, Equal and Compare accept a pointer type

For usability, it would be nice if one could pass a *semver.Version to LessThan(), Equal(), and Compare(). Is there something preventing this? And why are those methods defined on a value receiver instead of a pointer receiver?

tag versions/releases

We are importing this into rkt, hence it would be nice/important to have released versions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.