github.com/AndrienkoAleksandr/go@v0.0.19/src/go/doc/testdata/c.go (about)

     1  // Copyright 2012 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 c
     6  
     7  import "a"
     8  
     9  // ----------------------------------------------------------------------------
    10  // Test that empty declarations don't cause problems
    11  
    12  const ()
    13  
    14  type ()
    15  
    16  var ()
    17  
    18  // ----------------------------------------------------------------------------
    19  // Test that types with documentation on both, the Decl and the Spec node
    20  // are handled correctly.
    21  
    22  // A (should see this)
    23  type A struct{}
    24  
    25  // B (should see this)
    26  type (
    27  	B struct{}
    28  )
    29  
    30  type (
    31  	// C (should see this)
    32  	C struct{}
    33  )
    34  
    35  // D (should not see this)
    36  type (
    37  	// D (should see this)
    38  	D struct{}
    39  )
    40  
    41  // E (should see this for E2 and E3)
    42  type (
    43  	// E1 (should see this)
    44  	E1 struct{}
    45  	E2 struct{}
    46  	E3 struct{}
    47  	// E4 (should see this)
    48  	E4 struct{}
    49  )
    50  
    51  // ----------------------------------------------------------------------------
    52  // Test that local and imported types are different when
    53  // handling anonymous fields.
    54  
    55  type T1 struct{}
    56  
    57  func (t1 *T1) M() {}
    58  
    59  // T2 must not show methods of local T1
    60  type T2 struct {
    61  	a.T1 // not the same as locally declared T1
    62  }