<p>I'm new to go and playing with k8s go-client. I'd like to pass items from <code>deploymentsClient.List(metav1.ListOptions{})</code> to a funcion. <code>fmt.Printf("%T\n", deploy)</code> says it's type <code>v1.Deployment</code>. So I write a function that takes <code>(deploy *v1.Deployment)</code> and pass it <code>&amp;deploy</code> where deploy is an item in the <code>deploymentsClient.List</code>. This errors with <code>cmd/list.go:136:38: undefined: v1</code> however. What am I doing wrong?</p>

<p>Here are my imports</p>

<pre><code>import (
    //  "encoding/json"
    "flag"
    "fmt"
    //yaml "github.com/ghodss/yaml"
    "github.com/spf13/cobra"
    // "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"
    "os"
    "path/filepath"
)
</code></pre>

<p>Then I get the list of deployments:</p>

<pre><code>    deploymentsClient := clientset.AppsV1().Deployments(ns)
    deployments, err := deploymentsClient.List(metav1.ListOptions{})
    if err != nil {
        panic(err.Error())
    }
    for _, deploy := range deployments.Items {
        fmt.Println(deploy.ObjectMeta.SelfLink)
        //      printDeploymentSpecJson(deploy)
        //      printDeploymentSpecYaml(deploy)

    }
</code></pre>

user1855481
<p>You need to import "k8s.io/api/apps/v1", Deployment is defined in the package. See <a href="https://godoc.org/k8s.io/api/apps/v1" rel="nofollow noreferrer">https://godoc.org/k8s.io/api/apps/v1</a>.</p>
