Skip to content
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

Don't create spago.dhall on failed spago build #139

Closed
JamieBallingall opened this issue Mar 13, 2019 · 3 comments
Closed

Don't create spago.dhall on failed spago build #139

JamieBallingall opened this issue Mar 13, 2019 · 3 comments
Labels
Milestone

Comments

@JamieBallingall
Copy link

I often mistakenly run spago build from some subdirectory. This, correctly, fails with a message about missing packages.dhall. However, it also creates a new spago.dhall file in the current directory.
It would be nice if it didn't.

@f-f
Copy link
Member

f-f commented Mar 13, 2019

Hi @JamieBallingall, thanks for the report!

Indeed that's not desiderable. The config gets created due to this line:
https://github.com/spacchetti/spago/blob/b6d5a6345b056c773c9011768e1914493dd97aec/app/Spago/Config.hs#L102

What would a better behaviour be? Should we just fail here and prompt to run spago init?

@f-f f-f added the bug label Mar 13, 2019
@JamieBallingall
Copy link
Author

Honestly, the exact error message displayed isn't that important. It's unlikely that you ran spago build expected something else to happen. You (or, more specifically, I) just forgot which directory I was in. Prompting the user to run spago init would be perfect.

For me the critical thing is that a failed spago build doesn't alter the state of my project in any way.

I suppose we could get fancy and search parent directories for the relevant files and then build the first valid thing we find. I'm deeply ambivalent about that. Might be a little too clever.

@f-f
Copy link
Member

f-f commented Mar 15, 2019

I suppose we could get fancy and search parent directories for the relevant files and then build the first valid thing we find. I'm deeply ambivalent about that. Might be a little too clever.

Yeah stack does that, and I love it because I can build from any subdirectory. It might be fancy, but it's really handy - I'll take a look at their implementation

If it looks too complicated I'll just go with failing and prompting to run spago init.

For me the critical thing is that a failed spago build doesn't alter the state of my project in any way.

Agreed, this is quite important 👍

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

No branches or pull requests

2 participants