google / gnostic

A compiler for APIs described by the OpenAPI Specification with plugins for code generation and other API support tasks.
Apache License 2.0
2.03k stars 241 forks source link

go get upgrade broke compilation #396

Open regnaio opened 1 year ago

regnaio commented 1 year ago

Updated packages using go get -u ./...

Then, I tried running a go file using go run <FILE>

Got the error message:

cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document

# k8s.io/client-go/applyconfigurations/meta/v1
/go/pkg/mod/k8s.io/client-go@v0.27.2/applyconfigurations/meta/v1/unstructured.go:64:38: cannot use doc (variable of type *"github.com/google/gnostic/openapiv2".Document) as *"github.com/google/gnostic-models/openapiv2".Document value in argument to proto.NewOpenAPIData
isaaguilar commented 1 year ago

Not sure if this will work for you, but I fixed it for myself by going to the client-go project and checking out the tag I was interested in. In your example, that would be v0.27.2. I then opened the go.mod file and found the k8s.io/kube-openapi version. https://github.com/kubernetes/client-go/blob/v0.27.2/go.mod#L30

I updated my go.mod to this version for k8s.io/kube-openapi.