How to setup project structure to produce library and cli with same name in single repository?
Suppose my project name is project
. I want to make it importable with name
project
and have executable binary with name project
when installed with
go get
. My setup currently is like this:
host.com/project/
project/
main.go
core/
project.go
Then, when installed with:
go get host.com/project/project
it installs project
as executable which pulls core
as dependency. In
core/project.go
file, the package has this:
package project
The problem is it is imported with:
import (
"host.com/project/core"
)
And it exports project
as name space not core
which violates go's convention.
How can I do this?