6

I am following this tutorial.

I initialised my project and got the dependencies via

go mod init github.com/martin-helmich/kubernetes-crd-example
go get k8s.io/client-go@v0.17.0
go get k8s.io/apimachinery@v0.17.0

I have a Go file that uses import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1".

VS Code shows me could not import k8s.io/apimachinery/pkg/apis/meta/v1 (no required module provides package "k8s.io/apimachinery/pkg/apis/meta/v1"). What am I doing wrong here? Is my Go installation not correct?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
User12547645
  • 6,955
  • 3
  • 38
  • 69

1 Answers1

0

Check your Go module cache directory (usually located at $GOPATH/pkg/mod).
If the packages you've installed not found try this:

go get k8s.io/client-go@latest

go get k8s.io/apimachinery@latest

dom1
  • 425
  • 1
  • 2
  • 19