1
0
Fork 0

Extract providers to their own package

This is just doing that and making it compile :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2017-04-17 12:50:02 +02:00
parent 2d00758b2e
commit 542c3673e4
36 changed files with 861 additions and 833 deletions

View file

@ -59,7 +59,7 @@ func (p *BaseProvider) GetConfiguration(defaultTemplateFile string, funcMap temp
)
configuration := new(types.Configuration)
var defaultFuncMap = template.FuncMap{
"replace": replace,
"replace": Replace,
"tolower": strings.ToLower,
"normalize": Normalize,
"split": split,
@ -101,7 +101,8 @@ func (p *BaseProvider) GetConfiguration(defaultTemplateFile string, funcMap temp
return configuration, nil
}
func replace(s1 string, s2 string, s3 string) string {
// Replace is an alias for strings.Replace
func Replace(s1 string, s2 string, s3 string) string {
return strings.Replace(s3, s1, s2, -1)
}
@ -122,7 +123,8 @@ func Normalize(name string) string {
return strings.Join(strings.FieldsFunc(name, fargs), "-")
}
func reverseStringSlice(slice *[]string) {
// ReverseStringSlice invert the order of the given slice of string
func ReverseStringSlice(slice *[]string) {
for i, j := 0, len(*slice)-1; i < j; i, j = i+1, j-1 {
(*slice)[i], (*slice)[j] = (*slice)[j], (*slice)[i]
}