I'm writing a fairly simple application in Go, more as a learning tool than anything else.
What I'd really like to do is to organise my code somewhat - for example, I've separated out some Hipchat API commands into a separate file. Right now, it's still under the main
package, but I'd prefer to move it (namespace it) into a kind of subpackage. The thing is, Go seems to think that such a package should live in my $GOPATH
, despite it not being relevant to any project besides the one it's being written for.
I'm probably trying to misuse the package functionality, so if so, what's the best way to achieve what I'm trying to do?
Thanks to the pointers from tkausl in comments left on my question, I figured out the way to achieve exactly what I wanted. I moved my project to reside in $GOPATH
and then accessed the sub-package via import subpackage from "project/subpackage"
.
Wouldn't have got there for a while without that help! Just a case of learning Go's way of doing things.