2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-02 11:46:36 +00:00

Adress code review comments

This commit is contained in:
Alexander Neumann 2017-07-09 20:28:38 +02:00
parent 78d090aea5
commit fda5e1f543

View File

@ -8,10 +8,10 @@ import (
// TagList is a list of tags. // TagList is a list of tags.
type TagList []string type TagList []string
// SplitTagList splits a string into a list of tags. The tags in the string // splitTagList splits a string into a list of tags. The tags in the string
// need to be separated by commas. Whitespace is stripped around the individual // need to be separated by commas. Whitespace is stripped around the individual
// tags. // tags.
func SplitTagList(s string) (l TagList) { func splitTagList(s string) (l TagList) {
for _, t := range strings.Split(s, ",") { for _, t := range strings.Split(s, ",") {
l = append(l, strings.TrimSpace(t)) l = append(l, strings.TrimSpace(t))
} }
@ -24,7 +24,7 @@ func (l TagList) String() string {
// Set updates the TagList's value. // Set updates the TagList's value.
func (l *TagList) Set(s string) error { func (l *TagList) Set(s string) error {
*l = SplitTagList(s) *l = splitTagList(s)
return nil return nil
} }
@ -36,12 +36,12 @@ func (TagList) Type() string {
// TagLists consists of several TagList. // TagLists consists of several TagList.
type TagLists []TagList type TagLists []TagList
// SplitTagLists splits a slice of strings into a slice of TagLists using // splitTagLists splits a slice of strings into a slice of TagLists using
// SplitTagList. // SplitTagList.
func SplitTagLists(s []string) (l TagLists) { func splitTagLists(s []string) (l TagLists) {
l = make([]TagList, 0, len(s)) l = make([]TagList, 0, len(s))
for _, t := range s { for _, t := range s {
l = append(l, SplitTagList(t)) l = append(l, splitTagList(t))
} }
return l return l
} }
@ -52,7 +52,7 @@ func (l TagLists) String() string {
// Set updates the TagList's value. // Set updates the TagList's value.
func (l *TagLists) Set(s string) error { func (l *TagLists) Set(s string) error {
*l = append(*l, SplitTagList(s)) *l = append(*l, splitTagList(s))
return nil return nil
} }