ahmdrz / goinsta

Unofficial Instagram API written in Golang
MIT License
895 stars 247 forks source link

Project not working with 1.13 go mod vendoring #284

Open dmitridb opened 4 years ago

dmitridb commented 4 years ago

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[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.84. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

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

dmitridb commented 4 years ago

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...

https://github.com/ahmdrz/goinsta/compare/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

dmitridb commented 4 years ago

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 https://github.com/go-resty/resty/commit/7bc61b57f701233c7899000753b3f5f0de618b9f

dmitridb commented 4 years ago

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 4 years ago

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