Getting compilation error when try to use kubernetes/fake from "production" code. however when create test and use fake from there only then everything is good and test compilation is not failing.
compilation error:
cmd\test\test.go:3:8: cannot find package
project structure
awesomeProject
│ go.mod
│ go.sum
└───cmd
└───test
test.go
here is test.go
package main
import "k8s.io/client-go/kubernetes/fake"
func main() {
clientset := fake.NewSimpleClientset()
print(clientset)
}
here is go.mod (updated to have same version of api + goclient)
module awesomeProject
go 1.14
require (
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/golang/protobuf v1.4.0 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a // indirect
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
k8s.io/api v0.18.2 // indirect
k8s.io/client-go v0.18.2 // indirect
k8s.io/utils v0.0.0-20200414100711-2df71ebbae66 // indirect
)
This question is coming from need to move kubernetes/fake related code to separate package from test code.