Yaml: Does not support "inherited" structs

Created on 23 Sep 2014  ·  3Comments  ·  Source: go-yaml/yaml

Given these stucts:

    type Path struct {
        Description string
        Paths       map[string]Path
    }

    type Top struct {
        Title       string
        Path
    }

I should be able to unmarshal a YAML like this:

  title: Recursive
  paths:
    a:
      paths:
        b:
          paths:
            c:
              description: Bottom

This works but should be the same thing as above:

    type Path struct {
        Description string
        Paths       map[string]Path
    }

    type Top struct {
        Title       string
        Paths    map[string]Path
    }

Most helpful comment

You need the ,inline flag for that, as per the documentation:

http://gopkg.in/yaml.v2#Marshal

You can use that flag both on normal and on anonymous fields.

All 3 comments

You need the ,inline flag for that, as per the documentation:

http://gopkg.in/yaml.v2#Marshal

You can use that flag both on normal and on anonymous fields.

:+1: Sorry, I know: RTFM @rnix :gun:

No problem. ;-)

And thanks for submitting the issues. They might well be valid problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niemeyer picture niemeyer  ·  6Comments

thallgren picture thallgren  ·  8Comments

michaelsauter picture michaelsauter  ·  28Comments

rogpeppe picture rogpeppe  ·  7Comments

samsalisbury picture samsalisbury  ·  11Comments