Skip to content

Commit e6ce16c

Browse files
committed
removing unnecessary utility functions
1 parent f6cda0c commit e6ce16c

File tree

6 files changed

+1
-55
lines changed

6 files changed

+1
-55
lines changed

diff/ignore.go

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ func Ignore() (Differ, error) {
66
return ignore{}, nil
77
}
88

9-
func IsIgnore(d Differ) bool {
10-
_, ok := d.(ignore)
11-
12-
return ok
13-
}
14-
159
func (t ignore) Diff() Type {
1610
return Identical
1711
}

diff/map.go

-18
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ func newMap(lhs, rhs interface{}) (mapDiff, error) {
7070
}, nil
7171
}
7272

73-
func IsMap(d Differ) bool {
74-
_, ok := d.(mapDiff)
75-
76-
return ok
77-
}
78-
7973
func mapTypesDiffer(lhs, rhs interface{}) (bool, error) {
8074
if lhs == nil {
8175
return true, ErrInvalidType{Value: lhs, For: "map"}
@@ -230,12 +224,6 @@ func getKeys(lhs, rhs reflect.Value) []reflect.Value {
230224
return keys
231225
}
232226

233-
func IsMapMissing(d Differ) bool {
234-
_, ok := d.(mapMissing)
235-
236-
return ok
237-
}
238-
239227
func (m mapMissing) Diff() Type {
240228
return ContentDiffer
241229
}
@@ -251,12 +239,6 @@ func (m mapMissing) StringIndent(key, prefix string, conf Output) string {
251239
"\n+" + prefix + key
252240
}
253241

254-
func IsMapExcess(d Differ) bool {
255-
_, ok := d.(mapExcess)
256-
257-
return ok
258-
}
259-
260242
func (e mapExcess) Diff() Type {
261243
return ContentDiffer
262244
}

diff/scalar.go

-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ type scalar struct {
1010
rhs interface{}
1111
}
1212

13-
func IsScalar(d Differ) bool {
14-
_, ok := d.(scalar)
15-
16-
return ok
17-
}
18-
1913
func (s scalar) Diff() Type {
2014
lhsVal := reflect.ValueOf(s.lhs)
2115
rhsVal := reflect.ValueOf(s.rhs)

diff/slice.go

-18
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ func newSlice(lhs, rhs interface{}) (Differ, error) {
6868
}, nil
6969
}
7070

71-
func IsSlice(d Differ) bool {
72-
_, ok := d.(slice)
73-
74-
return ok
75-
}
76-
7771
func sliceTypesDiffer(lhs, rhs interface{}) (bool, error) {
7872
if lhs == nil {
7973
return true, ErrInvalidType{Value: lhs, For: "slice"}
@@ -165,12 +159,6 @@ func (s slice) Walk(path string, fn WalkFn) error {
165159
return nil
166160
}
167161

168-
func IsSliceMissing(d Differ) bool {
169-
_, ok := d.(sliceMissing)
170-
171-
return ok
172-
}
173-
174162
func (m sliceMissing) Diff() Type {
175163
return ContentDiffer
176164
}
@@ -190,12 +178,6 @@ func (e sliceExcess) Diff() Type {
190178
return ContentDiffer
191179
}
192180

193-
func IsSliceExcess(d Differ) bool {
194-
_, ok := d.(sliceExcess)
195-
196-
return ok
197-
}
198-
199181
func (e sliceExcess) Strings() []string {
200182
return []string{
201183
fmt.Sprintf("+ %T %v", e.value, e.value),

diff/types.go

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ type types struct {
99
rhs interface{}
1010
}
1111

12-
func IsTypes(d Differ) bool {
13-
_, ok := d.(types)
14-
15-
return ok
16-
}
17-
1812
func (t types) Diff() Type {
1913
return TypesDiffer
2014
}

diff/walk_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestWalkError(t *testing.T) {
6767
}
6868

6969
_, err = Walk(d, func(_, diff Differ, _ string) (Differ, error) {
70-
if IsScalar(diff) {
70+
if _, ok := diff.(scalar); ok {
7171
return nil, expectedErr
7272
}
7373

0 commit comments

Comments
 (0)