schema/gen/go: please vet a bit more
In particular, this removes ~50 out of the 2.7k warnings in 'go vet ./...' in this repository. Mainly, the "unreachable code" ones. This was caused by edge cases in some of the generated code which caused an unconditional return or panic statement to be followed by other code. Fix all of them with a bit more template logic. Some of the Next methods go a bit further. If they serve no purpose as the switch has no cases to be matched, just unconditionally return an error. In the future we can perhaps reuse a single function for that. Finally, I was having a hard time actually following the logic in kindedUnionNodeAssemblerMethodTemplateMunge, so I've indented the code a bit to follow the template logic and scoping. These changes move us towards pleasing vet, which is nice, but also make the code waste a bit less space.
Showing
This diff is collapsed.
Please register or sign in to comment