decimal
decimal copied to clipboard
Update to use Go Modules semver suffix /v4
I came across this issue when trying to update my own project that uses decimal. I was getting this error when trying to run go get -u:
$ go get -u github.com/ericlagergren/decimal
go: finding github.com/ericlagergren/decimal v3.3.1
go: errors parsing go.mod:
/blah/blah/blah/go.mod:7: require github.com/ericlagergren/decimal: version "v3.3.1" invalid: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3
I went spelunking through the issue tracker and came across this comment, which makes sense to me as a strategy based on my own (possibly limited) understanding of the rather expansive list of caveats and processes for dealing with Go Modules. I'm not completely sure I've done it right, but it's consistent with some of the example repos I looked at that use the /v<n> suffix.
It seems to work if I use the following replace directive in my project, then point my go.mod to v4.0.0:
replace github.com/ericlagergren/decimal/v4 => github.com/shabbyrobe/decimal/v4 v4.0.0
All the -short tests pass; I didn't wait around for the exhaustive float32 one but I'm happy to let it run if it's necessary. The repo will need to be tagged v4.0.0 if you decide to merge it in order to work (I think).
Hm. Yes, this needs to be fixed. I've been meaning to cut a new release for a while, but I want to fix some of the formatting code first.
I'll re-read the module spec to make sure everything's kosher then get back to this. So far my use of modules has been with v0.X.Y only, so I haven't had to use suffixes yet.
hey, is there any progress or when will this issue fixed? Its pritty shit if you have to switch to the old days again to use this lib. Modules should today work...
@dexus totally understand. I’ve been meaning to finish the formatting PR, which fixes some minor bugs. Then I’m going to merge this and cut a new release.
Even with the occasional PR (thanks @shabbyrobe!) it’s still a one man show and so I’m limited by my free time. Hope you understand!
Ooh, I've just noticed there's some conflicts to resolve. I can dive in and rebase this weekend; is there anything else you'd like me to do to this PR while I've got the hood open?
I've rebased off master. Ran into a bit of trouble with Travis as it was set up to test with Go 1.11 and 1.12, but go.mod has been updated to 1.13 so I nudged it along and the tests seem to pass. My laptop is too slow to run the full suite (times out after 10 mins), so I'll try to run them on my desktop at work and report back.
I guess this PR's a bit long in the tooth... wouldn't be too hard to do it again from current master, but I suspect it'd be more trouble than it was worth to rebase this one.