title: Using url parameters in golang template code
body: <p>I'm new to Go and trying to modify some code written by someone else. Right now he tests the stored value of a given day to determine if someone took lunch that day or not. </p>
  
  <p>What I want to do is see if there's a stored value and if there isn't, use the default value which is passed via URL parameter. The code looks like this:</p>
  
  <pre><code>&lt;input id="lunch{{.place}}" type="checkbox" {{if index .week.NoMeals .place}} checked {{end}}&gt;
  </code></pre>
  
  <p>I have a URL variable set like so:</p>
  
  <pre><code>sitename?nolunch=1
  </code></pre>
  
  <p>So the logic I want is that if the stored data for that day is set, the checkbox will reflect the stored value. If it hasn't been set, the box should be checked if the nolunch URL parameter is set and not checked if it's not.</p>
  
  <p>How do I test for url parameters in Go template code?</p>