Background
GoLand input command
C:\Users\HI\go\GoPack> go get -u github.com/gin-gonic/gin
Errors are reported as follows
package github.com/gin-gonic/gin: directory "C:\\Users\\HI\\go\\src\\github.com\\gin-gonic\\gin" is not using a known version control system
analysis
This problem belongs to dependency management, go module
is an official version management tool launched after go1.11, and from go1.13, go module
will be the default dependency management tool of go language
Enter go env
to view the specific contents of go module
. First, pay attention to go111module
, which is the environment variable of go module
, and the default is auto
when go111module
= off
, module support is not enabled. During compilation, dependencies will be found under gopath
and vendor
when go111module
= on
, the module support is enabled. During compilation, the gopath
and vendor
dependencies will be ignored and downloaded directly from go. Mod
when go111module
= auto
, when the project is outside $gopath/SRC
and there are go. Mod
files in the project root directory, open the module support
.
Currently, there is no go.Mod
in the root directory of the project I created, so the module supports closing by default
Solution:
C:\Users\HI\go\GoPack> $env:GO111MODULE="on"
Read More:
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT
- Golang Error: go get github/xxx [How to Fix]
- Go declares that the local variable does not use command line arguments. Main. Go: 4:6: a declared but not used
- [Solved] Android Studio Error: The binary version of its metadata is 1.5.1, expected version is 1.1.15.
- [Solved] ‘pyopenssl’ is a dependency of conda and cannot be removed from requests’ is a dependency of conda
- Abnormal [System.InvalidOperationException: custom type mapping for ‘xxx’ is not specified or is not a solution
- Maven package error: [WARNING] The POM for xxx is missing, no dependency inform
- [Solved] Goland sdk Error: The selected directory is not a valid home for Go SDK
- [Solved] go cobra Error: required flag(s) “pkg-name” not set
- RuntimeError: Exporting the operator uniform to ONNX opset version 12 is not supported.
- unhandled system error, NCCL version 2.7.8 [How to Solve]
- [Solved] Error running ‘go build myfir_go_project‘: Cannot run program
- laravel Error mews/captcha is locked to version 3.2.4 and an update of this package was not requested.
- [Solved] Git Clone Error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
- [Solved] No corresponding flash error is found during MDK download
- ST-LINK Download Program Error: flash download failed – ‘cortex m4‘
- [Solved] removeerror: ‘requests’ is a dependency of CONDA and cannot be removed from
- [Solved] Error: Failed to download metadata for repo ‘docker-ce-stable‘: Cannot download repomd.xml:
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl