title: Installing local go package
body: <p>I want to install a go package locally. Let's pretend I'm not using git and I have no network connection. I just want to write the following demo &quot;library&quot;:</p>
  <p>mkdir mylib &amp;&amp; cd mylib &amp;&amp; go mod init locallib/mylib</p>
  <pre><code>package main
  
  func GetSecretNumber() int {
      return 3
  }
  </code></pre>
  <p>Now I just want to install this &quot;library&quot; on my machine. So that in a completely separate package I can do:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;locallib/mylib&quot;
  )
  
  func main() {
      fmt.Printf(&quot;The secret number from the lib is: %d\n&quot;, mylib.GetSecretNumber())
  }
  </code></pre>
  <p>I just want this trivial example to work locally. I don't care about git, github, publishing or versioning. Do the go tool allow me to compile the mylib package and install it locally using any available commands?</p>