I\'ve used GOPATH
but for this current issue I\'m facing it does not help. I want to be able to create packages that are specific to a project:
To add a "local" package to your project, add a folder (for example "package_name"). And put your implementation files in that folder.
src/github.com/GithubUser/myproject/
├── main.go
└───package_name
└── whatever_name1.go
└── whatever_name2.go
In your package main
do this:
import "github.com/GithubUser/myproject/package_name"
Where package_name
is the folder name and it must match the package name used in files whatever_name1.go and whatever_name2.go. In other words all files with a sub-directory should be of the same package.
You can further nest more subdirectories as long as you specify the whole path to the parent folder in the import.