Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sqlc should avoid updating file mtimes if the contents have not changed #4078

Open
Labels
enhancementNew feature or request
@n-oden

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /