Skip to content

Commit be87076

Browse files
author
Cornelius Weig
committed
Fix linter warnings
1 parent 3df5b93 commit be87076

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

pkg/ketall/filter/filter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func ApplyFilter(o runtime.Object) runtime.Object {
4343
return o
4444
}
4545

46-
filtered, err := FilterByPredicate(o, predicate)
46+
filtered, err := ByPredicate(o, predicate)
4747
if err != nil {
4848
logrus.Warnf("%s", errors.Wrapf(err, "filtering failed"))
4949
return o
@@ -52,7 +52,7 @@ func ApplyFilter(o runtime.Object) runtime.Object {
5252
return filtered
5353
}
5454

55-
func FilterByPredicate(o runtime.Object, p Predicate) (runtime.Object, error) {
55+
func ByPredicate(o runtime.Object, p Predicate) (runtime.Object, error) {
5656
if !meta.IsListType(o) {
5757
if p(o) {
5858
return o, nil
@@ -67,7 +67,7 @@ func FilterByPredicate(o runtime.Object, p Predicate) (runtime.Object, error) {
6767

6868
var items []runtime.Object
6969
for _, item := range allItems {
70-
item, err := FilterByPredicate(item, p)
70+
item, err := ByPredicate(item, p)
7171
if err != nil {
7272
return nil, err
7373
}

pkg/ketall/filter/filter_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ package filter
1818

1919
import (
2020
"fmt"
21+
"testing"
22+
"time"
23+
2124
"github.com/corneliusweig/ketall/pkg/ketall/util"
2225
"github.com/stretchr/testify/assert"
2326
"k8s.io/apimachinery/pkg/api/meta"
2427
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2528
"k8s.io/apimachinery/pkg/runtime"
26-
"testing"
27-
"time"
2829
)
2930

3031
type FakeV1Obj struct {
@@ -76,7 +77,7 @@ func TestFilterByPredicate(t *testing.T) {
7677

7778
predicate, _ := AgePredicate(test.humanDuration)
7879

79-
filtered, err := FilterByPredicate(util.ToV1List(givenObjs), predicate)
80+
filtered, err := ByPredicate(util.ToV1List(givenObjs), predicate)
8081
actualObjs, _ := meta.ExtractList(filtered)
8182
assert.NoError(t, err)
8283
assert.Equal(t, test.expectedNames, toNames(actualObjs))

pkg/ketall/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package util
1818

1919
import (
20-
"k8s.io/api/core/v1"
20+
v1 "k8s.io/api/core/v1"
2121
"k8s.io/apimachinery/pkg/runtime"
2222
)
2323

0 commit comments

Comments
 (0)