Closed ivanov closed 7 years ago
Ah, that is super painful - I am very sorry. I've done this (not using Ponzu) on my Go src directory and lost a ton of non-hosted code. It hurts.
@martint17r - while you're working on the CLI updates, do you think this example is reason to put some kind of requirements in place for the new
subcommand? The issue above was caused by the "." path supplied as the project name/path. Since all Ponzu projects are created in the $GOPATH/src directory, it wiped out the whole workspace.
The requirements would be:
new
Why do you think? @ivanov - please feel free to share your thoughts as well.
@nilslice Just before asking Path exists, overwrite contents? (y/N):
would be nice to output the given and resolved path, so it would be like:
Selected path: '/Users/pi/code/go/src'
Path exists, overwrite contents? (y/N):
This could be an extra alert to the user, so he's sure what's he doing.
Also, absolutely blocking the creation of projects in exactly $GOPATH
would be useful.
@Sirikon - definitely agree printing the target path is a good call.
@martint17r, if you can squeeze this into your PR, it would be much appreciated! Happy to discuss specifics about the implementation if you'd like.
I agree that printing the target path before confirmation would have helped.
Also 👍 to not allowing the creation of projects at precisely $GOPATH - I can imagine someone else stubbing their toe on that by some other accidental means (while trying to use a shell variable that's mis-formed, for example).
(I'm slowly rebuilding on my end, thanks for the kind words and support. I guess I can truly call myself a go getter today ;) )
I agree that printing the target path before confirmation would have helped.
Ok, let's definitely add the target path to the output when confirming an overwrite. @martint17r - let me know once you have some time to look at this & we can figure out specifics.
@ivanov - I feel really bad about this.. since the beginning of the project, I have tried to put in safe-guards to circumvent something like this from happening, so it feels like a personal failure! I hope you recover all of your important code and if not, that it isn't too much of a burden on you.
For what it is worth, I appreciate you being a positive influence on the project by reporting the issue and helping us determine a better UX... not jumping in just to shame it - although it would be understandable ;)
(I'm slowly rebuilding on my end, thanks for the kind words and support. I guess I can truly call myself a go getter today ;) )
:rofl: a go getter you are indeed... very sorry again that this happened!
Thankfully, very little of my own code was lost - I essentially use the go workspace for dependencies and projects I'm building on top of, but my own code lives in separate git repos elsewhere. So I guess pretty much all that was lost was not mine to begin with, I was just living off of borrowed bits :)
Glad that you all are receptive to making changes on this front 👍 . I'll go poke around and see if I can find another footgun somewhere... :feelsgood: :grin: :bowtie:
So there I was, in a random directory, trying to initialize ponzu....
and now
I won't be the only one to make this mistake. Let my stupidity be a warning to others.