-
Notifications
You must be signed in to change notification settings - Fork 922
Description
What do you want to change?
Presently, sqlc writes its generated output to all of its output files under all circumstances.
This is problematic in a number of scenarios. In any case where you are generating code with tools outside the primary go toolchain at any scale, you will probably be orchestrating that process with a build tool, e.g. gnu make, cmake, bazel etc. And one of the primary ways build tools (especially make
derivatives) attempt to cut down on build times is to trigger actions by comparing modification times between files: if foo.h or foo.cc have been modified more recently than foo.o, then foo.o needs to be recompiled.
The specific example that is currently a thorn in my side is using sqlc and mockgen together: mockgen is slow, so we try to run it only when necessary, and have wrapped it in a harness that compares file mtimes to see when it actually needs to fire. But because sqlc always rewrites its output files, we always regenerate our sql mocks even when there's no need to.
#3980 is an attempt to rectify this; I would appreciate feedback!
What database engines need to be changed?
None
What programming language backends need to be changed?
None