Closed JamieBallingall closed 5 years ago
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
?
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.
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 👍
I often mistakenly run
spago build
from some subdirectory. This, correctly, fails with a message about missingpackages.dhall
. However, it also creates a newspago.dhall
file in the current directory. It would be nice if it didn't.