fix(worker): use snakecase for log filename

close #8
This commit is contained in:
Nicolas Carlier 2018-11-05 13:28:12 +00:00
parent d233cdc776
commit 3021c19551
2 changed files with 4 additions and 2 deletions

View File

@ -20,8 +20,8 @@ func ToSnakeCase(in string) string {
}
out = append(out, unicode.ToLower(runes[i]))
}
return strings.Replace(string(out), "-", "", -1)
result := strings.Replace(string(out), "/", "_", -1)
return strings.Replace(result, "-", "", -1)
}
// QueryParamsToShellVars convert URL query parameters to shell vars.

View File

@ -17,6 +17,8 @@ func TestToSnakeCase(t *testing.T) {
{"hello-world", "helloworld"},
{"helloWorld", "hello_world"},
{"HelloWorld", "hello_world"},
{"Hello/World", "hello__world"},
{"Hello/world", "hello_world"},
}
for _, tc := range testCases {
value := tools.ToSnakeCase(tc.value)