1
0
mirror of https://github.com/mgechev/revive.git synced 2025-10-08 22:41:54 +02:00

fix: rule confusing-naming false positive on multiple blank identifiers (#1536)

This commit is contained in:
Emmanuel Ferdman
2025-10-06 10:13:26 +03:00
committed by GitHub
parent c037639bc0
commit c930786fdb
2 changed files with 19 additions and 0 deletions

View File

@@ -167,6 +167,11 @@ func checkStructFields(fields *ast.FieldList, structName string, w *lintConfusin
bl := make(map[string]bool, len(fields.List))
for _, f := range fields.List {
for _, id := range f.Names {
// Skip blank identifiers
if id.Name == "_" {
continue
}
normName := strings.ToUpper(id.Name)
if bl[normName] {
w.onFailure(lint.Failure{

View File

@@ -81,3 +81,17 @@ type b[T any] struct{}
func (x *b[T]) method() {
}
// Multiple blank identifiers should be allowed (for padding/alignment)
type siginfoChild struct {
signo int32
errno int32
exitCode int32
_ int32
pid int32
uid uint32
status int32
_ [25]uint32
}