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

Commit

Permalink
fix: add pointer receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
schomatis committed May 6, 2021
1 parent 930e8c9 commit cd9b8c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions io/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func NewDirectory(dserv ipld.DAGService) Directory {
basicDir := new(BasicDirectory)
basicDir.node = format.EmptyDirNode()
basicDir.dserv = dserv
return UpgradeableDirectory{basicDir}
return &UpgradeableDirectory{basicDir}
}

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

// AddChild implements the `Directory` interface. We check when adding new entries
// if we should switch to HAMTDirectory according to global option(s).
func (d UpgradeableDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error {
func (d *UpgradeableDirectory) AddChild(ctx context.Context, name string, nd ipld.Node) error {
if UseHAMTSharding {
if basicDir, ok := d.Directory.(*BasicDirectory); ok {
hamtDir, err := basicDir.SwitchToSharding(ctx)
Expand Down
4 changes: 2 additions & 2 deletions io/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestUpgradeableDirectory(t *testing.T) {
ds := mdtest.Mock()
UseHAMTSharding = false // Create a BasicDirectory.
dir := NewDirectory(ds)
if _, ok := dir.(UpgradeableDirectory).Directory.(*BasicDirectory); !ok {
if _, ok := dir.(*UpgradeableDirectory).Directory.(*BasicDirectory); !ok {
t.Fatal("UpgradeableDirectory doesn't contain BasicDirectory")
}

Expand All @@ -117,7 +117,7 @@ func TestUpgradeableDirectory(t *testing.T) {
t.Fatal(err)
}

if _, ok := dir.(UpgradeableDirectory).Directory.(*HAMTDirectory); !ok {
if _, ok := dir.(*UpgradeableDirectory).Directory.(*HAMTDirectory); !ok {
t.Fatal("UpgradeableDirectory wasn't upgraded to HAMTDirectory")
}
}
Expand Down

0 comments on commit cd9b8c9

Please sign in to comment.