mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
kubectl/cmd: remove a bunch of unused parameters
Found with github.com/mvdan/unparam.
This commit is contained in:
@@ -441,7 +441,7 @@ func ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error) {
|
||||
|
||||
// Merge requires JSON serialization
|
||||
// TODO: merge assumes JSON serialization, and does not properly abstract API retrieval
|
||||
func Merge(codec runtime.Codec, dst runtime.Object, fragment, kind string) (runtime.Object, error) {
|
||||
func Merge(codec runtime.Codec, dst runtime.Object, fragment string) (runtime.Object, error) {
|
||||
// encode dst into versioned json and apply fragment directly too it
|
||||
target, err := runtime.Encode(codec, dst)
|
||||
if err != nil {
|
||||
@@ -712,7 +712,7 @@ func FilterResourceList(obj runtime.Object, filterFuncs kubectl.Filters, filterO
|
||||
|
||||
// PrintFilterCount displays informational messages based on the number of resources found, hidden, or
|
||||
// config flags shown.
|
||||
func PrintFilterCount(out io.Writer, found, hidden, errors int, resource string, options *printers.PrintOptions, ignoreNotFound bool) {
|
||||
func PrintFilterCount(out io.Writer, found, hidden, errors int, options *printers.PrintOptions, ignoreNotFound bool) {
|
||||
switch {
|
||||
case errors > 0 || ignoreNotFound:
|
||||
// print nothing
|
||||
|
||||
@@ -47,10 +47,8 @@ func TestMerge(t *testing.T) {
|
||||
fragment string
|
||||
expected runtime.Object
|
||||
expectErr bool
|
||||
kind string
|
||||
}{
|
||||
{
|
||||
kind: "Pod",
|
||||
obj: &api.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
@@ -67,7 +65,6 @@ func TestMerge(t *testing.T) {
|
||||
/* TODO: uncomment this test once Merge is updated to use
|
||||
strategic-merge-patch. See #8449.
|
||||
{
|
||||
kind: "Pod",
|
||||
obj: &api.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
@@ -105,7 +102,6 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
}, */
|
||||
{
|
||||
kind: "Pod",
|
||||
obj: &api.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
@@ -136,20 +132,17 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "Pod",
|
||||
obj: &api.Pod{},
|
||||
fragment: "invalid json",
|
||||
expected: &api.Pod{},
|
||||
expectErr: true,
|
||||
},
|
||||
{
|
||||
kind: "Service",
|
||||
obj: &api.Service{},
|
||||
fragment: `{ "apiVersion": "badVersion" }`,
|
||||
expectErr: true,
|
||||
},
|
||||
{
|
||||
kind: "Service",
|
||||
obj: &api.Service{
|
||||
Spec: api.ServiceSpec{},
|
||||
},
|
||||
@@ -168,7 +161,6 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "Service",
|
||||
obj: &api.Service{
|
||||
Spec: api.ServiceSpec{
|
||||
Selector: map[string]string{
|
||||
@@ -190,7 +182,7 @@ func TestMerge(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
out, err := Merge(testapi.Default.Codec(), test.obj, test.fragment, test.kind)
|
||||
out, err := Merge(testapi.Default.Codec(), test.obj, test.fragment)
|
||||
if !test.expectErr {
|
||||
if err != nil {
|
||||
t.Errorf("testcase[%d], unexpected error: %v", i, err)
|
||||
|
||||
Reference in New Issue
Block a user