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

     1  // This is a package for testing comment placement by go/printer.
     2  package main
     3  
     4  // The SZ struct; it is empty.
     5  type SZ struct{}
     6  
     7  // The S0 struct; no field is exported.
     8  type S0 struct {
     9  	// contains filtered or unexported fields
    10  }
    11  
    12  // The S1 struct; some fields are not exported.
    13  type 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.
    21  type S2 struct {
    22  	S1
    23  	A, B, C	float	// 3 exported fields
    24  }
    25  
    26  // The IZ interface; it is empty.
    27  type SZ interface{}
    28  
    29  // The I0 interface; no method is exported.
    30  type I0 interface {
    31  	// contains filtered or unexported methods
    32  }
    33  
    34  // The I1 interface; some methods are not exported.
    35  type 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.
    42  type 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.
    49  type 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  }
    56  

View as plain text