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

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

View as plain text