Giter Site home page Giter Site logo

mark-kubacki / semver Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 4.0 241 KB

:100: parse semantic version numbers, and ranges (the most often imitated original)

License: BSD 3-Clause "New" or "Revised" License

Go 90.52% Assembly 9.48%
constraints go golang range semantic-versioning semantic-versions semver zero-alloc

semver's People

Contributors

alvinsay avatar ewilazarus avatar mark-kubacki avatar mholt 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

Watchers

 avatar  avatar  avatar

semver's Issues

sort: change byte order for Big-endian

The radix sort variants need a byte-swapping to work on Big-endian architectures such as mips mips64 ppc64 s390x. (This is indicated by runtime/internal/sys.BigEndian, but don't use that value; use GOARCH build flags.)

Without one the sorting will work, and iterate as usual through fields, but within fields go from the most to least significant digit (byte). Adjustment values for negative fields will be off, though, as those are encoded in uint64.


For my notes: https://github.com/tensorflow/tensorflow/blob/0fec909abb8057fcb6141769df17bcad729ca870/tensorflow/go/tensor.go#L493-L510

Given a version, list possible next versions?

Thanks for this lib, Mark. I'm wondering if you'd entertain a discussion (even a brief one) about the possibility of a function that takes as input a semantic version and returns a list of (reasonable) possible next versions.

In other words, given this:

"v1.0.0"

The function might return:

[]string{"v1.0.1", "v1.1.0", "v2.0.0"}

And (optionally?) some pre-release "next" versions as well. I'm using this to prompt a user what to tag a commit as.

Would this function have a place in your lib?

Export "version fields" accessors

It would be great if you could access a "version field" such as

v := semver.NewVersion("1.0.0")
fmt.Println(v.Major)
fmt.Println(v.Minor)
fmt.Println(v.Patch)

Can NewVersion() return a *Version?

I am wondering if you'd welcome a pull request to have NewVersion() return a *Version instead of a Version, mostly because all the methods are implemented with pointer receivers, so I can't easily make a NewVersion() and then call methods on them; I have to reference them every time, or re-assign the variable.

Currently:

current, err := semver.NewVersion("1.2.3")
fmt.Printf("%s\n", current) // formatting error
fmt.Printf("%s\n" &current) // works

Not a big deal, but could make my use of the returned value a little simpler in actual code, where I have to constantly reference it or re-assign the variable. It's also possible that I'm misusing the lib, just let me know if that's the case!

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.