Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package list
- import (
- "github.com/cheekybits/genny/generic"
- )
- // Something .
- type Something generic.Type
- // SomethingList .
- type SomethingList []Something
- func NewSomethingList(l []Something) SomethingList {
- if l == nil {
- return SomethingList([]Something{})
- }
- return SomethingList(l)
- }
- type MappedType generic.Type
- func (l *SomethingList) Map(f func(s Something) MappedType) []MappedType {
- result := []MappedType{}
- for _, item := range []Something(*l) {
- result = append(result, f(item))
- }
- return result
- }
- // cat template.go | genny gen "Something=string MappedType=int" > list.go # fine
- // cat template.go | genny gen "Something=string MappedType=int,string" > list.go # error
Add Comment
Please, Sign In to add comment