title: Go Template variable check not behaving as I expected
body: <p>I have a few nested structs passed to my go html template.I want to check if a slice is empty and print "No Data" if its empty.</p>
  
  <p>I'm doing this with the following template code, but I never prints empty , it just donesnt  render any html. I've put text around the value to see if its outputting my text with empty but its not rendering my text. I thought there could be some other tests I need to so on the $s below , suchs $s not nil or $s not "". I've tried those but get the same result. I have noticed that if I print <code>{{$dr.Swells}}</code> before the range I get []. Any help or direction would be appreciated.</p>
  
  <pre><code>{{ range $d := .DailyHtmlData}}
    &lt;div class="row"&gt;&lt;small&gt;&lt;br&gt;&lt;/br&gt;&lt;/small&gt;&lt;/div&gt;  
  
          {{range $dr := $d.Forecast}}
            &lt;div class="row"&gt;
            &lt;div class="col col-2 text-left nopadding"&gt;&lt;small&gt;{{$dr.Day}}/{{$dr.Month}} {{$dr.Hour}}:00&lt;/small&gt;&lt;/div&gt;
               {{range $s := $dr.Swells}}
                 {{if  $s }}
                    &lt;div class="row"&gt;&lt;small&gt;
                      &lt;div class="col col-auto text-left nopadding"&gt;{{$s.Dir}} {{$s.Height}}ft@{{$s.Period}}Sec |&lt;/div&gt; 
                    &lt;/small&gt;&lt;/div&gt;
                 {{else}}
                    &lt;div class="row"&gt;&lt;small&gt;
                      &lt;div&gt;No Data.&lt;/div&gt;
                    &lt;/small&gt;&lt;/div&gt;
               {{end}}
              {{end}}
          &lt;div class="col text-right nopadding"&gt;&lt;small&gt;Wind:{{$dr.Winddir}}:{{$dr.Windspd}}mph Gusts:{{$dr.Windgus}}&lt;/small&gt;&lt;/div&gt;
         &lt;/div&gt;
          {{end}}
     {{end}}
  </code></pre>