title: using method of interface in golang from different file
body: <p>I've <code>method</code> which I want to provide some interface to make it more easier to test</p>
  
  <p>This is the function</p>
  
  <p><strong>File A</strong></p>
  
  <pre><code>func readFile(s source) ([]byte, error) {
          p := fs.GetPath()
          file, err := ioutil.ReadFile(p + "/" + s.path + "/" + "rts.yaml")
          if err != nil {
              return yamlFile, fmt.Errorf("erro reading file : %s", err.Error())
          }
          return file, err
      }
  </code></pre>
  
  <p>Now I add for it struct</p>
  
  <pre><code>type source struct{
      path string
  }
  </code></pre>
  
  <p>And the interface that the <code>readFile</code> is <code>implementing</code></p>
  
  <pre><code>type fileReader interface {
      readFile(path string) ([]byte, error)
  }
  </code></pre>
  
  <p>And now I need to call this function from another file but Im getting error while doing this</p>
  
  <p><strong>File B</strong> </p>
  
  <pre><code>type source struct {
      path string
  }
  
  
  a := source{}
  
  yamlFile, err := readFile(a)
  </code></pre>
  
  <p>what am I missing here ? </p>