more tests for good boy points, split entities into files
This commit is contained in:
27
feed.go
Normal file
27
feed.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Feed struct {
|
||||
URL string
|
||||
Description string
|
||||
Tags []string
|
||||
}
|
||||
|
||||
// Return the final feed string, depending on either the link has a description, tags or not
|
||||
func (f Feed) String() string {
|
||||
var ff string
|
||||
var tags string = strings.TrimSpace(strings.Join(f.Tags, " "))
|
||||
|
||||
ff = fmt.Sprintf("%s %s", f.URL, tags)
|
||||
|
||||
if f.Description != "" {
|
||||
ff = fmt.Sprintf("%s # %s", strings.TrimSpace(ff), f.Description)
|
||||
}
|
||||
|
||||
return strings.TrimSpace(ff)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user