Quoted articles: https://stackoverflow.com/questions/63710830/spf13-cobra-cant-download-binary-to-gopath-bin
When the package is managed by go mod, it will be downloaded to $gopath/PKG/mod.
When downloading cobra, the executable binary Cobra will be automatically created in the $gopath/bin directory. If the following command line ~ /. Bashrc is added, cobra can be automatically referenced as a command line tool:
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
However, an error is reported in go get github.com/spf13/cobra/cobra: ambiguous import: found package github.com/spf13/cobra/cobra in multiple modules, indicating that duplicate packages exist. At this time, the solution is to set the version value. The replacement installation command is as follows:
go get -u github.com/spf13/cobra/[email protected]
Read More:
- [Solved] go cobra Error: required flag(s) “pkg-name” not set
- [Go] Solve can’t load package: cannot find module providing package github.com/xxxxx
- [Solved] Consul Error: github.com/boltdb/bolt github.com/boltdb/bolt github.com/hashicorp/raft-boltdb
- [Solved] LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
- [Solved] LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
- [Solved] Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED和cannot install, GOBIN must be an ab
- [Solved] Git Run Error: Could not resolve host: github.com
- Error starting vue project these dependencies were not found:create in ./src/router/modules/md.js
- [Solved] Maven log jar package conflict error: Class path contains multiple SLF4J bindings
- Log jar package conflict error: Class path contains multiple SLF4J bindings
- Keras-nightly Import package Error: cannot import name ‘Adam‘ from ‘keras.optimizers‘
- Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
- [Solved] Win10: Failed to connect to github.com port 443 Timed out
- [Solved] latex Import ntheorem Package Error: Package ntheorem Error: Theorem style plain already defined.
- GoLand import the local package Error [How to Solve]
- Git Push Error: failed to push some refs to ‘[email protected]:
- Echars 5.0 Import Error: “export ‘default’ (imported as ‘echarts’) was not found in ‘echarts’
- [Solved] Android Error: AAPT: error: unescaped apostrophe in string;Multiple substitutions specified in non-positi
- C# Error: Import “google/protobuf/timestamp.proto“ was not found or had errors. [How to Solve]
- Plink Error: Multiple instances of ‘_’ in sample ID.?