`Package comment`,
`const ExportedConstant = 1`, // Simple constant.
`const ConstOne = 1`, // First entry in constant block.
+ `const ConstFive ...`, // From block starting with unexported constant.
`var ExportedVariable = 1`, // Simple variable.
`var VarOne = 1`, // First entry in variable block.
`func ExportedFunc\(a int\) bool`, // Function.
`Comment before VarOne`, // No comment for first entry in variable block.
`ConstTwo = 2`, // No second entry in constant block.
`VarTwo = 2`, // No second entry in variable block.
+ `VarFive = 5`, // From block starting with unexported variable.
`type unexportedType`, // No unexported type.
`unexportedTypedConstant`, // No unexported typed constant.
`Field`, // No fields.
// valueSummary prints a one-line summary for each set of values and constants.
func (pkg *Package) valueSummary(values []*doc.Value) {
for _, value := range values {
- // Only print first item in spec, show ... to stand for the rest.
- spec := value.Decl.Specs[0].(*ast.ValueSpec) // Must succeed.
- exported := true
- for _, name := range spec.Names {
- if !isExported(name.Name) {
- exported = false
- break
- }
- }
- if exported {
- pkg.oneLineValueGenDecl(value.Decl)
- }
+ pkg.oneLineValueGenDecl(value.Decl)
}
}
constThree = 3 // Comment on line with constThree.
)
+// Const block where first entry is unexported.
+const (
+ constFour = iota
+ ConstFive
+ ConstSix
+)
+
// Variables
// Comment about exported variable.
varThree = 3 // Comment on line with varThree.
)
+// Var block where first entry is unexported.
+var (
+ varFour = 4
+ VarFive = 5
+ varSix = 6
+)
+
// Comment about exported function.
func ExportedFunc(a int) bool