Preface
Gopath doesn’t work
Text
After using the proxy to download the go package, there is a problem that the package cannot be found. Later, it is found that if the proxy is used, it will go to the PKG package to find the dependency
Solution
When goproxy is used, go111module is turned on, which causes package management to go to the directory of $gopath/SRC/PKG instead of being in the directory of $gopath/SRC/PKG.
for details, please refer to these two articles:
go get downloaded packages
to solve the problem that go can’t download
at this time, we need to use go mod to introduce these packages/ gin@latest, Solve the problem that import can’t get the package
That is, run the following two commands
go mod init gin
go mod edit -require github.com/gin-gonic/gin@latest
Similar Posts:
- $GOPATH not set [How to Solve]
- Failed to connect to github.com port 443: Timed out(Windows)
- Go Project Start Error: package not in GOROOT & import cycle not allowed
- When installing Ubuntu 10.04, you will be prompted to not download the metadata and
- Go build cannot find package Error [How to Solve]
- Imageio: ‘ffmpeg-win32-v3.2.4.exe’ was not found on your computer; downloading it now.
- Webstorm yarn install Error: internal/modules/cjs/loader.js:892
- Intellij IDEA Golang Error: no Go files in D:\basic_tool\Go\src\gosvc
- Go Language compilation and installation protobuf: protoc-gen-go: program not found or is not executable
- Ruby on Rails : Could not find a JavaScript runtime