How To Download Client-Go V12.0.0 via Go Get Cmd Tool

573 views Asked by At

when I execute below cmd:

go get k8s.io/[email protected]

it tells me: "go: k8s.io/[email protected]: invalid version: module contains a go.mod file, so module path must match major version ("k8s.io/client-go/v12")"

ok, then I changed the cmd to this:

go get k8s.io/[email protected]+incompatible

then again, it still tells me the same error: go: k8s.io/[email protected]+incompatible: invalid version: module contains a go.mod file, so module path must match major version ("k8s.io/client-go/v12")

one interesting thing puzzles me that if I add require k8s.io/client-go v12.0.0+incompatible to go.mod and then execute go mod tidy, then client-go v12.0.0 will be downloaded correctly.

My question is: how can I download this specific version of client-go via go get??

Go Version: v1.18

2

There are 2 answers

3
Volker On

how can I download this specific version of client-go via go get

Not at all.

go get is for adding dependencies to your project.

To download source code in a certain version from the internet use git clone and git checkout.

0
nadavleva308887 On

I used the go install command to download client-go

Here are two examples to install the latest or specific version.

go install k8s.io/client-go@latest

go install k8s.io/[email protected]

See client-go installation section for more help, client-go install