Wrong go command executed under-the-hood
akrymets opened this issue · comments
Expected Behavior
{Please write here}
...
Successfully installed hashicorp/random v3.3.2
Actual Behavior
TF_HELPER_LOG=info m1-terraform-provider-helper install hashicorp/random -v v3.3.2
Getting provider data from terraform registry
2023/10/22 00:05:53 Getting provider data from https://registry.terraform.io/v1/providers/hashicorp/random
2023/10/22 00:05:53 Provider data: {https://github.com/hashicorp/terraform-provider-random terraform-provider-random}
Getting source code...
2023/10/22 00:05:53 Extracted repo https://github.com/hashicorp/terraform-provider-random to terraform-provider-random
INFO[0000] Plain open /Users/user/.m1-terraform-provider-helper/terraform-provider-random
2023/10/22 00:05:53 Resetting /Users/user/.m1-terraform-provider-helper/terraform-provider-random and pulling latest changes
INFO[0001] Bash execution output: Your branch is up to date with 'origin/main'.
Already up to date.
INFO[0001] Checking out v3.3.2
Compiling...
INFO[0001] Using build command: make build
INFO[0002] Bash execution output: go build -v ./...
INFO[0002] Bash execution output: Terraform v1.5.2
on darwin_arm64
Your version of Terraform is out of date! The latest version
is 1.6.2. You can update by downloading from https://www.terraform.io/downloads.html
INFO[0002] Installed Terraform version: 1.5.2
INFO[0002] No custom build path found
INFO[0002] Move from /Users/user/go/bin/terraform-provider-random to /Users/user/.terraform.d/plugins/registry.terraform.io/hashicorp/random/3.3.2/darwin_arm64/terraform-provider-random_3.3.2_x5
2023/10/22 00:05:55 rename /Users/user/go/bin/terraform-provider-random /Users/user/.terraform.d/plugins/registry.terraform.io/hashicorp/random/3.3.2/darwin_arm64/terraform-provider-random_3.3.2_x5: no such file or directory
Steps to Reproduce (including precondition)
Simply run
m1-terraform-provider-helper install hashicorp/random -v v3.3.2
I noticed following lines in the log:
INFO[0001] Using build command: make build
INFO[0002] Bash execution output: go build -v ./...
These 3 trailig dots in go build -v ./...
command look weird.
If I simply execute go build -v .
command in the repository folder /Users/user/.m1-terraform-provider-helper/terraform-provider-random
then everything works fine, and the provider gets built (I achieve the expected behavior)
Your Environment
- OS: MacOS Sonoma 14.0
- m1-terraform-provider-helper version: 0.9.0
Hey.
I've encountered this bug, also. As a workaround, I've added this line to my .zshrc
:
export GOFLAGS="-o=$HOME/go/bin/"
This will make go
output binaries to your $HOME/go/bin
folder.
AFAIK, the default build command doesn't produce any executable because by default, go
outputs it to the STDOUT.