kubernetes / client-go

Go client for Kubernetes.
Apache License 2.0
8.99k stars 2.93k forks source link

Error in Installing client-go #1329

Closed tamilselvan1102 closed 8 months ago

tamilselvan1102 commented 8 months ago

getting following error when try to import client-go project

$ go get k8s.io/client-go@latest
go: go.mod file not found in current directory or any parent directory.
    'go get' is no longer supported outside a module.
    To build and install a command, use 'go install' with a version,
    like 'go install example.com/cmd@latest'
    For more information, see https://golang.org/doc/go-get-install-deprecation
    or run 'go help get' or 'go help install'.

Ref page: https://github.com/kubernetes/client-go/blob/master/INSTALL.md As per golang docs go get is deprecated. https://go.dev/doc/go-get-install-deprecation

/kind bug

liggitt commented 8 months ago

Those instructions are for adding the client-go library as a dependency to your go project, but the error message indicates you are running the command outside a directory containing a go project and go.mod file.

Make sure you are in the directory containing your go project and go.mod file, then run the go get command.