I used ygot/generator/generator.go to generate the gostruct file using yang files as input.
I have a scenario where following heirarchy of elements causing the error.
/container/choice/case/container/list/leaf (leaf is of leafref type)
I have debugged and found that in api ResolveLeafrefTarget in ygot/yangschema/yangschema.go file
fixedPath, err := fixSchemaTreePath(path, contextEntry) --> here value is fixedPath doesnt has choice and case name which is ended in error of "could not resolve leafref path"
Let me know if this kind of scenario is supported in ygot.