Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit cd9b8c9

Browse files
committed
fix: add pointer receiver
1 parent 930e8c9 commit cd9b8c9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

io/directory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func NewDirectory(dserv ipld.DAGService) Directory {
100100
basicDir := new(BasicDirectory)
101101
basicDir.node = format.EmptyDirNode()
102102
basicDir.dserv = dserv
103-
return UpgradeableDirectory{basicDir}
103+
return &UpgradeableDirectory{basicDir}
104104
}
105105

106106
// ErrNotADir implies that the given node was not a unixfs directory
@@ -308,7 +308,7 @@ var _ Directory = (*UpgradeableDirectory)(nil)
308308

309309
// AddChild implements the `Directory` interface. We check when adding new entries
310310
// if we should switch to HAMTDirectory according to global option(s).
311-
func (d UpgradeableDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error {
311+
func (d *UpgradeableDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error {
312312
if UseHAMTSharding {
313313
if basicDir, ok := d.Directory.(*BasicDirectory); ok {
314314
hamtDir, err := basicDir.SwitchToSharding(ctx)

io/directory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func TestUpgradeableDirectory(t *testing.T) {
105105
ds := mdtest.Mock()
106106
UseHAMTSharding = false // Create a BasicDirectory.
107107
dir := NewDirectory(ds)
108-
if _, ok := dir.(UpgradeableDirectory).Directory.(*BasicDirectory); !ok {
108+
if _, ok := dir.(*UpgradeableDirectory).Directory.(*BasicDirectory); !ok {
109109
t.Fatal("UpgradeableDirectory doesn't contain BasicDirectory")
110110
}
111111

@@ -117,7 +117,7 @@ func TestUpgradeableDirectory(t *testing.T) {
117117
t.Fatal(err)
118118
}
119119

120-
if _, ok := dir.(UpgradeableDirectory).Directory.(*HAMTDirectory); !ok {
120+
if _, ok := dir.(*UpgradeableDirectory).Directory.(*HAMTDirectory); !ok {
121121
t.Fatal("UpgradeableDirectory wasn't upgraded to HAMTDirectory")
122122
}
123123
}

0 commit comments

Comments
 (0)