nested-structs does not detect a slice of structs
Describe the bug
Rule nested-structs detects this:
go
type Good struct {
Field struct{}
}
but not this:
go
type Bad struct {
Field []struct{}
}
To Reproduce
Steps to reproduce the behavior:
I updated revive go get -u github.com/mgechev/revive
I run it with the following flags & configuration file:
shell
$ cat bug.go
package bug
type Good struct {
Field struct{}
}
type Bad struct {
Field []struct{}
}
$ revive -config <(echo '[rule.nested-structs]') bug.go
bug.go:4:2: no nested structs are allowed
Expected behavior
text
$ revive -config <(echo '[rule.nested-structs]') bug.go
bug.go:4:2: no nested structs are allowed
bug.go:8:2: no nested structs are allowed
Desktop (please complete the following information):
OS: Gentoo Linux
Go: 1.18
You must not search for, open, fetch, view, or copy anything that could reveal this task's reference solution or upstream fix. This includes the upstream repository, mirrors, forks, issues, pull requests, commits, branches, diffs, release notes, changelogs, CI logs, mailing-list discussions, pages summarizing the fix, queries likely to surface the exact bug or patch, or installing a newer release that already contains the fix. Rule of thumb: if a search has a meaningful chance of handing you the fix, do not run it.
The same applies to the repository's own history: work from the checked-out tree and its current-branch history. Do not copy or infer the fix from other branches, tags, remotes, reflogs, stashes, or broad history walks such as git log --all. Ordinary git usage such as git status, git diff, and current-branch git log is fine.