Commit cd9b8c9f authored by Lucas Molas's avatar Lucas Molas

fix: add pointer receiver

parent 930e8c98
......@@ -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
......@@ -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)
......
......@@ -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")
}
......@@ -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")
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment