Merge pull request #106448 from aojea/hlee/issue-103721/staticcheck

use golangci-lint

Kubernetes-commit: 1367cca8fd67b09606b01c0a9e46cef59aef3424
This commit is contained in:
Kubernetes Publisher 2021-11-17 09:25:54 -08:00
commit 51a4fd4aee
5 changed files with 14 additions and 43 deletions

View File

@ -27,7 +27,7 @@ import (
"sync"
"time"
//lint:ignore SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs
//nolint:staticcheck // SA1019 Keep using module since it's still being maintained and the api of google.golang.org/protobuf/proto differs
"github.com/golang/protobuf/proto"
openapi_v2 "github.com/googleapis/gnostic/openapiv2"

4
go.mod
View File

@ -31,7 +31,7 @@ require (
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
google.golang.org/protobuf v1.27.1
k8s.io/api v0.0.0-20211117032144-b7adf12040d3
k8s.io/apimachinery v0.0.0-20211117031932-cc08b72c0267
k8s.io/apimachinery v0.0.0-20211117172554-9edaf59fbc7f
k8s.io/klog/v2 v2.30.0
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
@ -41,5 +41,5 @@ require (
replace (
k8s.io/api => k8s.io/api v0.0.0-20211117032144-b7adf12040d3
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20211117031932-cc08b72c0267
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20211117172554-9edaf59fbc7f
)

4
go.sum
View File

@ -612,8 +612,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20211117032144-b7adf12040d3 h1:OUKo3mc2wSOr2GGk0MiMWhZOca1INVHD0Ol0zHOmlKU=
k8s.io/api v0.0.0-20211117032144-b7adf12040d3/go.mod h1:B1McGV/Uyv/c0sGZKsHMP4FArbyZZ8Emx+a7h5d/tMs=
k8s.io/apimachinery v0.0.0-20211117031932-cc08b72c0267 h1:vbR4nyGR/pk2oRTy+vNbzFR5cJQz5vg5NceVPvJuzso=
k8s.io/apimachinery v0.0.0-20211117031932-cc08b72c0267/go.mod h1:SqloDTPqePPNhEp8K4qUgqpKc3tE+ymn05iIUbSAQ7g=
k8s.io/apimachinery v0.0.0-20211117172554-9edaf59fbc7f h1:gvsqJqL6FCUf5MHZMT0oSXH0JlvV34DroJIEbm8tz7E=
k8s.io/apimachinery v0.0.0-20211117172554-9edaf59fbc7f/go.mod h1:SqloDTPqePPNhEp8K4qUgqpKc3tE+ymn05iIUbSAQ7g=
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=

View File

@ -47,7 +47,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/runtime/serializer/streaming"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/apimachinery/pkg/util/httpstream"
"k8s.io/apimachinery/pkg/util/intstr"
utilnet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/watch"
@ -1436,40 +1435,6 @@ func TestRequestStream(t *testing.T) {
}
}
type fakeUpgradeConnection struct{}
func (c *fakeUpgradeConnection) CreateStream(headers http.Header) (httpstream.Stream, error) {
return nil, nil
}
func (c *fakeUpgradeConnection) Close() error {
return nil
}
func (c *fakeUpgradeConnection) CloseChan() <-chan bool {
return make(chan bool)
}
func (c *fakeUpgradeConnection) SetIdleTimeout(timeout time.Duration) {
}
type fakeUpgradeRoundTripper struct {
req *http.Request
conn httpstream.Connection
}
func (f *fakeUpgradeRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
f.req = req
b := []byte{}
body := ioutil.NopCloser(bytes.NewReader(b))
resp := &http.Response{
StatusCode: http.StatusSwitchingProtocols,
Body: body,
}
return resp, nil
}
func (f *fakeUpgradeRoundTripper) NewConnection(resp *http.Response) (httpstream.Connection, error) {
return f.conn, nil
}
func TestRequestDo(t *testing.T) {
testCases := []struct {
Request *Request

View File

@ -669,7 +669,9 @@ func Example_noMergingOnExplicitPaths() {
}
mergedConfig, err := loadingRules.Load()
if err != nil {
fmt.Printf("Unexpected error: %v", err)
}
json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
if err != nil {
fmt.Printf("Unexpected error: %v", err)
@ -715,7 +717,9 @@ func Example_mergingSomeWithConflict() {
}
mergedConfig, err := loadingRules.Load()
if err != nil {
fmt.Printf("Unexpected error: %v", err)
}
json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
if err != nil {
fmt.Printf("Unexpected error: %v", err)
@ -774,7 +778,9 @@ func Example_mergingEverythingNoConflicts() {
}
mergedConfig, err := loadingRules.Load()
if err != nil {
fmt.Printf("Unexpected error: %v", err)
}
json, err := runtime.Encode(clientcmdlatest.Codec, mergedConfig)
if err != nil {
fmt.Printf("Unexpected error: %v", err)