Closed queglay closed 4 years ago
Hi @queglay! It looks like your vagrant development environment is set up in "GOPATH
mode", which is the older development model prior to the introduction of Go Modules. The pre-modules mode does not support there being multiple selectable versions of a module, so it only knows how to select the v1 release of HCL, and cannot install the v2 release which this tool (and Terraform) uses.
You can build this tool in modules mode as follows:
git clone
this repository outside of your GOPATH
directory (anywhere other than under /home/vagrant/go/src
in your case, it seems)go install
to build the executable to $GOPATH/bin/terraform-clean-syntax
.I started out seeing the same "cannot find package" error.
Following your steps @apparentlymart , I end-up with this error instead:
$ go install
go: finding github.com/hashicorp/hcl/v2 v2.1.1-0.20191206020329-84e71e9393a0
go: github.com/hashicorp/hcl/v2@v2.1.1-0.20191206020329-84e71e9393a0: unknown revision 84e71e9393a0
go: error loading module requirements
So, not able to try out this nifty tool.
Hmm I had switched the version of hcl/v2
here to point at a specific commit in order to get an upstream HCL fix that wasn't merged yet, but it seems like now that the fix is merged that commit doesn't lead anywhere anymore.
Since that fix has now been included in a release I'll flip this codebase over to depend on HCL's v2.2.0 release tag rather than this commit 84e71e9393a0
.
Pulled master
with your fix. It now installs & runs successfully ✅
Thank you @apparentlymart 😄
Maneged to get it working, thankyou for providing this @apparentlymart !
Thanks for working on this tool! I already upgraded to .12 but it seems now that your script would be a prerequisite to fix things in .12.18 such as -
when I attempt to get this package though I get errors in ubuntu. I've never used go before though, so sorry if I've missed something!