Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error trying to use mod upgrade #3

Closed
msawangwan opened this issue Dec 11, 2018 · 28 comments
Closed

error trying to use mod upgrade #3

msawangwan opened this issue Dec 11, 2018 · 28 comments

Comments

@msawangwan
Copy link

hi.. @marwan-at-work i'm trying to use a library that hasn't yet adopted modules (dgrijalva/jwt-go). so i forked the repo, cloned it and per the usage examples ran:

    mod upgrade

from the repo root directory (after running go mod init of course, so go.mod exists ..). on doing so, i get this error:

<html><head></head><body><p><em>Error:</em> Your request has found no candidate provider [hs="(null)", id="(null)"]</p></body></html>

needless to say, i do not know how to fix this issue. any help appreciated, thanks.

@marwan-at-work
Copy link
Owner

@msawangwan thanks for opening the issue.

  1. The mod tool does not make any explicit network requests so this is definitely a weird error.
  2. I reproduced your steps (inside and outside GOPATH), and everything worked as expected. In fact, I've had an open PR for jwt-go for a while now: Migrate to Go Modules dgrijalva/jwt-go#288

Curious to know any more information you can give me that led to this error. Thanks!

@msawangwan
Copy link
Author

hi @marwan-at-work thanks for your reply. this must be user-error, as i get that same output (and no upgrade) when running mod upgrade in any directory, including the example directory in this project's repo.

any ideas? i did a go get for your tool under $GOPATH.. does this matter? and.. i'm on osx sierra if that makes any difference .. thanks.

@marwan-at-work
Copy link
Owner

@msawangwan the only dependency this command has is on golang.org/x/tools/go/package so maybe it's building with an incompatible version of it.

Can you try the following from outside of GOPATH:

git clone github.com/marwan-at-work/mod
cd ./mod/cmd/mod
GO111MODULE=on go install

Then try again (making sure you're using the just installed binary).

@msawangwan
Copy link
Author

OK so i did as you said but not sure where the binary is saved to -- didn't see one in the cloned github.com/marwan-at-work/mod. so i used the binary under $GOPATH/bin/mod and.. hurray, the error no longer appears. instead i get:

screen shot 2018-12-10 at 10 19 28 pm

am i using the correct binary? does the error in the screenshot mean anything that you can make sense of? thanks.

@msawangwan
Copy link
Author

actually.. that output isn't an error, is it? i see that the go.mod file in jwt-go shows the upgraded semvar... so.. it worked?

@marwan-at-work
Copy link
Owner

marwan-at-work commented Dec 11, 2018

@msawangwan hmm, yep so those logs are coming from the dependency I mentioned above. I believe a newer pseudo version suppresses those logs so it might be nice to update its version in my go.mod file.

And yes you are using the correct binary ($GOPATH/bin).

Lastly, this seems like the error is gone, were the paths properly upgraded in all the .go files to include v2?

PS. you can do mod upgrade -t=3 since jwt-go is actually in v3

@msawangwan
Copy link
Author

msawangwan commented Dec 11, 2018

OK so.. i spoke too soon. although the go.mod file has /v3 appended, none of the imports in any .go files in the project have it..

@msawangwan
Copy link
Author

msawangwan commented Dec 11, 2018

ah you know what.. i see the issue.

go.mod has this (points to fork):

module github.com/msawangwan/jwt-go/v3

but the imports still point to the original repo:

import  "github.com/dgrijalva/jwt-go"

so.. does this mean i would have to update all the imports by hand (by hand, i mean.. sed :) )? fortunately, there aren't that many. otherwise, i'd say your tool is working.

@marwan-at-work
Copy link
Owner

@msawangwan that's a good point, I can potentially add a mod fork command that replaces an import path with another. In other words, you'd change the import paths first with mod fork <new path> and then do mod upgrade -t=3

@msawangwan
Copy link
Author

@marwan-at-work if there isn't a tool for re-writing imports already, that would be pretty useful. if i had a few extra minutes, i wouldn't mind submitting a pr for it. regardless, thanks again for the help.

@marwan-at-work
Copy link
Owner

