I have a Go project with this structure
src/
main.go (package main.go)
www/
api.go (package apictrl)
url_mapping.go (package apictrl)
core/
model.go (package mlsnd)
As I use Visual Studio Code with WSL Debian to code, I get the error undefined: apictrl
when I write apictrl.StartRouter()
in my main.go file.
I tried the following :
-
import ( "../www" )
-
import ( "../www/apictrl" )
-
import ( "../apictrl" )
-
import ( "/mnt/c/Users/myusername/path/toproject/src/apictrl" )
-
import ( "/mnt/c/Users/myusername/path/toproject/src/www/apictrl" )
-
import ( "/mnt/c/Users/myusername/path/toproject/src/www" )
As I saw in this post Import package & type but none of them worked.