title: How to call function from another file in Go
body: <p>I want to call function from another file in Go. Can any one help?</p>
  <p><code>test1.go</code></p>
  <pre><code>package main
  
  func main() {
      demo()
  }
  </code></pre>
  <p><code>test2.go</code></p>
  <pre><code>package main
  
  import &quot;fmt&quot;
  
  func main() {
  }
  
  func demo() {
      fmt.Println(&quot;HI&quot;)
  }
  </code></pre>
  <p>How to call <code>demo</code> in <code>test2</code> from <code>test1</code>?</p>