Black Lives Matter. Support the Equal Justice Initiative.

Text file src/go/printer/testdata/complit.input

Documentation: go/printer/testdata

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package complit
     6  
     7  var (
     8  	// Multi-line declarations
     9  	V1 = T{
    10  		F1: "hello",
    11  		f2: 1,
    12  	}
    13  	V2 = T{
    14  		f2: 1,
    15  		F1: "hello",
    16  	}
    17  	V3 = T{
    18  		F1: "hello",
    19  		F2: T2{
    20  			A: "world",
    21  			b: "hidden",
    22  		},
    23  		f3: T2{
    24  			A: "world",
    25  		},
    26  	}
    27  	V4 = T{
    28  		f2: 1,
    29  	}
    30  
    31  	// Single-line declarations
    32  	V5 = T{F1: "hello", f2: 1}
    33  	V6 = T{f2: 1, F1: "hello"}
    34  	V7 = T{f2: 1}
    35  
    36  	// Mixed-mode declarations
    37  	V8 = T{
    38  		F1: "hello", f2: 1,
    39  		F3: "world",
    40  		f4: 2}
    41  	V9 = T{
    42  	f2: 1, F1: "hello",}
    43  	V10 = T{
    44  		F1: "hello", f2: 1,
    45  		f3: 2,
    46  		F4: "world", f5: 3,
    47  	}
    48  
    49  	// Other miscellaneous declarations
    50  	V11 = T{
    51  		t{
    52  			A: "world",
    53  			b: "hidden",
    54  		},
    55  		f2: t{
    56  			A: "world",
    57  			b: "hidden",
    58  		},
    59  	}
    60  	V12 = T{
    61  		F1: make(chan int),
    62  		f2: []int{},
    63  		F3: make(map[int]string), f4: 1,
    64  	}
    65  )

View as plain text