E0705: A path parameter's type can't be in a URL
A parameter's type is the type of the field (or method func parameter) binding it, and says which segments match and how the package urls writes it back: a string, an integer kind, or a type with UnmarshalText (to read it) and MarshalText (to write it); a [path...] catch-all is a web.Rest or a string, and only a catch-all is a web.Rest. A struct, a slice, a float or a map is none of those. A named type is declared outside pages/: urls imports no page package, so a type declared in one can't appear in its methods. Reported at the field.
Wrong
html
<!-- pages/invoices/[invoice].vuka.html -->
<script lang="go">
package invoices
type Invoice struct {
Invoice []int
}
</script>
<h1>Invoice</h1>Right
go
package refs // a package outside pages/
type Ref struct{ Year, N int }
func (r Ref) MarshalText() ([]byte, error) { return fmt.Appendf(nil, "%d-%d", r.Year, r.N), nil }
func (r *Ref) UnmarshalText(b []byte) error {
_, err := fmt.Sscanf(string(b), "%d-%d", &r.Year, &r.N)
return err
}html
<!-- pages/invoices/[invoice].vuka.html -->
<script lang="go">
package invoices
import "example.com/shop/refs"
type Invoice struct {
Invoice refs.Ref
}
</script>
<h1>Invoice {Invoice.N}</h1>