title: Golang subproject or submodule dependency
body: <p>What is the recommended way in Golang to download a submodule of a dependency? I think my question can be best described by examples.</p>
  <h2>Example #1:</h2>
  <p>I have a client and a server. My server is an API and has a bunch of other dependencies, such as databases, messages queues, consul, and etc. I would like my <strong>client to be a lightweight package</strong> where users download only few dependencies needed for the client.</p>
  <p>You could say that the client and server can be on separate repositories. However, there may also be some common code amongst them, which if we follow this pattern, would again be another repository.</p>
  <p>I'm thinking of some structure that looks like this:</p>
  <pre><code>service/
  ---&gt; common/
  ------&gt; redis.go
  ------&gt; kafka.go
  ---&gt; client/
  ------&gt; client.go
  ---&gt; server/
  ------&gt; database/
  ------&gt; swagger/
  ------&gt; producer/
  ------&gt; etc/
  </code></pre>
  <h2>Example #2:</h2>
  <p>It's pretty common for projects to <strong>share models</strong>. If we have microservices that communicate through message brokers with a common model, we'd probably want some structure like this.</p>
  <pre><code>service/
  ---&gt; model/
  ------&gt; message.go
  ---&gt; service1/
  ---&gt; service2/
  </code></pre>
  <h2>Comparison to other languages</h2>
  <p>I am from a Scala/Java background and have started to use Golang less than a month. Comparing with Scala, I could have handled this in two ways. Let's take <strong>Example #2</strong></p>
  <ol>
  <li>Publish model as its own jar and import <code>model.jar</code> in each service</li>
  <li>Use multi-project setup in sbt: <a href="https://www.scala-sbt.org/1.x/docs/Multi-Project.html" rel="nofollow noreferrer">https://www.scala-sbt.org/1.x/docs/Multi-Project.html</a>.</li>
  </ol>
  <h2>Some Things I Explored in Go</h2>
  <ol>
  <li><a href="https://blog.gopheracademy.com/advent-2015/vendor-folder/" rel="nofollow noreferrer">https://blog.gopheracademy.com/advent-2015/vendor-folder/</a></li>
  <li><a href="https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories" rel="nofollow noreferrer">https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories</a></li>
  </ol>
  <p>But so far they don't seem to solve my question</p>
  <h2>Final Question</h2>
  <p>What is the recommended way in Golang to tackle the issues I stated in the examples?</p>
  <p>Thank you for your help!</p>