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

Aqua managed gopls is causing termination of VSCode #1597

Closed
sheldonhull opened this issue Jan 30, 2023 · 12 comments
Closed

Aqua managed gopls is causing termination of VSCode #1597

sheldonhull opened this issue Jan 30, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@sheldonhull
Copy link

sheldonhull commented Jan 30, 2023

aqua version

Please use the latest version.

aqua version 1.32.0 (aacad331354797eed1acbab454f25e4423129f58)

Environment

  • macOS
  • amd64

Ran into a similar situation with gopls installed via vscode causing termination of VSCode. I installed Go via Brew, and made it the priority on my PATH variable and confirmed the issue was not present when brew installed Go.

Is there a way to opt out of proxy behavior for certain packages to ensure it works and this doesn't happen again?

I did not set any experimental flags either.

Reported Issue: golang/vscode-go#2625

Please let me know what info would be useful for your diagnosing further.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Jan 30, 2023

I guess this issue is related.

Is there a way to opt out of proxy behavior for certain packages to ensure it works and this doesn't happen again?

You can change the behavior by setting the environment variable AQUA_EXPERIMENTAL_X_SYS_EXEC.

$ export AQUA_EXPERIMENTAL_X_SYS_EXEC=true

https://aquaproj.github.io/docs/reference/experimental-feature/#aqua_experimental_x_sys_exec

But this flag affects not only specific packages but also all packages.

And this feature has a known issue on macOS.

We haven't investigated this issue for a long time, so I'm not sure the current status of this issue.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Jan 31, 2023

Maybe the following alias works.

alias gopls="$(aqua which gopls)"

aqua which returns an absolute path of the command, so gopls is run directly.
But I'm not sure vscode reads shell configuration such as .bashrc and .zshrc.

Or adding the following script gopls in PATH may work.

#!/usr/bin/env bash

exec "$(aqua which gopls)" "$@"

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Jan 31, 2023

And I'm considering enabling AQUA_EXPERIMENTAL_X_SYS_EXEC against only specific tools such as gopls internally.
I have never heard this issue other than gopls, so maybe we can enable AQUA_EXPERIMENTAL_X_SYS_EXEC against only gopls.

AQUA_EXPERIMENTAL_X_SYS_EXEC is disabled by default because there is a known issue, but if we restrict packages maybe we can enable the feature.

@suzuki-shunsuke suzuki-shunsuke added the bug Something isn't working label Jan 31, 2023
@sheldonhull
Copy link
Author

Maybe the following alias works.

alias gopls="$(aqua which gopls)"

aqua which returns an absolute path of the command, so gopls is run directly.

But I'm not sure vscode reads shell configuration such as .bashrc and .zshrc.

Or adding the following script gopls in PATH may work.

#!/usr/bin/env bash



exec "$(aqua which gopls)" "$@"

I load VSCode code from the terminal so env vars are honored. I also use direnv so I think that would work. I'll give it a shot and report back when I get a chance.

@sheldonhull
Copy link
Author

Any updated recommendation on best practice here? I've had a few crashes with vscode still, but prefer to keep using aqua to install Go.
Without disabling globally any other way I should handle, I'm assuming the snippet or the shell script?

@suzuki-shunsuke
Copy link
Member

Did you try this?
#1597 (comment)

@sheldonhull
Copy link
Author

Let me look again. I flipped for a while to brew managed go, but really wanted to keep things consistent.

Here's the catch though... might be Go, not just gopls.

[🧱 INT] zsh _ ❯ which -a gopls
/Users/sheldon.hull/go/bin/gopls

I don't have gopls through aqua anymore, just Go.
I think Go + VSCode is having a problem but haven't been able to figure it out yet.

I might try the same approach and use a fully qualified name for Go as well and see if that works.

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Apr 21, 2023

Sorry. I guess you have to run not gopls but go directly.

alias go="$(aqua which go)"
#!/usr/bin/env bash

exec "$(aqua which go)" "$@"

And this doesn't work if Go isn't installed yet because aqua which doesn't install the package.
So maybe you have to run go version to ensure go is installed.

#!/usr/bin/env bash

go version > /dev/null 2>&1 # Install Go by lazy install
exec "$(aqua which go)" "$@"

@sheldonhull
Copy link
Author

Using the bash script in place on /usr/local/bin/go I haven't had any crashes that I see so far, so using the qualified path is probably important here. Also providing GOROOT to my aqua installed Go on my command line call before invoking goland or code resolve it not figuring out I'm using aqua managed go. This is good progress.

It's a bit clunky so do you have any ideas to solve in aqua itself so folks can easily rely on Aqua for managing their Go installs without any workarounds?

@suzuki-shunsuke
Copy link
Member

Thank you for your feedback. Sounds good.

It's a bit clunky so do you have any ideas to solve in aqua itself so folks can easily rely on Aqua for managing their Go installs without any workarounds?

#1597 (comment)

#1597 (comment)

On Linux AQUA_EXPERIMENTAL_X_SYS_EXEC would solve the issue.
I'll take a look if #729 is solved.
And I also consider #1597 (comment)

@sheldonhull
Copy link
Author

I'm on macOS, so unfortunately that option isn't viable. I want to make sure it works for both Linux + macOS due to the users I'm helping. Thanks again!

@suzuki-shunsuke
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants