ahmdrz/goinsta

Project not working with 1.13 go mod vendoring

dmitridb opened this issue ยท 5 comments

Well this is a headache

Not only is the versioning scheme of vX.Y.Z not present but the /v2 and the end of the package definition in go.mod for this project busts things when I try and get it vendored.

go mod tidy:
cannot load github.com/ahmdrz/goinsta: no matching versions for query "latest"

changing my own project's go.mod to either master or 2.4.5:
require github.com/ahmdrz/goinsta: version "v0.0.0-20191029070115-ecf8c88f7a1f" invalid: go.mod has post-v0 module path "github.com/ahmdrz/goinsta/v2" at revision ecf8c88f7a1f

What version of go is everyone here compiling with? Is there some kind of trick to get around this old versioning hack and working in the latest version of go that I don't know about which doesn't involve me forking the project and fixing things myself for proper vendoring in the interim?

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.84. Please mark this comment with ๐Ÿ‘ or ๐Ÿ‘Ž to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

OK, check it out, these are the steps I took in my fork to get this working. Other examples of people migrating from gopkg.in to the new 1.13 go mod noted these were breaking changes and bumped up a major version, so I don't really know if a pull request would be appropriate because the steps require doing a few things...

master...dmitridb:master

So basically I had to specify v3 in the imports, afterwards pushing a tag to my forked repo, and then I was able to properly pull it into my own project and go mod vendor in goinsta from my own repo...

Other reason for not submitting a pull request is that I did this kind of messy in my commit history as I figured out what needed to be done, plus it seems like you got a couple of other features like that video upload I would suppose you would like to merge in before a major version update. If help is needed there too I may be able to pull some time in

I think this is how it is done step by step, I may be wrong but anyways:

  1. change import tags in all .go files to point to repo. Maybe a properly version tagged commit here is necessary I am not 100% sure
  2. old go.mod is useless, delete
  3. go mod init github.com/ahmdrz/goinsta/v3
  4. go mod tidy
  5. commit this, push with proper v3.0.0 tag remebering that the v is necessary in new go mod versioning scheme (i only did up to v3.0.1 cause I was messing around trying to get it to work)

I roughly based this off of what they seemed to do over at this repo go-resty/resty@7bc61b5

Might want to start properly vendoring dependencies to specific stable releases as well and of course fixing the README.md to remove gopkg.in references

kmlx commented

i had no problems with both go.mod this repo or go.mod a fork.

here's how i did it:
go mod this repo:

go.mod
require (
github.com/ahmdrz/goinsta/v2 v2.4.5-0.20191021103459-79702a8f3eda
)

fork:

go.mod
require (
github.com/ahmdrz/goinsta/v2 v2.4.5-0.20191021103459-79702a8f3eda
)
replace github.com/ahmdrz/goinsta/v2 => github.com/kmlx/goinsta/v2 v2.4.5-0.20191120123926-a0b984144034