Open posener opened 7 years ago
Just wanted to chime in that I'm also running into this issue.
Here's another example
package foo
//go:generate ffjson foo.go
type props struct {
Series map[int][]*series `json:"series"`
}
type series struct {
Name string `json:"name"`
}
which after running go generate ./...
creates this snippet of code which does not compile
if tok == fflib.FFTok_null {
j.Series = nil
} else {
j.Series = make(map[int][]*foo.series, 0)
wantVal := true
for {
var k int
var tmpJSeries []*foo.series
tok = fs.Scan()
if tok == fflib.FFTok_error {
goto tokerror
$ go build ./...
# github.com/drew-richardson/foo
foo/foo_ffjson.go:182:31: undefined: foo
foo/foo_ffjson.go:190:23: undefined: foo
arichard@gentoo:~/dist/go>
I believe the correct code may be j.Series = make(map[int][]*series, 0)
and j.Series = make(map[int][]*series, 0)
For the following go file:
running ffjson results in a go file that can't be compiled:
Notice the
bug.Obj
which should be justObj
. Thanks