@msawangwan you're very welcome to, it shouldn't be difficult by looking at how upgrade works

@msawangwan
Copy link
Author

@marwan-at-work cool, i'll give it a look and let you know.

@msawangwan
Copy link
Author

hi @marwan-at-work i've created a branch and tried to submit a PR but got permission denied. how should i submit this?

@marwan-at-work
Copy link
Owner

@msawangwan you need to fork the repo and push the branch to your own fork

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

Hi @marwan-at-work - just FYI, I'm seeing this on https://github.com/google/go-github too, attempting to upgrade from v19 to v20:

$ mod upgrade
<html><head></head><body><p><em>Error:</em> Your request has found no candidate provider [hs="(null)", id="(null)"]</p></body></html>

No big deal, I'll just update manually... Just wanted to let you know since you have contributed to this repo and it can make a cool and easy test case for you. 😄

@marwan-at-work
Copy link
Owner

@gmlewis make sure you build this tool with GO111MODULE=on

@marwan-at-work
Copy link
Owner

I've added a comment to include this flag in the readme, closing this issue. But please let me know if the issue still persisted after building with the correct flag.

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

Hmmm... I had originally installed this command without GO111MODULE being set at all, using: go get -u github.com/marwan-at-work/mod/cmd/mod.

So now, I just tried this:

$ pushd ~/go/src/github.com/marwan-at-work/mod/cmd/mod
$ export GO111MODULE=on
$ go install
go: finding github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135
go: finding github.com/marwan-at-work/vgop v0.0.0-20180824202541-054e5a7d7b48
go: finding github.com/PuerkitoBio/goquery v1.4.1
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/andybalholm/cascadia v1.0.0
go: finding golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1
go: finding gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
go: finding golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01
go: downloading gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
go: downloading github.com/marwan-at-work/vgop v0.0.0-20180824202541-054e5a7d7b48
go: downloading github.com/pkg/errors v0.8.0
go: downloading golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1
go: downloading github.com/PuerkitoBio/goquery v1.4.1
go: downloading github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135
go: downloading github.com/andybalholm/cascadia v1.0.0
$ pushd ~/go/src/github.com/google/go-github
$ git checkout -b v21-experiment
$ mod upgrade
<html><head></head><body><p><em>Error:</em> Your request has found no candidate provider [hs="(null)", id="(null)"]</p></body></html>

Am I doing something wrong?

@marwan-at-work
Copy link
Owner

@gmlewis super weird...I can't seem to reproduce this issue. I tried to do the same thing:

