go - Can't use struct from own package -
i created following file structure in $gopath/src
bitbucket.org/myname/projectname i have follwoing files here
projectname - controllers/ - mecontroller.go - app.go in app.go i'm importing controller that:
import "bitbucket.org/myname/projectname/controllers" and in main func i'm trying use it's method.
mecontroller = new(controllers.mecontroller) m.get("/", mecontroller.index) my mecontroller.go looks this
package controllers type mecontroller struct { } func (controller *mecontroller) index () string { return "hello world" } but i'm getting error:
./app.go:5: imported , not used: "bitbucket.org/myname/projectname/controllers" ./app.go:12: undefined: mecontroller i don't have idea how work.
any ideas?
thanks!
in go, every symbol starts lowercase not exported package. call struct mecontroller , you'll fine.
Comments
Post a Comment