Go project structure to produce library and cli with the same name in single repository
<p>How to setup project structure to produce library and cli with same name in
single repository?</p>

<p>Suppose my project name is <code>project</code>. I want to make it importable with name
<code>project</code> and have executable binary with name <code>project</code> when installed with
<code>go get</code>. My setup currently is like this:</p>

<pre><code>host.com/project/
    project/
        main.go
    core/
        project.go
</code></pre>

<p>Then, when installed with:</p>

<pre><code>go get host.com/project/project
</code></pre>

<p>it installs <code>project</code> as executable which pulls <code>core</code> as dependency. In
<code>core/project.go</code> file, the package has this:</p>

<pre><code>package project
</code></pre>

<p>The problem is it is imported with:</p>

<pre><code>import (
    "host.com/project/core"
)
</code></pre>

<p>And it exports <code>project</code> as name space not <code>core</code> which violates go's convention.
How can I do this?</p>