Lint code using staticcheck (#4471)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-08-23 12:08:40 -04:00 committed by GitHub
parent 8f09acac2b
commit fcd3054f13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 32 additions and 41 deletions

View file

@ -217,10 +217,8 @@ func quote(input interface{}) string {
switch input := input.(type) {
case string:
inputStr = input
break
case fmt.Stringer:
inputStr = input.String()
break
default:
inputStr = fmt.Sprintf("%v", input)
}

View file

@ -220,7 +220,11 @@ func TestBuildLuaSharedDictionaries(t *testing.T) {
}
// test invalid config
configuration = buildLuaSharedDictionaries(invalidType, servers, false)
if expected != actual {
if configuration != "" {
t.Errorf("expected an empty string, but got %s", configuration)
}
if actual != expected {
t.Errorf("Expected '%v' but returned '%v' ", expected, actual)
}
}
@ -233,7 +237,7 @@ func TestLuaConfigurationRequestBodySize(t *testing.T) {
}
size := luaConfigurationRequestBodySize(cfg)
if "21" != size {
if size != "21" {
t.Errorf("expected the size to be 20 but got: %v", size)
}
}