From 1e780605a9b8efe9e6914b66f06ebe4d07dcfd8e Mon Sep 17 00:00:00 2001 From: "M. Habib Rosyad" Date: Thu, 13 Aug 2020 17:56:02 +0700 Subject: [PATCH] fix vendor/k8s.io/apimachinery/pkg/util/framer staticcheck --- hack/.staticcheck_failures | 1 - staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 94549364320..2ead7a41587 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -23,7 +23,6 @@ vendor/k8s.io/apimachinery/pkg/labels vendor/k8s.io/apimachinery/pkg/runtime vendor/k8s.io/apimachinery/pkg/runtime/serializer/json vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning -vendor/k8s.io/apimachinery/pkg/util/framer vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy vendor/k8s.io/apimachinery/pkg/util/net vendor/k8s.io/apimachinery/pkg/util/sets/types diff --git a/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go b/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go index 066680f443e..45aa74bf582 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/framer/framer.go @@ -132,12 +132,14 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) { // Return whatever remaining data exists from an in progress frame if n := len(r.remaining); n > 0 { if n <= len(data) { + //lint:ignore SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], r.remaining...) r.remaining = nil return n, nil } n = len(data) + //lint:ignore SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], r.remaining[:n]...) r.remaining = r.remaining[n:] return n, io.ErrShortBuffer @@ -155,6 +157,7 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) { // and set m to it, which means we need to copy the partial result back into data and preserve // the remaining result for subsequent reads. if len(m) > n { + //lint:ignore SA4006,SA4010 underlying array of data is modified here. data = append(data[0:0], m[:n]...) r.remaining = m[n:] return n, io.ErrShortBuffer