title: Splitting client/server code
body: <p>I'm developing a client/server application in golang, and there are certain logical entities that exist both on client and server(the list is limited)</p>
  
  <p>I would like to ensure certain code for this entities is included ONLY in the server part but NOT in the client(wise versa is nice, but not so important). </p>
  
  <p>The naive thought would be to rely on dead code elimination, but from my brief research it's not a reliable way to handle the task... <code>go build</code> simply won't eliminate dead code from the fact that it may have been used via reflection(nobody cares that it wasn't and there is no option to tune this)</p>
  
  <p>More solid approach seems to be splitting code in different packages and import appropriately, this seems reliable but over-complicates the code forcing you to physically split certain entities between different packages and constantly keep this in mind...</p>
  
  <p>And finally there are build tags allowing to have multiple files under the same package built conditionally for client and server</p>
  
  <p>The motivation with using build tags is that I want to keep code as clean as possible without introducing any synthetic entities</p>
  
  <p>Use case:
  there are certain cryptography routines, client works with public key, server operates with private... Code logically belongs to the same entity</p>
  
  <p>What option would you choose and why?</p>