Closed g5becks closed 5 years ago
Yep, I just stumbled across the same problem. This package is unusable with the go.mod file in it.
〖instagram-go〗go get github.com/ahmdrz/goinsta
go: finding github.com/ahmdrz/goinsta latest
go: github.com/ahmdrz/goinsta@v0.0.0-20181121053846-aa250bb4ac58: parsing go.mod: unexpected module path "github.com/ahmdrz/goinsta.v2"
go: error loading module requirements
Furthermore, the module file claims to be v2, but go get with v2 fails as well:
〖instagram-go〗go get github.com/ahmdrz/goinsta@v2
go get github.com/ahmdrz/goinsta@v2: no matching versions for query "v2"
To work around this issue, I fixed it in a temporary fork, you can do:
go get github.com/zaddok/goinsta@v3.0.1
And then alter your import to import:
"github.com/zaddok/goinsta/v3"
I won't maintain this fork, its just a workaround to use until this main repo gets fixed.
@zaddok still gettiing errors.
go: finding github.com/zaddok/goinsta v0.0.0-20190115003453-316a7ae6d418
go: github.com/zaddok/goinsta@v0.0.0-20190115003453-316a7ae6d418: go.mod has post-v0 module path "github.com/zaddok/goinsta/v3" at revision 316a7ae6d418
go: error loading module requirements
I worked out why, I fixed it, and tested it, and now this works:
〖tmp〗mkdir test5
〖tmp〗cd test5
〖test5〗go mod init test5
go: creating new go.mod: module test5
〖test5〗go get github.com/zaddok/goinsta/v4
Hopefully it can get fixed in the main branch soon. It turns out, when you do the tag, (i.e. git tag v3.0.0
you must already have updated and committed the go.mod
module name to contain the \v3
. If you tag first, and update go.mod second, the whole thing won't work.
@zaddok Great, I hope this gets fixed soon.
@ahmdrz any plans on fixing this? I can fix it and create a pull request if need be. Although it's only one line.
Hi @Gee5ive.
It's open for all of GitHub users to be a goinsta
contributor.
Let's make a PR and I will merge it.
The reason I didn’t do a patch request is because fixing the issue appears to require both an update to the go.mod and also fixing how the project is tagged. (That’s why I bumped the major version number in my fork)
I don’t think editing the go.mod alone will fix it, the patch here doesn’t bump from v2 to v3
@zaddok what's the reason the tag has to be updated? Just to test things out, I forked the repo and only updated the go.mod then ran go get github.com/Gee5ive/goinsta/v4 and it worked fine on my end without adding any tags.
In any case, I'm not going to open a request, as there's really no way for me to accurately test if it will work once the upstream is updated. I don't think a contributor should be the one to update anything having to do with versioning. Hopefully, @ahmdrz can get around to fixing this when there is time.
@Gee5ive Go modules require semver tags, see #203 and go modules documentation
@krylovsk Thanks, I learned something new today. Was'nt familiar with the replace directive.
Does everybody accept #203? I'm not familiar with .mod
file.
As you can see, I am still learning myself. I had to fix the .mod file, and add a semver tag to make it work. I assume if you do that it will work.
I suspect that the problem might be that you can’t start adding v2 into a project until you are using semver tags. (Once you add the v2, certain expectations are imposed)
(I bumped the major version to v3, I’m not sure if that was necessary though. I only did that as I was in a hurry to get it to work)
PS: aside from this particular issue your Instagram library is great. Thanks!
@ahmdrz any updates on merging ahmdrz/goinsta/#203 ?
I am attempting to download this package into a project that is a go module outside of GOPATH and I keep getting the following error,
if I download the package without it being part of a module there's no issues, any clue as to what's going wrong here?