I'm writing an API using Go and its
net/http stdlib module and i have some utils code in a directory named utils. But when i import them in main, Go does not find the packages. The root cause is apparently the fact that Go packages have to be saved in
$GOPATH/src/. So i wanted to know if there was a way to import local packages and save them in the same folder as the main package.
I'm following the Github Directory Structure so my $GOPATH looks like that.
$GOPATH/src/ |___github.com/ |___user/ |___repository/ |___main.go |___utils/ |___core.go |___factory.go
As the utils directory is really tied to the app, it would be really bad for me to save it as a different Go app in $GOPATH/src. And apart from that, imagine the moment when i will want to push my code on Github. Here it's only 2 repositories but if it was 6 i would need 6 private repos for really related and tied parts of a single application.