Skip to content

formatting of maps is invalid go code #45

@awalterschulze

Description

@awalterschulze
package main

import (
	"fmt"

	"github.com/kr/pretty"
)

type A struct {
	B *B
}

type B struct {
	M map[string]string
}

func main() {
	a := &A{B: &B{M: map[string]string{}}}
	fmt.Printf("%# v\n", pretty.Formatter(a))
        //prints out
	/*
		&main.A{
		    B:  &main.B{
		        M:  {},
		    },
		}
	*/
        //This contains a syntax error
	c := &A{
		B: &B{
			M: {},
		},
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions