| 1 |
// Copyright 2014 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 blank is a go/doc test for the handling of _. |
| 6 |
// See issue 5397. |
| 7 |
package blank |
| 8 |
|
| 9 |
import "os" |
| 10 |
|
| 11 |
type T int |
| 12 |
|
| 13 |
// T constants counting from a blank constant. |
| 14 |
const ( |
| 15 |
_ T = iota |
| 16 |
T1 |
| 17 |
T2 |
| 18 |
) |
| 19 |
|
| 20 |
// T constants counting from unexported constants. |
| 21 |
const ( |
| 22 |
tweedledee T = iota |
| 23 |
tweedledum |
| 24 |
C1 |
| 25 |
C2 |
| 26 |
alice |
| 27 |
C3 |
| 28 |
redQueen int = iota |
| 29 |
C4 |
| 30 |
) |
| 31 |
|
| 32 |
// Constants with a single type that is not propagated. |
| 33 |
const ( |
| 34 |
zero os.FileMode = 0 |
| 35 |
Default = 0644 |
| 36 |
Useless = 0312 |
| 37 |
WideOpen = 0777 |
| 38 |
) |
| 39 |
|
| 40 |
// Constants with an imported type that is propagated. |
| 41 |
const ( |
| 42 |
zero os.FileMode = 0 |
| 43 |
M1 |
| 44 |
M2 |
| 45 |
M3 |
| 46 |
) |
| 47 |
|
| 48 |
// Package constants. |
| 49 |
const ( |
| 50 |
_ int = iota |
| 51 |
I1 |
| 52 |
I2 |
| 53 |
) |
| 54 |
|
| 55 |
// Unexported constants counting from blank iota. |
| 56 |
// See issue 9615. |
| 57 |
const ( |
| 58 |
_ = iota |
| 59 |
one = iota + 1 |
| 60 |
) |
| 61 |
|
| 62 |
// Blanks not in doc output: |
| 63 |
|
| 64 |
// S has a padding field. |
| 65 |
type S struct { |
| 66 |
H uint32 |
| 67 |
_ uint8 |
| 68 |
A uint8 |
| 69 |
} |
| 70 |
|
| 71 |
func _() {} |
| 72 |
|
| 73 |
type _ T |
| 74 |
|
| 75 |
var _ = T(55) |