<p>Im trying to list all the build configs in openshift with help of openshift/client-go</p>
<pre><code>
import (
    &quot;context&quot;
    &quot;flag&quot;
    &quot;fmt&quot;
    &quot;os&quot;
    &quot;path/filepath&quot;

    metav1 &quot;k8s.io/apimachinery/pkg/apis/meta/v1&quot;
    &quot;k8s.io/client-go/tools/clientcmd&quot;

    buildv1 &quot;github.com/openshift/client-go/build/clientset/versioned/typed/build/v1&quot;
)

func main() {
    err := start()
    if err != nil {
        fmt.Fprintf(os.Stderr, &quot;error: %v&quot;, err)
        os.Exit(1)
    }
}

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

    // use the current context in kubeconfig
    config, err := clientcmd.BuildConfigFromFlags(&quot;&quot;, *kubeconfig)
    if err != nil {
        return err
    }

    buildV1Client, err := buildv1.NewForConfig(config)
    if err != nil {
        return err
    }

    namespace := &quot;testproject&quot;
    // get all builds
    builds, err := buildV1Client.Builds(namespace).List(context.TODO(), metav1.ListOptions{})
    if err != nil {
        return err
    }
    fmt.Printf(&quot;There are %d builds in project %s\n&quot;, len(builds.Items), namespace)
    // List names of all builds
    for i, build := range builds.Items {
        fmt.Printf(&quot;index %d: Name of the build: %s&quot;, i, build.Name)
    }
    return nil
}

func homeDir() string {
    if h := os.Getenv(&quot;HOME&quot;); h != &quot;&quot; {
        return h
    }
    return os.Getenv(&quot;USERPROFILE&quot;) // windows
}
</code></pre>
<p>I have got all the dependencies via glide. glide.yaml <code>glide update -v</code></p>
<pre><code>package: .
import:
- package: github.com/openshift/client-go
  subpackages:
  - build/clientset/versioned/typed/build/v1
- package: k8s.io/apimachinery
  subpackages:
  - pkg/apis/meta/v1
- package: k8s.io/client-go
  subpackages:
  - tools/clientcmd
</code></pre>
<p>I see that all my packages are part of vendor. But I cant get the type changed to vendor config.</p>
<pre><code>go run main.go
# command-line-arguments
./main.go:39:44: cannot use config (type *&quot;k8s.io/client-go/rest&quot;.Config) as type *&quot;github.com/openshift/client-go/vendor/k8s.io/client-go/rest&quot;.Config in argument to &quot;github.com/openshift/client-go/build/clientset/versioned/typed/build/v1&quot;.NewForConfig
./main.go:46:88: cannot use &quot;k8s.io/apimachinery/pkg/apis/meta/v1&quot;.ListOptions literal (type &quot;k8s.io/apimachinery/pkg/apis/meta/v1&quot;.ListOptions) as type &quot;github.com/openshift/client-go/vendor/k8s.io/apimachinery/pkg/apis/meta/v1&quot;.ListOptions in argument to buildV1Client.Builds(namespace).List
</code></pre>
<p>I have deleted the vendor directory in the current directory and made sure gopath have all the required dependencies as an alternative try, But that doesnt work.
I also tried to link ~/go/src/github.com/openshift/client-go/vendor/* vendor but that doesnt seem to work.</p>
<p>I also tried the solution <a href="https://stackoverflow.com/questions/35760596/list-openshift-objects-via-go-client-api">List Openshift objects via Go client API</a>. Which did not work.</p>

drc12345
<p>glide is a bit <a href="https://github.com/Masterminds/glide" rel="noreferrer">outdated</a> as of this writing. Its last release was 07/10/2019.</p>
<p>Since version <code>1.11</code> Golang came up with its native package management called <a href="https://golang.org/ref/mod#tmp_0" rel="noreferrer">go modules</a> and that has become the more preferred way to manage dependencies. That's what manages your <code>vendor</code> directory and this is what <code>github.com/openshift/client-go</code> uses. I'm also assuming that you started from <a href="https://github.com/openshift/client-go/blob/master/examples/build/main.go" rel="noreferrer">this <code>main.go</code> file</a>.</p>
<p>Since everything under <code>github.com/openshift/client-go</code> has the dependencies already managed. I recommend 🎬:</p>
<pre class="lang-sh prettyprint-override"><code>go get github.com/openshift/client-go
cd $GOPATH/src/github.com/mygihubusername/myrepo
cp -R ../../openshift/client-go/* .
# put main.go here with your code or any of the subdirectories
# cd subdir 👈 if you put the main.go file under a subdir.
go build -o buildclient . 
# clean up any files you don't need
# create github repo
git add *
git commit -m 'My first commit'
git push origin master
</code></pre>
<p>Works for me. ✌️</p>
