I want to use spf13/cobra on my project.
spf13/cobra: A Commander for modern Go CLI interactions
typed install command result
$ go get -u github.com/spf13/cobra/cobra
go: downloading github.com/spf13/cobra v1.0.0
go: downloading github.com/spf13/cobra/cobra v0.0.0-20200826151851-02a0d2fbc9e6
go: github.com/spf13/cobra/cobra upgrade => v0.0.0-20200826151851-02a0d2fbc9e6
go get github.com/spf13/cobra/cobra: ambiguous import: found package github.com/spf13/cobra/cobra in multiple modules:
github.com/spf13/cobra v1.0.0 (/go/pkg/mod/github.com/spf13/[email protected]/cobra)
github.com/spf13/cobra/cobra v0.0.0-20200826151851-02a0d2fbc9e6 (/go/pkg/mod/github.com/spf13/cobra/[email protected])
but not found cobra
command and binary file.
$ cobra
bash: cobra: command not found
$ ls -la $GOPATH/bin | grep cobra
// not found binary
this is my go env.
$ go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vscode/.cache/go-build"
GOENV="/home/vscode/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/workspaces/[my-package-name]/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build068490139=/tmp/go-build -gno-record-gcc-switches"
and develop via container based on microsoft/vscode-remote-try-go.
How can I do install binary to $GOPATH/bin
?
Install the Cobra Generator
More Info: https://github.com/spf13/cobra/blob/master/cobra/README.md