Lint code using staticcheck (#4471)
This commit is contained in:
parent
8f09acac2b
commit
fcd3054f13
16 changed files with 32 additions and 41 deletions
|
|
@ -295,13 +295,13 @@ func TestConfigureDynamically(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Errorf("unexpected error posting dynamic configuration: %v", err)
|
||||
}
|
||||
if count, _ := endpointStats["/configuration/backends"]; count != 0 {
|
||||
if count := endpointStats["/configuration/backends"]; count != 0 {
|
||||
t.Errorf("Expected %v to receive %d requests but received %d.", "/configuration/backends", 0, count)
|
||||
}
|
||||
if count, _ := endpointStats["/configuration/servers"]; count != 0 {
|
||||
if count := endpointStats["/configuration/servers"]; count != 0 {
|
||||
t.Errorf("Expected %v to receive %d requests but received %d.", "/configuration/servers", 0, count)
|
||||
}
|
||||
if count, _ := endpointStats["/configuration/general"]; count != 1 {
|
||||
if count := endpointStats["/configuration/general"]; count != 1 {
|
||||
t.Errorf("Expected %v to receive %d requests but received %d.", "/configuration/general", 0, count)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue