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

go command required, not found #137

Open
jniewt opened this issue Sep 14, 2023 · 19 comments
Open

go command required, not found #137

jniewt opened this issue Sep 14, 2023 · 19 comments

Comments

@jniewt
Copy link

jniewt commented Sep 14, 2023

Installed with snap and now I'm getting:

Failed to fix file: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:

even though go (1.19) is in my $PATH.

@incu6us
Copy link
Owner

incu6us commented Sep 14, 2023

please, more details:

  • version of the tool;
  • cli command with all parameters;
  • full output

@jniewt
Copy link
Author

jniewt commented Sep 14, 2023

Sorry. There you go:

version: 3.4.5
build with:
tag: v3.4.5
commit: 607f2e6
source: https://github.com/incu6us/goimports-reviser

Command:
/var/lib/snapd/snap/bin/goimports-reviser -rm-unused -company-prefixes foo.com -format -recursive .

Output:
2023/09/14 15:07:07 Failed to fix directory .: failed to walk dif: failed to fix: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:

I should add I'm trying to move from an older version that doesn't have the version flag, so no idea what version it was, but the command parameters worked there flawlessly. I tried to update with go install but had some problems there so I used snap.

@incu6us
Copy link
Owner

incu6us commented Sep 15, 2023

what shows you:

  • go version
  • which go
  • echo $PATH

?

@jniewt
Copy link
Author

jniewt commented Sep 15, 2023

$ go version
go version go1.19.12 linux/amd64
$ which go
/usr/bin/go
$ echo $PATH
/home/foo/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/var/lib/snapd/snap/bin:/home/foo/go/bin:/home/foo/.local/share/JetBrains/Toolbox/scripts

@incu6us
Copy link
Owner

incu6us commented Sep 15, 2023

try to use:

PATH=$PATH:/usr/bin /var/lib/snapd/snap/bin/goimports-reviser -rm-unused -format -recursive .

@jniewt
Copy link
Author

jniewt commented Sep 15, 2023

It's still the same error unfortunately.

@incu6us
Copy link
Owner

incu6us commented Sep 15, 2023

Your issue is related to configuration of your Snapd. Unfortunately, can't suggest what is wrong on your host with Snap. Reinstall the tool using go command

go install -v github.com/incu6us/goimports-reviser/v3@latest

@jniewt
Copy link
Author

jniewt commented Sep 15, 2023

Any idea why this happens then?

$ go clean -modcache
$ go install -v github.com/incu6us/goimports-reviser/v3@latest
go: downloading github.com/incu6us/goimports-reviser/v3 v3.4.5
go: downloading github.com/incu6us/goimports-reviser v0.1.6

I can't seem to be able to get the right binary out of this, it doesn't even have the -version option. That's why I tried snap in the first place, because then at least I get the v3 binary.

@incu6us
Copy link
Owner

incu6us commented Oct 15, 2023

v1 is fetched because of linter package inside the project. it is ok. try to install the tool using go and run goimports-reviser with version parameter

@incu6us
Copy link
Owner

incu6us commented Oct 16, 2023

my bad. don't use version if you're installing the tool using go. just use below line to install the latest version

go install -v github.com/incu6us/goimports-reviser/v3@latest

@incu6us
Copy link
Owner

incu6us commented Nov 25, 2023

@jniewt have you had a chance to resolve it on you environment?

@jniewt
Copy link
Author

jniewt commented Nov 26, 2023 via email

@elbert-chan
Copy link

I installed goimports-reviser with go (go install -v github.com/incu6us/goimports-reviser/v3@latest) . but I got the same error when i configure it in goland.

@incu6us
Copy link
Owner

incu6us commented Dec 7, 2023

@elbert-chan is it working from cli? not via your IDE?

@elbert-chan
Copy link

@elbert-chan is it working from cli? not via your IDE?

yes, cli is working. but IDE(goland) is not.

@jniewt
Copy link
Author

jniewt commented Dec 14, 2023

I removed all files concerning goimports-reviser from my system and installed it with: go install -v github.com/incu6us/goimports-reviser/v3@latest (from the terminal window within Goland IDE). The resulting binary still doesn't have the -version flag, but it doesn't complain anymore about go.mod containing toolchain keyword, so I don't know what to make of it. It seems I have the new version now...?

@incu6us
Copy link
Owner

incu6us commented Dec 14, 2023

I removed all files concerning goimports-reviser from my system and installed it with: go install -v github.com/incu6us/goimports-reviser/v3@latest (from the terminal window within Goland IDE). The resulting binary still doesn't have the -version flag, but it doesn't complain anymore about go.mod containing toolchain keyword, so I don't know what to make of it. It seems I have the new version now...?

yes. it is the latest version

@hiyced
Copy link

hiyced commented Jul 1, 2024

@jniewt Have you solved your problem? I'm having the same issue.

@hiyced
Copy link

hiyced commented Jul 1, 2024

just solved my problem, need to add go/libexec to $PATH

@jniewt Have you solved your problem? I'm having the same issue.

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

4 participants