| 1 | // Copyright 2016 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 doc tests that Go documentation is transferred |
| 6 | // to the generated code. |
| 7 | package doc |
| 8 | |
| 9 | // F is a function. |
| 10 | func F() {} |
| 11 | |
| 12 | // C is a constant. |
| 13 | const C = true |
| 14 | |
| 15 | // V is a var. |
| 16 | var V string |
| 17 | |
| 18 | // A group of vars. |
| 19 | var ( |
| 20 | // A specific var. |
| 21 | Specific string |
| 22 | NoDocVar float64 |
| 23 | ) |
| 24 | |
| 25 | // Before is a method. |
| 26 | func (_ *S) Before() {} |
| 27 | |
| 28 | // S is a struct. |
| 29 | type S struct { |
| 30 | // SF is a field. |
| 31 | SF string |
| 32 | // blank (unexported) field. |
| 33 | _ string |
| 34 | // Anonymous field. |
| 35 | *S2 |
| 36 | // Multiple fields. |
| 37 | F1, F2 string |
| 38 | } |
| 39 | |
| 40 | // After is another method. |
| 41 | func (_ *S) After() {} |
| 42 | |
| 43 | // A generic comment with <HTML>. |
| 44 | type ( |
| 45 | // S2 is a struct. |
| 46 | S2 struct{} |
| 47 | NoDoc struct{} |
| 48 | ) |
| 49 | |
| 50 | // NewS is a constructor. |
| 51 | func NewS() *S { |
| 52 | return nil |
| 53 | } |
| 54 | |
| 55 | // I is an interface. |
| 56 | type I interface { |
| 57 | // IM is a method. |
| 58 | IM() |
| 59 | } |