kubectl/cmd: remove a bunch of unused parameters

Found with github.com/mvdan/unparam.
This commit is contained in:
Daniel Martí
2017-03-17 13:55:46 +00:00
parent e9a91b8cca
commit 810dbc5e98
26 changed files with 56 additions and 71 deletions

View File

@@ -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

View File

@@ -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)