fix staticcheck for k8s.io/apiserver/pkg/endpoints

This commit is contained in:
Kagaya 2021-02-27 15:37:00 +08:00
parent 452aff5fca
commit 9b02c89acd
3 changed files with 2 additions and 5 deletions

View File

@ -697,7 +697,7 @@ func TestAudit(t *testing.T) {
expectedID := types.UID("")
for i, expect := range test.expected {
event := events[i]
if "admin" != event.User.Username {
if event.User.Username != "admin" {
t.Errorf("Unexpected username: %s", event.User.Username)
}
if event.Stage != expect.Stage {

View File

@ -69,7 +69,7 @@ func withRequestDeadline(handler http.Handler, sink audit.Sink, policy policy.Ch
userSpecifiedTimeout, ok, err := parseTimeout(req)
if err != nil {
statusErr := apierrors.NewBadRequest(fmt.Sprintf("%s", err.Error()))
statusErr := apierrors.NewBadRequest(err.Error())
klog.Errorf("Error - %s: %#v", err.Error(), req.RequestURI)

View File

@ -22,7 +22,6 @@ import (
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"sync"
@ -217,8 +216,6 @@ var (
[]string{"verb", "group", "version", "resource", "subresource", "scope"},
)
kubectlExeRegexp = regexp.MustCompile(`^.*((?i:kubectl\.exe))`)
metrics = []resettableCollector{
deprecatedRequestGauge,
requestCounter,