<p>I want to run the Go K8S client library and conect to the cluster with kubeconfig which is locally defined on my 
mac under <code>/Users/i0334456/.kube/config</code></p>

<p>The error is: </p>

<pre><code># k8s-go-client/vendor/k8s.io/client-go/rest
vendor/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)
</code></pre>

<p>This is the program which I try to use</p>

<pre><code>package main

import (
   "flag"
   "fmt"
   "os"
   "path/filepath"
   "time"

   "k8s.io/apimachinery/pkg/api/errors"
   metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
   "k8s.io/client-go/kubernetes"
   "k8s.io/client-go/tools/clientcmd"

)

func main() {
   var kubeconfig *string
   if home := homeDir(); home != "" {
      kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
   } else {
      kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
   }
   flag.Parse()

   // use the current context in kubeconfig
   config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
   if err != nil {
      panic(err.Error())
   }

   // create the clientset
   clientset, err := kubernetes.NewForConfig(config)
   if err != nil {
      panic(err.Error())
   }
   for {
      pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{})
      if err != nil {
         panic(err.Error())
      }
      fmt.Printf("There are %d pods in the cluster\n", len(pods.Items))

      // Examples for error handling:
      // - Use helper functions like e.g. errors.IsNotFound()
      // - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message
      namespace := "default"
      pod := "example-xxxxx"
      _, err = clientset.CoreV1().Pods(namespace).Get(pod, metav1.GetOptions{})
      if errors.IsNotFound(err) {
         fmt.Printf("Pod %s in namespace %s not found\n", pod, namespace)
      } else if statusError, isStatus := err.(*errors.StatusError); isStatus {
         fmt.Printf("Error getting pod %s in namespace %s: %v\n",
            pod, namespace, statusError.ErrStatus.Message)
      } else if err != nil {
         panic(err.Error())
      } else {
         fmt.Printf("Found pod %s in namespace %s\n", pod, namespace)
      }

      time.Sleep(10 * time.Second)
   }
}

func homeDir() string {
   if h := os.Getenv("HOME"); h != "" {
      return h
   }
   return os.Getenv("USERPROFILE") // windows
}

</code></pre>

<p>I was tried to provide my path as <code>arguments</code> on Goland IDE 
like <code>/Users/i0334456/.kube/config</code> without success, what am I missing here ?</p>

<p>I want to access via the Go client for K8S to the cluster via API's</p>

<p>if I can use the path explicit in the code this is good either...</p>

Jenny M
<p>make sure you ran through the dependency installation steps as described here: <a href="https://github.com/kubernetes/client-go/blob/master/INSTALL.md#go-modules" rel="nofollow noreferrer">https://github.com/kubernetes/client-go/blob/master/INSTALL.md#go-modules</a>
That solved this problem for me.</p>

<p>Also mentioned in <a href="https://github.com/kubernetes/client-go/issues/584" rel="nofollow noreferrer">https://github.com/kubernetes/client-go/issues/584</a></p>
