ncw/gotemplate — pull request #5 by Logiraptor (2014-12-19 22:08:19+00:00)
Title: Fixed incorrect replacement of constants in template definition.

I'm interested in using gotemplate to generate math libraries. I figured that using a constant as a template parameter would be the natural way to go about that. See my example:

```Go
package tt

// template type Vector(A, n)
type A float32
const n = 2

type Vector [n]A

func (v Vector) Add(b Vector) {
for i := range v {
v += b[i]
}
}
```

Currently, if I instantiate this template with the argument `Vector3(float32, 3)`, I get `const 3 = 3` where the const declaration is. This patch fixes that behavior and allows using constants in the template parameters. It does not validate any constraints, e.g. a const parameter must be a literal value, etc. There is still more work to do to support Math libraries but this is a step closer, and one I think is fairly agreeable. Other decisions will need more careful consideration.