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

go mod vendor: parsing go.mod: unexpected module path "gopkg.in/h2non/gock.v1" #50

Open
prologic opened this issue Apr 16, 2019 · 3 comments

Comments

@prologic
Copy link

commented Apr 16, 2019

I run into an error trying to run go mod vendor (we sadly are using Go11Modules + Vendoring at the moment):

$ go mod vendor
go: github.com/h2non/gock@v1.0.14: parsing go.mod: unexpected module path "gopkg.in/h2non/gock.v1"
go: error loading module requirements

Any ideas why go mod is complaining here?

@prologic

This comment has been minimized.

Copy link
Author

commented Apr 16, 2019

It seems to me that your module def in go.mod is what go mod doesn't like:

$ GOPROXY="" go get -u github.com/h2non/gock
go: github.com/h2non/gock@v1.0.14: parsing go.mod: unexpected module path "gopkg.in/h2non/gock.v1"
go get: error loading module requirements
@prologic

This comment has been minimized.

Copy link
Author

commented Apr 16, 2019

The work-around here is to use a replace in my go.mod:

$ git diff go.mod
diff --git a/go.mod b/go.mod
index 5b494df..67fad48 100644
--- a/go.mod
+++ b/go.mod
@@ -8,6 +8,7 @@ require (
        github.com/gogo/protobuf v1.2.0 // indirect
        github.com/google/uuid v1.1.0 // indirect
        github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 // indirect
+       github.com/h2non/gock v0.0.0-00010101000000-000000000000
        github.com/improbable-eng/go-httpwares v0.0.0-20190118142334-33c6690a604c
        github.com/inconshreveable/mousetrap v1.0.0 // indirect
        github.com/kataras/muxie v1.0.7
@@ -23,6 +24,9 @@ require (
        golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
        golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06 // indirect
        google.golang.org/grpc v1.17.0 // indirect
+       gopkg.in/h2non/gock.v1 v1.0.14 // indirect
        gopkg.in/src-d/go-git.v4 v4.9.1
        gopkg.in/yaml.v2 v2.2.2
 )
+
+replace github.com/h2non/gock => gopkg.in/h2non/gock.v1 v1.0.14

I found a similar work-around by searching around. Example: go-resty/resty#230

From doing some grep'ing around your codebase; it looks like you mix github.com/ and gopokg.in/ import paths for your own package -- I believe this is confusing go mod utterly. Can you fix this? :)

@mholt

This comment has been minimized.

Copy link

commented May 6, 2019

Seconding the request to have this fixed. :)

Thanks for the workaround, @prologic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.