Skip to content

Conversation

@artemklevtsov
Copy link

This commit adds slice type when used in the struct field.

Should fix #36 and #45.

To reproduce:

package main

import (
	"github.com/kr/pretty"
)

type MyObj struct {
	Name   string
	Fields []MyField
}

type MyField struct {
	Name string
}

func main() {
	o := MyObj{
		Name: "xxx",
		Fields: []MyField{
			{
				Name: "fff",
			},
		},
	}

	pretty.Println(o)
}

Before:

main.MyObj{
    Name:   "xxx",
    Fields: {
        {Name:"fff"},
    },
}

after:

main.MyObj{
    Name:   "xxx",
    Fields: []main.MyField{
        {Name:"fff"},
    },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arrays don't round-trip

1 participant