diff options
Diffstat (limited to 'gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go')
-rw-r--r-- | gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go new file mode 100644 index 000000000..8e843024a --- /dev/null +++ b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go @@ -0,0 +1,30 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package decl + +func a() { + var b, c bool // want `b declared (and|but) not used` + panic(c) + + if 1 == 1 { + var s string // want `s declared (and|but) not used` + } +} + +func b() { + // b is a variable + var b bool // want `b declared (and|but) not used` +} + +func c() { + var ( + d string + + // some comment for c + c bool // want `c declared (and|but) not used` + ) + + panic(d) +} |