0

How do I go about resolving an import cycle between github.com/golang/mock/gomock and golang.org/x/net/context? As far as I can tell this cycle exists internally between the two package and I can't modify either of them internally.

Currently these are my imports:

import (
    "testing"
    "github.com/golang/mock/gomock"
    "gopkg.in/mgo.v2" //mock
    "gopkg.in/mgo.v2/bson"
)

And this is the exact error message I am receiving when running withmock go test:

ERROR: Failed to install 'gopkg.in/mgo.v2': exit status 1
output:
import cycle not allowed
package gopkg.in/mgo.v2
    imports github.com/golang/mock/gomock
    imports golang.org/x/net/context
    imports github.com/golang/mock/gomock
  • Have you tried updating gomock and context? Because as far as I can tell, the current version of the x/net/context package does not import gomock. – Kaedys May 07 '18 at 21:08
  • 1
    Those import don't produce a cycle. Something is out of date on your system, or you've modified one of those packages. – JimB May 07 '18 at 21:08
  • I've tried running `go get -u github.com/golang/mock/gomock` and `go get -u github.com/golang/mock/gomock` and then `go install` on both packages. Still getting the same cycle issue though. – Arnav Sankaran May 07 '18 at 22:11
  • Interestingly grepping the `$GOPATH/src/golang.org/x/net/` folder for `gomock` finds no matches. – Arnav Sankaran May 07 '18 at 22:16
  • Do you have gomock or context vendored? – Kaedys May 08 '18 at 14:38

0 Answers0