Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Problem downloading package into project using go modules #193

Closed
g5becks opened this issue Jan 14, 2019 · 14 comments · Fixed by #203
Closed

Problem downloading package into project using go modules #193

g5becks opened this issue Jan 14, 2019 · 14 comments · Fixed by #203

Comments

@g5becks
Copy link

g5becks commented Jan 14, 2019

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,

Fetching https://gopkg.in/ahmdrz/goinsta.v2?go-get=1
Parsing meta tags from https://gopkg.in/ahmdrz/goinsta.v2?go-get=1 (status code 200)
get "gopkg.in/ahmdrz/goinsta.v2": found meta tag get.metaImport{Prefix:"gopkg.in/ahmdrz/goinsta.v2", VCS:"git", RepoRoot:"https://gopkg.in/ahmdrz/goinsta.v2"} at https://gopkg.in/ahmdrz/goinsta.v2?go-get=1
go: finding gopkg.in/ahmdrz/goinsta.v2 latest
go: gopkg.in/ahmdrz/[email protected]: go.mod has non-....v2 module path "github.com/ahmdrz/goinsta" at revision 8a4b1078ad1b

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?

@zaddok
Copy link

zaddok commented Jan 14, 2019

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/[email protected]: 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"

@zaddok
Copy link

zaddok commented Jan 15, 2019

To work around this issue, I fixed it in a temporary fork, you can do:

go get github.com/zaddok/[email protected]
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.

@g5becks
Copy link
Author

g5becks commented Jan 15, 2019

@zaddok still gettiing errors.


go: finding github.com/zaddok/goinsta v0.0.0-20190115003453-316a7ae6d418
go: github.com/zaddok/[email protected]: go.mod has post-v0 module path "github.com/zaddok/goinsta/v3" at revision 316a7ae6d418
go: error loading module requirements

@zaddok
Copy link

zaddok commented Jan 15, 2019

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.

@g5becks
Copy link
Author

g5becks commented Jan 15, 2019

@zaddok
Great, I hope this gets fixed soon.

@g5becks
Copy link
Author

g5becks commented Jan 23, 2019

@ahmdrz any plans on fixing this? I can fix it and create a pull request if need be. Although it's only one line.

@ahmdrz
Copy link
Owner

ahmdrz commented Jan 23, 2019

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.

@zaddok
Copy link

zaddok commented Jan 23, 2019

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

@g5becks
Copy link
Author

g5becks commented Jan 23, 2019

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

@krylovsk
Copy link
Contributor

@Gee5ive Go modules require semver tags, see #203 and go modules documentation

@g5becks
Copy link
Author

g5becks commented Jan 26, 2019

@krylovsk Thanks, I learned something new today. Was'nt familiar with the replace directive.

@ahmdrz
Copy link
Owner

ahmdrz commented Jan 27, 2019

Does everybody accept #203? I'm not familiar with .mod file.

@zaddok
Copy link

zaddok commented Jan 27, 2019

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!

@g5becks
Copy link
Author

g5becks commented Feb 10, 2019

@ahmdrz any updates on merging ahmdrz/goinsta/#203 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants