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 after i investigated my go.mod
file, 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.