转到模板检查当前页面的导航栏

I'm trying to set a li in a golang template to active based on the current page. From what I've read you can only do {{if .scoreheader}} to check existence of a variable. Is there another way around this?

    <div class="col-md-3">
      <ul class="nav nav-pills nav-stacked">

        {{range $id, $name := .test}}
            {{if $name == .scoreheader}}
            <li class="active">
            {{else}}
            <li>
            {{end}}
            <li><a href="/app/index/?company={{$id}}">{{$name}}</a></li>
        {{end}}
      </ul>
    </div>

You can use the eq function as explained in text/template:

There is also a set of binary comparison operators defined as functions:

eq Returns the boolean truth of arg1 == arg2

So your if-statement would be:

{{if eq $name $.scoreheader}}