xk6
xk6 copied to clipboard
xk6 should not put k6 binary in the k6/k6 if k6 is a directory
If there is a directory named k6 in the current directory, xk6 build will put the new k6 binary inside of it, instead of .. erroring out or putting in k6-extented or something like that.
Also maybe have a prompt before replacing files that is overwritten with -y
?
This seems to be an issue with go build
itself. It was fixed for the case when -o
is not specified, it errors out with go build: build output "k6" already exists and is a directory
, but if -o
is specified like we do here then it still creates the binary in that directory.
So I'd rather not add any workarounds for this in xk6 and wait until it's fixed upstream. Feel free to create that Go issue 😄
As for a replacement prompt, not sure if that's needed. I like the current defaults to overwrite without prompting or erroring out, it seems like less hoops to jump through during development.
Given the docs on it
The -o flag forces build to write the resulting executable or object to the named output file or directory, instead of the default behavior described in the last two paragraphs. If the named output is an existing directory or ends with a slash or backslash, then any resulting executables will be written to that directory.
I do think this is the expected way for it. So it seems better if we check if the file we are going to write to exists and whether it's a file