title: Converting Standard Golang Map into a Sync.Map to Avoid Race Condition
body: <p>I have the following line of code:</p>
  
  <pre><code>var a_map = make(map[string] []int)
  </code></pre>
  
  <p>Part of my code, which is utilizing the a_map variable occasionally throws the following error:</p>
  
  <pre><code>fatal error: concurrent map read and map write
  </code></pre>
  
  <p>In an attempt to create a more robust solution, one that is free from such an error, I would like to use a sync.Map as opposed to a generic map. I was inspired to do so by the only answer provided to this stack overflow <a href="https://stackoverflow.com/questions/45585589/golang-fatal-error-concurrent-map-read-and-map-write">question</a>. However, I am unclear as to the proper syntax for doing so.</p>
  
  <p>For my first attempt I utilized the following line of code:</p>
  
  <pre><code>var a_map = make(sync.Map[string] []int)
  </code></pre>
  
  <p>Which resulted in the following error:</p>
  
  <pre><code>...syntax error: unexpected ], expecting expression
  </code></pre>
  
  <p>Then I tried:</p>
  
  <pre><code> sync_map := new(sync.Map)
   var a_map = make(sync_map[string] []int)
  </code></pre>
  
  <p>Which resulted in the same error:</p>
  
  <pre><code>...syntax error: unexpected ], expecting expression
  </code></pre>