Fix the logic to detect recursive struct types, which was giving a false positive. We now use the local type name as key in tracker map. A non-regression test case is included (_test/struct49.go). This completes #1008.
42 lines
379 B
Go
42 lines
379 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type A struct {
|
|
B map[string]*B
|
|
C map[string]*C
|
|
}
|
|
|
|
type C struct {
|
|
D *D
|
|
E *E
|
|
}
|
|
|
|
type D struct {
|
|
F *F
|
|
G []G
|
|
}
|
|
|
|
type E struct {
|
|
H []H
|
|
F *F
|
|
}
|
|
|
|
type B struct{}
|
|
type F struct{}
|
|
type G struct{}
|
|
type H struct{}
|
|
|
|
func main() {
|
|
conf := &A{
|
|
B: make(map[string]*B),
|
|
C: make(map[string]*C),
|
|
}
|
|
fmt.Println(conf)
|
|
}
|
|
|
|
// Output:
|
|
// &{map[] map[]}
|