Skip to content

Commit 58353a9

Browse files
committed
remove EntryImpl
1 parent ff673fb commit 58353a9

File tree

2 files changed

+33
-70
lines changed

2 files changed

+33
-70
lines changed

pkg/tree/childMap_test.go

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,14 @@ func Test_childMap_DeleteChilds(t *testing.T) {
2323
name: "Delete single entry",
2424
fields: fields{
2525
c: map[string]Entry{
26-
"one": EntryImpl{
27-
sharedEntryAttributes: &sharedEntryAttributes{
28-
pathElemName: "one",
29-
},
26+
"one": &sharedEntryAttributes{
27+
pathElemName: "one",
3028
},
31-
"two": EntryImpl{
32-
sharedEntryAttributes: &sharedEntryAttributes{
33-
pathElemName: "two",
34-
},
29+
"two": &sharedEntryAttributes{
30+
pathElemName: "two",
3531
},
36-
"three": EntryImpl{
37-
sharedEntryAttributes: &sharedEntryAttributes{
38-
pathElemName: "three",
39-
},
32+
"three": &sharedEntryAttributes{
33+
pathElemName: "three",
4034
},
4135
},
4236
mu: sync.RWMutex{},
@@ -50,20 +44,14 @@ func Test_childMap_DeleteChilds(t *testing.T) {
5044
name: "Delete two entries",
5145
fields: fields{
5246
c: map[string]Entry{
53-
"one": EntryImpl{
54-
sharedEntryAttributes: &sharedEntryAttributes{
55-
pathElemName: "one",
56-
},
47+
"one": &sharedEntryAttributes{
48+
pathElemName: "one",
5749
},
58-
"two": EntryImpl{
59-
sharedEntryAttributes: &sharedEntryAttributes{
60-
pathElemName: "two",
61-
},
50+
"two": &sharedEntryAttributes{
51+
pathElemName: "two",
6252
},
63-
"three": EntryImpl{
64-
sharedEntryAttributes: &sharedEntryAttributes{
65-
pathElemName: "three",
66-
},
53+
"three": &sharedEntryAttributes{
54+
pathElemName: "three",
6755
},
6856
},
6957
mu: sync.RWMutex{},
@@ -77,20 +65,14 @@ func Test_childMap_DeleteChilds(t *testing.T) {
7765
name: "Delete non-existing entry",
7866
fields: fields{
7967
c: map[string]Entry{
80-
"one": EntryImpl{
81-
sharedEntryAttributes: &sharedEntryAttributes{
82-
pathElemName: "one",
83-
},
68+
"one": &sharedEntryAttributes{
69+
pathElemName: "one",
8470
},
85-
"two": EntryImpl{
86-
sharedEntryAttributes: &sharedEntryAttributes{
87-
pathElemName: "two",
88-
},
71+
"two": &sharedEntryAttributes{
72+
pathElemName: "two",
8973
},
90-
"three": EntryImpl{
91-
sharedEntryAttributes: &sharedEntryAttributes{
92-
pathElemName: "three",
93-
},
74+
"three": &sharedEntryAttributes{
75+
pathElemName: "three",
9476
},
9577
},
9678
mu: sync.RWMutex{},
@@ -133,20 +115,14 @@ func Test_childMap_DeleteChild(t *testing.T) {
133115
name: "Delete existing entry",
134116
fields: fields{
135117
c: map[string]Entry{
136-
"one": EntryImpl{
137-
sharedEntryAttributes: &sharedEntryAttributes{
138-
pathElemName: "one",
139-
},
118+
"one": &sharedEntryAttributes{
119+
pathElemName: "one",
140120
},
141-
"two": EntryImpl{
142-
sharedEntryAttributes: &sharedEntryAttributes{
143-
pathElemName: "two",
144-
},
121+
"two": &sharedEntryAttributes{
122+
pathElemName: "two",
145123
},
146-
"three": EntryImpl{
147-
sharedEntryAttributes: &sharedEntryAttributes{
148-
pathElemName: "three",
149-
},
124+
"three": &sharedEntryAttributes{
125+
pathElemName: "three",
150126
},
151127
},
152128
mu: sync.RWMutex{},
@@ -160,20 +136,14 @@ func Test_childMap_DeleteChild(t *testing.T) {
160136
name: "Delete non-existing entry",
161137
fields: fields{
162138
c: map[string]Entry{
163-
"one": EntryImpl{
164-
sharedEntryAttributes: &sharedEntryAttributes{
165-
pathElemName: "one",
166-
},
139+
"one": &sharedEntryAttributes{
140+
pathElemName: "one",
167141
},
168-
"two": EntryImpl{
169-
sharedEntryAttributes: &sharedEntryAttributes{
170-
pathElemName: "two",
171-
},
142+
"two": &sharedEntryAttributes{
143+
pathElemName: "two",
172144
},
173-
"three": EntryImpl{
174-
sharedEntryAttributes: &sharedEntryAttributes{
175-
pathElemName: "three",
176-
},
145+
"three": &sharedEntryAttributes{
146+
pathElemName: "three",
177147
},
178148
},
179149
mu: sync.RWMutex{},

pkg/tree/entry.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,17 @@ const (
2323
ReplaceIntentName = "replace"
2424
)
2525

26-
type EntryImpl struct {
27-
*sharedEntryAttributes
28-
}
29-
3026
// newEntry constructor for Entries
31-
func newEntry(ctx context.Context, parent Entry, pathElemName string, tc *TreeContext) (*EntryImpl, error) {
27+
func newEntry(ctx context.Context, parent Entry, pathElemName string, tc *TreeContext) (*sharedEntryAttributes, error) {
3228
// create a new sharedEntryAttributes instance
3329
sea, err := newSharedEntryAttributes(ctx, parent, pathElemName, tc)
3430
if err != nil {
3531
return nil, err
3632
}
3733

38-
newEntry := &EntryImpl{
39-
sharedEntryAttributes: sea,
40-
}
4134
// add the Entry as a child to the parent Entry
42-
err = parent.addChild(ctx, newEntry)
43-
return newEntry, err
35+
err = parent.addChild(ctx, sea)
36+
return sea, err
4437
}
4538

4639
// Entry is the primary Element of the Tree.

0 commit comments

Comments
 (0)