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 dependency is met (but not actually satisfied) #134

Closed
mbd-s opened this issue Apr 26, 2023 · 2 comments · Fixed by #135
Closed

Go dependency is met (but not actually satisfied) #134

mbd-s opened this issue Apr 26, 2023 · 2 comments · Fixed by #135

Comments

@mbd-s
Copy link
Contributor

mbd-s commented Apr 26, 2023

This isn't really a bug, but I found this behavior surprising and thought it might be worthwhile to raise it here :)

I use asdf to manage go, among other things. The directory where I'm using m1-terraform-provider-helper isn't a go project, and I also don't have a global go version set. So even though m1-terraform-provider-helper's go dependency is satisfied via Homebrew, there's no go executable in my path. When I run any m1-terraform-provider-helper commands, it raises a panic because there's no GOPATH:

$ m1-terraform-provider-helper activate
panic: exit status 126

goroutine 1 [running]:
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.GetCurrentGoPath()
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/utils.go:15 +0xf8
github.com/kreuzwerker/m1-terraform-provider-helper/internal/app.New()
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/internal/app/app.go:48 +0x54
github.com/kreuzwerker/m1-terraform-provider-helper/cmd.activateCmd.func1(0x14000192900?, {0x1012d0702?, 0x0?, 0x0?})
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/activate.go:14 +0x1c
github.com/spf13/cobra.(*Command).execute(0x14000192900, {0x10191cfa8, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x14000192300)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
main.main()
	/home/runner/work/m1-terraform-provider-helper/m1-terraform-provider-helper/cmd/m1-terraform-provider-helper/main.go:11 +0x20

When I set an arbitrary go version or uninstall the asdf golang plugin entirely (so it falls back to /opt/homebrew/bin/go), the command runs as expected.

I can see that this has caused issues before, so even though this isn't a problem with m1-terraform-provider-helper per se, I'm wondering if it's possible to make the dependency more clear in the docs. Maybe something like what you wrote in the above-linked issue: "You need to have a go setup (because we use go to actually build the provider."

Your Environment

  • OS: macOS 13.3.1
  • m1-terraform-provider-helper version: 0.8.2
@mbd-s
Copy link
Contributor Author

mbd-s commented Apr 26, 2023

I'm happy to open a PR for this if you're interested

@Junkern
Copy link
Contributor

Junkern commented Apr 27, 2023

You are totally right. We should note down in the readme, that you need to have go setup. Feel free to open a PR, that would help tremendously :)

@mbd-s mbd-s mentioned this issue May 8, 2023
2 tasks
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

Successfully merging a pull request may close this issue.

2 participants