Skip to content

Use (format-dune-file) instead of dune format-dune-file #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nojb
Copy link

@nojb nojb commented Apr 4, 2025

Hello,

You are currently calling dune format-dune-file from one of your tests. This command does not honour the Dune lang version used in the project which means that your test will break whenever we change the formatting style in Dune.

In Dune 3.18 we introduced a built-in action (format-dune-file <src> <dst>) precisely for this purpose. This action honours the current Dune lang version and does not require shelling out to an external process.

Note that dune format-dune-file may evolve in ways that may not be backwards compatible in the near future (as the CLI interface does not have any backwards compatibility or versioning guarantees), so we are encouraging users of this command to switch to the action instead.

See ocaml/dune#10892 (comment) for some of the context.

@maiste
Copy link

maiste commented Apr 8, 2025

Thanks @nojb!
I was about to do it today but you were clearly faster 😄

One question I have regarding this: shouldn't it add a dependency on dune >= 3.18 to make sure it supports the functionality?

@nojb
Copy link
Author

nojb commented Apr 8, 2025

Thanks @nojb! I was about to do it today but you were clearly faster 😄

One question I have regarding this: shouldn't it add a dependency on dune >= 3.18 to make sure it supports the functionality?

Yes, indeed. I pushed a fix (I think ; I am not very familiar with OPAM).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants