title: Golang idiomatic error handling
body: <p>I have created a "base" repository struct for standalone and embedded use (e.g with CustomerRepository) to avoid having to check errors all the time, and to create an abstraction for Gorp (the database toolkit), and to create an API slightly more to my liking. </p>
  
  <p>I check for errors in this base struct and panic if one is found, as if one does exist in my opinion it then indicates a dev error and the code may as well panic, seeing as validation etc. should happen before data gets to the Repository.</p>
  
  <p>I found this question <a href="https://stackoverflow.com/questions/16963298/golang-error-handling-techniques">Go Error Handling Techniques</a>, but it doesn't cover wrapping errors up in a base struct like I have done and just panicking.</p>
  
  <p>Is what I have done idiomatic Go?</p>
  
  <pre><code>package repositories
  
  import (
      "github.com/coopernurse/gorp"
  )
  
  type Repository struct {
      Gorp gorp.SqlExecutor
  }
  
  func (r *Repository) GetById(i interface{}, id int) interface{} {
      obj, err := r.Gorp.Get(i, id)
      if err != nil {
          panic(err)
      }
      return obj
  }
  
  func (r *Repository) Get(holder interface{}, query string, args ...interface{}) interface{} {
      if err := Gorp.SelectOne(holder, query, args); err != nil {
          panic(err)
      }
  }
  
  func (r *Repository) Select(i interface{}, query string, args ...interface{}) {
      if _, err := Gorp.Select(holder, query, args); err != nil {
          panic(err)
      }
  }
  
  func (r *Repository) Insert(list ...interface{}) {
      if err := r.Gorp.Insert(list...); err != nil {
          panic(err)
      }
  }
  
  func (r *Repository) Update(list ...interface{}) int64 {
      count, err := r.Gorp.Update(list...)
      if err != nil {
          panic(err)
      }
      return count
  }
  
  func (r *Repository) Delete(list ...interface{}) int64 {
      count, err := r.Gorp.Delete(list...)
      if err != nil {
          panic(err)
      }
      return count
  }
  </code></pre>