title: Best way to organize a Go interface
body: <p>Its been a long time since I have programmed in C++, but I know that in C++ the classes are organized into .h files and .cpp files. Also many other languages benefit from splitting up code into logical groupings within a directory structure to improve organization.</p>
  
  <p>Well I am trying to learn Go now and I was reading over the <a href="http://golang.org/doc/go_for_cpp_programmers.html" rel="noreferrer">Go for C++ Programmers</a> article when I came upon interfaces. The article explains that interfaces in Go essentially take the place of classes, and shows how to set them up pretty well.</p>
  
  <p>What I am trying to figure out though is how should I organize an interface into files? For instance, should the interface be in one file while the implementation is in another?</p>
  
  <p><strong>myInterface.go</strong></p>
  
  <pre><code>type myInterface interface {
      get() int
      set(i int)
  }
  </code></pre>
  
  <p><br /><strong>myImplementation.go</strong></p>
  
  <pre><code>type myType struct { i int }
  func (p *myType) set(i int) { p.i = i }
  func (p *myType) get() int { return p.i }
  </code></pre>
  
  <p>My code here may be wrong since I do not completely know what I am doing yet (and if I am wrong please correct me), but would this be the best way to set this up? Im having a very hard time trying to wrap my head around how to organize code in Go so any help is appreciated!</p>
  
  <p>Metropolis</p>