title: Can I have multiple packages inside a single go module? How?
body: <p>I have a Go module whose name is 'tatata'. It is only developed in my machine and thus it does not contain any path to any URL in the module name.</p>
  
  <p>If I have only one <code>main</code> package in my module it works correctly.
  However, if I create two packages in the module, I am experiencing some problems.</p>
  
  <p>This is the tree:</p>
  
  <pre><code>./|
    |- go.mod
    |-src
       |- main
       |   | - main.go
       |
       |- api
           | - api.go
  
  </code></pre>
  
  <p>The content of the files:</p>
  
  <p><code>go.mod</code></p>
  
  <pre><code>module tatata
  
  go 1.13
  </code></pre>
  
  <p><code>main.go</code></p>
  
  <pre><code>package main
  
  import "fmt"
  import "tatata/api"
  
  func main() {
    fmt.Println("Hello world")
    api.Test1()
  }
  </code></pre>
  
  <p><code>api.go</code></p>
  
  <pre><code>package api
  
  import "fmt"
  func Test1() {
     fmt.Println("Testing API")
  }
  </code></pre>
  
  <p>When I try to build, I issue <code>go build ./src/main</code> and I get the following error: 
  <code>build tatata/src/main: cannot load tatata/api: malformed module path "tatata/api": missing dot in first path element</code></p>
  
  <p>Now, if I try to put a dummy dot, like renaming the module to <code>tatata.com</code> I get the error <code>build tatata.com/src/main: cannot load tatata.com/api: cannot find module providing package tatata.com/api</code> as obviously my package/module is not available in that URL.</p>
  
  <p><code>GOPATH</code> is empty, i.e. not set.</p>
  
  <p>Questions:</p>
  
  <p>a) What is the right way, i.e. naming of modules and imports when using multiple packages inside a single Go module?</p>
  
  <p>b) Is it impossible to have a Go module without dots in its name?! </p>
  
  <p>c) Can you point me to any working example that has a building set-up with a single go module and multiple packages in the module?</p>