marwan-sulaiman:go-github 208581$ pushd ~/go/src/github.com/marwan-at-work/mod/cmd/mod
~/go/src/github.com/marwan-at-work/mod/cmd/mod ~/go/src/github.com/google/go-github
marwan-sulaiman:mod 208581$ export GO111MODULE=on
marwan-sulaiman:mod 208581$ go install
go: finding github.com/andybalholm/cascadia v1.0.0
go: finding github.com/marwan-at-work/vgop v0.0.0-20180824202541-054e5a7d7b48
go: finding golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1
go: finding github.com/PuerkitoBio/goquery v1.4.1
go: finding gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
go: finding golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01
go: downloading gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
go: downloading golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1
go: downloading github.com/marwan-at-work/vgop v0.0.0-20180824202541-054e5a7d7b48
go: downloading github.com/PuerkitoBio/goquery v1.4.1
go: downloading github.com/andybalholm/cascadia v1.0.0
marwan-sulaiman:mod 208581$ pushd ~/go/src/github.com/google/go-github
~/go/src/github.com/google/go-github ~/go/src/github.com/marwan-at-work/mod/cmd/mod ~/go/src/github.com/google/go-github
marwan-sulaiman:go-github 208581$ git stash
Saved working directory and index state WIP on v21-experiment: 4076fd7 IssueEvents: Support Project Card fields (#1066)
marwan-sulaiman:go-github 208581$ mod upgrade
marwan-sulaiman:go-github 208581$ git status
On branch v21-experiment
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   example/appengine/app.go
	modified:   example/basicauth/main.go
	modified:   example/commitpr/main.go
	modified:   example/migrations/main.go
	modified:   example/newrepo/main.go
	modified:   example/simple/main.go
	modified:   github/examples_test.go
	modified:   go.mod
	modified:   test/fields/fields.go

no changes added to commit (use "git add" and/or "git commit -a")

What OS are you using and what version of Go do you have installed?

This is most likely an issue with go/packages and so it'd be a good edge case to catch. Thanks!

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

This laptop is MacOS High Sierra 10.13.6.
go version go1.11.2 darwin/amd64

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

Just now, I blew away mod:

$ rm -rf ~/go/src/github.com/marwan-at-work
$ sudo rm `which mod`

Then tried to install from scratch:

$ cd
$ GO111MODULE=on go get github.com/marwan-at-work/mod/cmd/mod
go: cannot find main module; see 'go help modules'

@marwan-at-work
Copy link
Owner

@gmlewis yes this is a modules draw back, make sure you have a dummy go.mod file in your CWD (or just git clone github.com/marwan-at-work/mod and run go install from inside of it)

@marwan-at-work
Copy link
Owner

marwan-at-work commented Dec 13, 2018

@gmlewis let me know if blowing things away fixes things, if so i'll add a comment in the readme. Thanks! Reopening the issue, since my previous assumption is incorrect.

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

Still no joy... here is a continuation from last time:

$ cd
$ GO111MODULE=on go get github.com/marwan-at-work/mod/cmd/mod
go: cannot find main module; see 'go help modules'
$ touch go.mod
$ GO111MODULE=on go get github.com/marwan-at-work/mod/cmd/mod
go: cannot determine module path for source directory /Users/gmlewis (outside GOPATH, no import comments)
$ cat > go.mod
module github.com/marwan-at-work/mod

require (
	github.com/PuerkitoBio/goquery v1.4.1
	github.com/andybalholm/cascadia v1.0.0 // indirect
	github.com/google/go-github v17.0.0+incompatible
	github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect
	github.com/marwan-at-work/vgop v0.0.0-20180824202541-054e5a7d7b48
	github.com/pkg/errors v0.8.0
	golang.org/x/net v0.0.0-20180826012351-8a410e7b638d // indirect
	golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
	golang.org/x/tools v0.0.0-20180824175216-6c1c5e93cdc1
	gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
)
$ GO111MODULE=on go get github.com/marwan-at-work/mod/cmd/mod
go: finding github.com/marwan-at-work/mod/cmd/mod latest
go: finding github.com/marwan-at-work/mod/cmd latest
go get github.com/marwan-at-work/mod/cmd/mod: no matching versions for query "latest"
$ ls -lrt
total 2328
...
-rw-r-----   1 gmlewis  gmlewis      604 Dec 12 22:16 go.mod
-rw-r-----   1 gmlewis  gmlewis     1165 Dec 12 22:16 go.sum

I'll try cloning the repo and install from there...

@gmlewis
Copy link

gmlewis commented Dec 13, 2018

OK, that worked, but here is a weird MacOS thing going on, I think:

$ git clone git@github.com:marwan-at-work/mod
$ cd mod/cmd/mod
$ echo $GO111MODULE
on
$ go install
$ which mod
/Users/gmlewis/go/bin/mod
$ cd ~/go/src/github.com/google/go-github
$ mod upgrade
-bash: /Library/Frameworks/Mono.framework/Versions/Current/Commands/mod: No such file or directory
$ ~/go/bin/mod upgrade

Mono.framework?!? Maybe this is an iTerm2 thing. Yep, sure enough if I exit iTerm2 and start a new one, that problem goes away. So it looks like I'm up and running again.

Thank you, @marwan-at-work!

@msawangwan
Copy link
Author

interesting.. i was also having the issue when using iterm2 ..

@marwan-at-work
Copy link
Owner

A little late, but I just updated the README to make notice of this issue and the solution. Thanks again for digging into it!

@johanbrandhorst
Copy link

johanbrandhorst commented Apr 18, 2020

Nevermind this was the wrong mod.

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

No branches or pull requests

4 participants