Debian Codegraph @

go/analysis/passes/ifaceassert/doc.go

raw symbols SCIP
1 // Copyright 2023 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 ifaceassert defines an Analyzer that flags
6 // impossible interface-interface type assertions.
7 //
8 // # Analyzer ifaceassert
9 //
10 // ifaceassert: detect impossible interface-to-interface type assertions
11 //
12 // This checker flags type assertions v.(T) and corresponding type-switch cases
13 // in which the static type V of v is an interface that cannot possibly implement
14 // the target interface T. This occurs when V and T contain methods with the same
15 // name but different signatures. Example:
16 //
17 // var v interface {
18 // Read()
19 // }
20 // _ = v.(io.Reader)
21 //
22 // The Read method in v has a different signature than the Read method in
23 // io.Reader, so this assertion cannot succeed.
24 package ifaceassert