mattn/go-colorable

cannot find module providing package gopkg.in/mattn/go-colorable.v0

Amit-PivotalLabs opened this issue · 4 comments

I've used Kubebuilder to generate a bunch of code for a Kubernetes custom resource controller. I'd like my custom resource controller to manage BOSH releases so I've got code similar to this to construct a BOSH Director client to pass to my reconciliation controller so it can use it to manage BOSH releases. After adding this code to some of the Kubebuilder-generated code, and running make generate from the Kubebuilder-generated Makefile, it fails when I run go fmt ./....

$ go fmt ./...
go: downloading gopkg.in/mattn/go-colorable.v0 v0.1.2
go: downloading gopkg.in/mattn/go-isatty.v0 v0.0.8
build github.com/amitkgupta/boshv3: cannot load gopkg.in/mattn/go-colorable.v0: cannot find module providing package gopkg.in/mattn/go-colorable.v0

I'm not importing go-colorable directly anywhere in my code, my guess is some of the packages from github.com/cloudfoundry/bosh-cli that I'm importing have some recursive dependency on go-colorable, so I don't think I can solve this by modifying any import paths in my own code.

Any pointers on how I might troubleshoot this? I saw #35 but none of the ideas there seemed to help.

mattn commented

If you want to fix this, please do NOT use gopkg.in.

Thanks @mattn. I don't believe I'm using gopkg.in explicitly in anything I'm importing directly, but some transitive import dependency of my code may be doing so. When you say "do NOT use gopkg.in" would I need to change the import paths in some of these upstream dependencies, or is there something you think I can do that's more in my control (e.g. messing with my go.mod file in some way)?

mattn commented

or is there something you think I can do that's more in my control (e.g. messing with my go.mod file in some way)?

Yes, or specify commit with the package name. See golang/go#30636

Thanks, I addressed this by moving my repo somewhere under $GOPATH/src/github.com and deleting the go.mod files.