package main import ( "fmt" ) type Token struct { Type string Value string } func (t Token) String() string { return fmt.Sprintf("%s : '%s'", t.Type, t.Value) } func Parse(t []Token) Feed { var f Feed for i := range t { token := t[i] if token.Type == "URL" { f.URL = token.Value } if token.Type == "DESC" { f.Description = token.Value } if token.Type == "TAG" { f.Tags = append(f.Tags, token.Value) } } return f }