Skip to content

Error instantiating recursive type #208

Closed
@RafalSkolasinski

Description

@RafalSkolasinski

When trying to create a simple graph structure - a struct containing a slice of itself - I am getting problems in gophernotes.

Same works fine in just plain go file.

Code:

package main

import "fmt"

type Item struct {
    Name               string
    Children           []Item
}

graph := Item{
    Name: "my-name",
    Children: []Item{
        {Name: "other-name"},
    },
}

throws error (warning?)

reflect.Value.Convert: value of type []struct { Name string; Children []xreflect.Forward } cannot be converted to type []xreflect.Forward

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions