add "Code generated by sqlc. DO NOT EDIT." header comment
yshrsmz opened this issue · 3 comments
yshrsmz commented
to prevent devs from editing the generated file.
yshrsmz commented
I can achieve this behavior by just modifying here
const printer = createPrinter({ newLine: NewLineKind.LineFeed });
- let output = "";
+ let output = "// Code generated by sqlc. DO NOT EDIT.\n\n";
for (let node of nodes) {
output += printer.printNode(EmitHint.Unspecified, node, resultFile);
output += "\n\n";
}
return output;But I'm not sure if it's OK or should be handled in another place.
tamsanh commented
Might be better off somewhere that has access to the configuration, so that a user can either turn that comment on or off or can supply their own header, like a copyright string.
kyleconroy commented
The Go code generator adds the header by default and you can't turn it off. I think it's a good idea to always add it.