...

Text file src/go/printer/testdata/comments.x

Documentation: go/printer/testdata

     1// This is a package for testing comment placement by go/printer.
     2package main
     3
     4// The SZ struct; it is empty.
     5type SZ struct{}
     6
     7// The S0 struct; no field is exported.
     8type S0 struct {
     9	// contains filtered or unexported fields
    10}
    11
    12// The S1 struct; some fields are not exported.
    13type S1 struct {
    14	S0
    15	A, B, C	float	// 3 exported fields
    16	D	int	// 2 unexported fields
    17	// contains filtered or unexported fields
    18}
    19
    20// The S2 struct; all fields are exported.
    21type S2 struct {
    22	S1
    23	A, B, C	float	// 3 exported fields
    24}
    25
    26// The IZ interface; it is empty.
    27type SZ interface{}
    28
    29// The I0 interface; no method is exported.
    30type I0 interface {
    31	// contains filtered or unexported methods
    32}
    33
    34// The I1 interface; some methods are not exported.
    35type I1 interface {
    36	I0
    37	F(x float) float	// exported methods
    38	// contains filtered or unexported methods
    39}
    40
    41// The I2 interface; all methods are exported.
    42type I2 interface {
    43	I0
    44	F(x float) float	// exported method
    45	G(x float) float	// exported method
    46}
    47
    48// The S3 struct; all comments except for the last one must appear in the export.
    49type S3 struct {
    50	// lead comment for F1
    51	F1	int	// line comment for F1
    52	// lead comment for F2
    53	F2	int	// line comment for F2
    54	// contains filtered or unexported fields
    55}

View as plain text