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

xk6 should not put k6 binary in the k6/k6 if k6 is a directory #3

Open
mstoykov opened this issue Nov 30, 2020 · 2 comments
Open

xk6 should not put k6 binary in the k6/k6 if k6 is a directory #3

mstoykov opened this issue Nov 30, 2020 · 2 comments

Comments

@mstoykov
Copy link
Contributor

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 ?

@imiric
Copy link
Contributor

imiric commented Dec 1, 2020

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.

@mstoykov
Copy link
Contributor Author

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

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

No branches or pull requests

2 participants