| 1 | // Copyright 2022 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 decl |
| 6 | |
| 7 | func a() { |
| 8 | var b, c bool // want `declared (and|but) not used` |
| 9 | panic(c) |
| 10 | |
| 11 | if 1 == 1 { |
| 12 | var s string // want `declared (and|but) not used` |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | func b() { |
| 17 | // b is a variable |
| 18 | var b bool // want `declared (and|but) not used` |
| 19 | } |
| 20 | |
| 21 | func c() { |
| 22 | var ( |
| 23 | d string |
| 24 | |
| 25 | // some comment for c |
| 26 | c bool // want `declared (and|but) not used` |
| 27 | ) |
| 28 | |
| 29 | panic(d) |
| 30 | } |