Apply gofmt to all code

This commit is contained in:
Ian Coleman 2017-11-29 12:02:53 +11:00
parent 30c986a8fa
commit 3de563c3dc
3 changed files with 27 additions and 27 deletions

View File

@ -24,7 +24,7 @@ func toCamelInitCase(s string, initCase bool) string {
n += string(v) n += string(v)
} }
} }
if v == '_' || v == ' ' || v == '-' { if v == '_' || v == ' ' || v == '-' {
capNext = true capNext = true
} else { } else {
capNext = false capNext = false
@ -34,9 +34,9 @@ func toCamelInitCase(s string, initCase bool) string {
} }
func ToCamel(s string) string { func ToCamel(s string) string {
return toCamelInitCase(s, true); return toCamelInitCase(s, true)
} }
func ToLowerCamel(s string) string { func ToLowerCamel(s string) string {
return toCamelInitCase(s, false); return toCamelInitCase(s, false)
} }

View File

@ -6,15 +6,15 @@ import (
func TestToCamel(t *testing.T) { func TestToCamel(t *testing.T) {
cases := [][]string{ cases := [][]string{
[]string{ "test_case", "TestCase" }, []string{"test_case", "TestCase"},
[]string{ "test", "Test" }, []string{"test", "Test"},
[]string{ "TestCase", "TestCase" }, []string{"TestCase", "TestCase"},
[]string{ " test case ", "TestCase" }, []string{" test case ", "TestCase"},
[]string{ "", "" }, []string{"", ""},
[]string{ "many_many_words", "ManyManyWords" }, []string{"many_many_words", "ManyManyWords"},
[]string{ "AnyKind of_string", "AnyKindOfString" }, []string{"AnyKind of_string", "AnyKindOfString"},
[]string{ "odd-fix", "OddFix" }, []string{"odd-fix", "OddFix"},
[]string{ "numbers2And55with000", "Numbers2And55With000" }, []string{"numbers2And55with000", "Numbers2And55With000"},
} }
for _, i := range cases { for _, i := range cases {
in := i[0] in := i[0]
@ -28,7 +28,7 @@ func TestToCamel(t *testing.T) {
func TestToLowerCamel(t *testing.T) { func TestToLowerCamel(t *testing.T) {
cases := [][]string{ cases := [][]string{
[]string{ "foo-bar", "fooBar" }, []string{"foo-bar", "fooBar"},
} }
for _, i := range cases { for _, i := range cases {
in := i[0] in := i[0]

View File

@ -6,20 +6,20 @@ import (
func TestToSnake(t *testing.T) { func TestToSnake(t *testing.T) {
cases := [][]string{ cases := [][]string{
[]string{ "testCase", "test_case" }, []string{"testCase", "test_case"},
[]string{ "TestCase", "test_case" }, []string{"TestCase", "test_case"},
[]string{ "Test Case", "test_case" }, []string{"Test Case", "test_case"},
[]string{ " Test Case", "test_case" }, []string{" Test Case", "test_case"},
[]string{ "Test Case ", "test_case" }, []string{"Test Case ", "test_case"},
[]string{ " Test Case ", "test_case" }, []string{" Test Case ", "test_case"},
[]string{ "test", "test" }, []string{"test", "test"},
[]string{ "test_case", "test_case" }, []string{"test_case", "test_case"},
[]string{ "Test", "test" }, []string{"Test", "test"},
[]string{ "", "" }, []string{"", ""},
[]string{ "ManyManyWords", "many_many_words" }, []string{"ManyManyWords", "many_many_words"},
[]string{ "manyManyWords", "many_many_words" }, []string{"manyManyWords", "many_many_words"},
[]string{ "AnyKind of_string", "any_kind_of_string" }, []string{"AnyKind of_string", "any_kind_of_string"},
[]string{ "numbers2and55with000", "numbers_2_and_55_with_000" }, []string{"numbers2and55with000", "numbers_2_and_55_with_000"},
} }
for _, i := range cases { for _, i := range cases {
in := i[0] in := i[0]