title: When to use global variables
body: <p>I've heard many times that you should avoid global variables.</p>
  
  <p>In my example I declared a global <code>myTypes</code> variable only to avoid declaring that variable over and over again in a function call or something similar.</p>
  
  <p>Is this how it should be done? Is there a better way? A more testable way?</p>
  
  <pre><code>var myTypes = map[string]string{
    "type1": "tpl1",
    "type2": "tpl2",
  }
  
  func AFunc(someType string) string {
    fmt.Sprintf("this is your type %s", myTypes[someType])
  }
  
  func main() {
    AFunc("type1")
  }
  </code></pre>