Issues
嵌套结构体,检测成员未使用
出错模块: structcheck
Example
package main
import "fmt"
type Meta struct {
a, A string
}
type WrapMeta struct {
Meta
}
func (m *Meta) run() {
w := WrapMeta{
Meta: *m,
}
defer func() {
fmt.Println(w.a, w.A)
}()
w.assign()
}
func (wm *WrapMeta) assign() {
wm.a = "aa"
wm.A = "AA"
}
func main() {
m := &Meta{}
m.run()
}
Result
$ golangci-lint run ./...
main.go:6:2: `a` is unused (structcheck)
a, A string
^