I am following tutorial of chat room covered here
I changed it to import a local package instead of using the sample from ravel's github. I changed it into something like this in one of the controllers (refresh.go
in the tuts):
import (
"./../chatroom"
"github.com/revel/revel"
)
And chatroom was in the right directory:
- app
- chatroom
- chatroom.go
- controllers
- refresh.go
- app.go
package chatroom
was also initialized already in chatroom.go
.
But when running the code, I received this error:
The Go code app/tmp/main.go does not compile: local import "./../chatroom" in non-local package
What am I doing wrong here?
It would be best, following this answer to not use a relative path, but a path from the $GOPATH/src
In your case, is $GOPAHT/src
includes app chatroom, you would use
import app/chatroom
The OP comments:
working, but I have to include my app name, something like
myapp/app/chatroom
,
That makes sense, if $GOPATH/src
contains the folder myapp
.