Fix Go vet errors for master golang

Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>

Kubernetes-commit: 95860cff1c418ea6f5494e4a6168e7acd1c390ec
This commit is contained in:
Abhishek Kr Srivastav 2024-09-12 18:15:22 +05:30 committed by Kubernetes Publisher
parent 7d77d3c2dd
commit 17ab6c21d5
6 changed files with 8 additions and 8 deletions

View File

@ -60,7 +60,7 @@ func TestLazyMapType(t *testing.T) {
evalCounter++
v, err := compileAndRun(env, activation, `{"a": "a"}`)
if err != nil {
return types.NewErr(err.Error())
return types.NewErr("%s", err.Error())
}
return v
})

View File

@ -2818,7 +2818,7 @@ func TestDeleteWithOptions(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
t.Logf(string(s))
t.Log(string(s))
}
if simpleStorage.deleted != ID {
t.Errorf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)
@ -2858,7 +2858,7 @@ func TestDeleteWithOptionsQuery(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
t.Logf(string(s))
t.Log(string(s))
}
if simpleStorage.deleted != ID {
t.Fatalf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)
@ -2901,7 +2901,7 @@ func TestDeleteWithOptionsQueryAndBody(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
t.Logf(string(s))
t.Log(string(s))
}
if simpleStorage.deleted != ID {
t.Errorf("Unexpected delete: %s, expected %s", simpleStorage.deleted, ID)

View File

@ -326,7 +326,7 @@ func TestSerializeObject(t *testing.T) {
compressionEnabled: true,
statusCode: http.StatusInternalServerError,
out: smallPayload,
outErrs: []error{fmt.Errorf(string(largePayload)), fmt.Errorf("bad2")},
outErrs: []error{errors.New(string(largePayload)), errors.New("bad2")},
mediaType: "application/json",
req: &http.Request{
Header: http.Header{

View File

@ -50,7 +50,7 @@ var (
func handleError(w http.ResponseWriter, r *http.Request, err error) {
errorMsg := fmt.Sprintf("Internal Server Error: %#v", r.RequestURI)
http.Error(w, errorMsg, http.StatusInternalServerError)
klog.Errorf(err.Error())
klog.Error(err.Error())
}
// requestWatermark is used to track maximal numbers of requests in a particular phase of handling

View File

@ -1610,7 +1610,7 @@ func verifyEvents(t *testing.T, w watch.Interface, events []watch.Event, strictO
if !valid {
t.Logf("(called from line %d)", line)
for _, err := range errors {
t.Errorf(err)
t.Error(err)
}
}
}

View File

@ -176,7 +176,7 @@ func (h *peerProxyHandler) WrapHandler(handler http.Handler) http.Handler {
// TODO: maintain locally serviceable GVRs somewhere so that we dont have to
// consult the storageversion-informed map for those
if len(serviceableByResp.peerEndpoints) == 0 {
klog.Errorf(fmt.Sprintf("GVR %v is not served by anything in this cluster", gvr))
klog.Error(fmt.Sprintf("GVR %v is not served by anything in this cluster", gvr))
handler.ServeHTTP(w, r)
return
}