github.com/flyinox/gosm@v0.0.0-20171117061539-16768cb62077/src/go/doc/testdata/b.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 b
     6  
     7  import "a"
     8  
     9  // ----------------------------------------------------------------------------
    10  // Basic declarations
    11  
    12  const Pi = 3.14   // Pi
    13  var MaxInt int    // MaxInt
    14  type T struct{}   // T
    15  var V T           // v
    16  func F(x int) int {} // F
    17  func (x *T) M()   {} // M
    18  
    19  // Corner cases: association with (presumed) predeclared types
    20  
    21  // Always under the package functions list.
    22  func NotAFactory() int {}
    23  
    24  // Associated with uint type if AllDecls is set.
    25  func UintFactory() uint {}
    26  
    27  // Associated with uint type if AllDecls is set.
    28  func uintFactory() uint {}
    29  
    30  // Should only appear if AllDecls is set.
    31  type uint struct{} // overrides a predeclared type uint
    32  
    33  // ----------------------------------------------------------------------------
    34  // Exported declarations associated with non-exported types must always be shown.
    35  
    36  type notExported int
    37  
    38  const C notExported = 0
    39  
    40  const (
    41  	C1 notExported = iota
    42  	C2
    43  	c3
    44  	C4
    45  	C5
    46  )
    47  
    48  var V notExported
    49  var V1, V2, v3, V4, V5 notExported
    50  
    51  var (
    52  	U1, U2, u3, U4, U5 notExported
    53  	u6                 notExported
    54  	U7                 notExported = 7
    55  )
    56  
    57  func F1() notExported {}
    58  func f2() notExported {}