- If the go.mod file is not automatically generated in the microservice package under the service package, run the following command to generate the go.mod file
go mod init
Copy the code
- Download all dependencies
Select an error and click sync… If not, try:
go get ./
Copy the code
- Enabling the go modules integration
Preferences > GO > GO Modules
-
Go Modules may cause import problems in web packages.
- Create the go.mod file
go mod init test_go_mod Copy the code
- Re-download the installation package (or click sync…
go get -u github.com/gin-gonic/gin Copy the code
- Change the path of your own package
The previous path is bj38web/web/utils, which is not recognized at this time
Need to change to
The mod name/utils
, such astest_go_mod/utils