...

Text file src/cmd/gofmt/testdata/composites.golden

Documentation: cmd/gofmt/testdata

     1//gofmt -s
     2
     3package P
     4
     5type T struct {
     6	x, y int
     7}
     8
     9type T2 struct {
    10	w, z int
    11}
    12
    13var _ = [42]T{
    14	{},
    15	{1, 2},
    16	{3, 4},
    17}
    18
    19var _ = [...]T{
    20	{},
    21	{1, 2},
    22	{3, 4},
    23}
    24
    25var _ = []T{
    26	{},
    27	{1, 2},
    28	{3, 4},
    29}
    30
    31var _ = []T{
    32	{},
    33	10: {1, 2},
    34	20: {3, 4},
    35}
    36
    37var _ = []struct {
    38	x, y int
    39}{
    40	{},
    41	10: {1, 2},
    42	20: {3, 4},
    43}
    44
    45var _ = []interface{}{
    46	T{},
    47	10: T{1, 2},
    48	20: T{3, 4},
    49}
    50
    51var _ = [][]int{
    52	{},
    53	{1, 2},
    54	{3, 4},
    55}
    56
    57var _ = [][]int{
    58	([]int{}),
    59	([]int{1, 2}),
    60	{3, 4},
    61}
    62
    63var _ = [][][]int{
    64	{},
    65	{
    66		{},
    67		{0, 1, 2, 3},
    68		{4, 5},
    69	},
    70}
    71
    72var _ = map[string]T{
    73	"foo": {},
    74	"bar": {1, 2},
    75	"bal": {3, 4},
    76}
    77
    78var _ = map[string]struct {
    79	x, y int
    80}{
    81	"foo": {},
    82	"bar": {1, 2},
    83	"bal": {3, 4},
    84}
    85
    86var _ = map[string]interface{}{
    87	"foo": T{},
    88	"bar": T{1, 2},
    89	"bal": T{3, 4},
    90}
    91
    92var _ = map[string][]int{
    93	"foo": {},
    94	"bar": {1, 2},
    95	"bal": {3, 4},
    96}
    97
    98var _ = map[string][]int{
    99	"foo": ([]int{}),
   100	"bar": ([]int{1, 2}),
   101	"bal": {3, 4},
   102}
   103
   104// from exp/4s/data.go
   105var pieces4 = []Piece{
   106	{0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil},
   107	{1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil},
   108	{2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil},
   109	{3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil},
   110}
   111
   112var _ = [42]*T{
   113	{},
   114	{1, 2},
   115	{3, 4},
   116}
   117
   118var _ = [...]*T{
   119	{},
   120	{1, 2},
   121	{3, 4},
   122}
   123
   124var _ = []*T{
   125	{},
   126	{1, 2},
   127	{3, 4},
   128}
   129
   130var _ = []*T{
   131	{},
   132	10: {1, 2},
   133	20: {3, 4},
   134}
   135
   136var _ = []*struct {
   137	x, y int
   138}{
   139	{},
   140	10: {1, 2},
   141	20: {3, 4},
   142}
   143
   144var _ = []interface{}{
   145	&T{},
   146	10: &T{1, 2},
   147	20: &T{3, 4},
   148}
   149
   150var _ = []*[]int{
   151	{},
   152	{1, 2},
   153	{3, 4},
   154}
   155
   156var _ = []*[]int{
   157	(&[]int{}),
   158	(&[]int{1, 2}),
   159	{3, 4},
   160}
   161
   162var _ = []*[]*[]int{
   163	{},
   164	{
   165		{},
   166		{0, 1, 2, 3},
   167		{4, 5},
   168	},
   169}
   170
   171var _ = map[string]*T{
   172	"foo": {},
   173	"bar": {1, 2},
   174	"bal": {3, 4},
   175}
   176
   177var _ = map[string]*struct {
   178	x, y int
   179}{
   180	"foo": {},
   181	"bar": {1, 2},
   182	"bal": {3, 4},
   183}
   184
   185var _ = map[string]interface{}{
   186	"foo": &T{},
   187	"bar": &T{1, 2},
   188	"bal": &T{3, 4},
   189}
   190
   191var _ = map[string]*[]int{
   192	"foo": {},
   193	"bar": {1, 2},
   194	"bal": {3, 4},
   195}
   196
   197var _ = map[string]*[]int{
   198	"foo": (&[]int{}),
   199	"bar": (&[]int{1, 2}),
   200	"bal": {3, 4},
   201}
   202
   203var pieces4 = []*Piece{
   204	{0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil},
   205	{1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil},
   206	{2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil},
   207	{3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil},
   208}
   209
   210var _ = map[T]T2{
   211	{1, 2}: {3, 4},
   212	{5, 6}: {7, 8},
   213}
   214
   215var _ = map[*T]*T2{
   216	{1, 2}: {3, 4},
   217	{5, 6}: {7, 8},
   218}

View as plain text