Symptom:
When we build a go program, we hit such error:k8s.io/client-go/rest/request.go:598:31: not enough arguments in call to watch.NewStreamWatcher have (*versioned.Decoder) want (watch.Decoder, watch.Reporter)
It appears there are updates on the request.go which have new requirements
See details of changes log on apimachinary
Solution:
We need to avoid to use the latest master branch of the client-go. Instead we can use stable version of client-go. Fortunately go-modules addresses these problemssee github go-modules
So here are the steps to fix it
- $ export GO111MODULE=on
- In your project location, run : go mod init ---- create go.mod file
- Go build cmd/test.go --- go mod will fetch related files which replace dep ensure
- You will still see the error, that's ok , next step we fix it
- Edit go.mod and replace client-go with correct version
- In this case we use : k8s.io/client-go v0.0.0-20190425172711-65184652c889
- Go build cmd/test.go ---error would be gone
No comments:
Post a Comment