i am using 1.14.2 version of go. i am trying to add my project to go.mod
to deploy heroku by using go mod init <dependecyname>
. After that i try to go run main.go
command to run my project but i received following error:
go: finding module for package github.com/googollee/go-socket.io
go: finding module for package github.com/dgrijalva/jwt-go
go: finding module for package github.com/gorilla/mux
go: found github.com/dgrijalva/jwt-go in github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: found github.com/googollee/go-socket.io in github.com/googollee/go-socket.io v1.4.4
go: found github.com/gorilla/mux in github.com/gorilla/mux v1.8.0
controllers/userController.go:10:2: cannot find package
models/avatar.go:3:8: cannot find package
models/base.go:6:1: cannot find package
models/base.go:7:1: cannot find package
models/user.go:8:2: cannot find package
controllers/userController.go:11:2: cannot find package
controllers/userController.go:12:2: cannot find package
controllers/userController.go:13:2: cannot find package
and also when i investigate my go.mod
file then i realized that there is unresolved dependency error in require
block:
module <modulename>
go 1.14
require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/googollee/go-socket.io v1.4.4 // indirect
github.com/gorilla/mux v1.8.0 // indirect
)
how to fix it?
I had the similar issue and I was able resolve by enabling the go modules integration. You can do that from Preferences > GO > GO Modules.
The go init
command initializes the go module for the current project by adding a new go.mod
file to your root folder with the module name you specified. To add new dependencies to your project, use go get <path>
and after that, it should be listed in the go.mod
file.
I was able resolve this issue by turn off and on the go modules integration. GOLANG Preferences > GO > GO Modules.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.