title: Using methods with multiple return values
body: <p>I'm trying to write a template (using html/template) and passing it a struct that has some methods attached to it, many of which return multiple values.  Is there any way of accessing these from within the template?  I'd like to be able to do something like:</p>
  
  <pre><code>package main
  
  import (
          "fmt"
          "os"
          "text/template"
  )
  
  type Foo struct {
      Name string
  }
  
  func (f Foo) Baz() (int, int) {
      return 1, 5
  }
  
  const tmpl = `Name: {{.Name}}, Ints: {{$a, $b := .Baz}}{{$a}}, {{b}}`
  
  func main() {
  
      f := Foo{"Foo"}
  
      t, err := template.New("test").Parse(tmpl)
      if err != nil {
          fmt.Println(err)
      }
  
      t.Execute(os.Stdout, f)
  
  }
  </code></pre>
  
  <p>But obviously this doesn't work.  Is there no way around it?</p>
  
  <p>I've considered creating an anonymous struct in my code:</p>
  
  <pre><code>data := struct {
      Foo
      a   int
      b   int
  }{
      f,
      0,
      0,
  }
  data.a, data.b = f.Baz()
  </code></pre>
  
  <p>And passing that in, but would much prefer to have something in the template.  Any ideas?  I also tried writing a wrapper function which I added to funcMaps but could never get that to work at all.</p>
  
  <p>Thanks for any suggestions!</p>