-
Notifications
You must be signed in to change notification settings - Fork 584
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
cannot find package hcl/hcl/printer #449
Comments
Same issue while trying to install with cobra. Cobra posted solution has no effect. Ubuntu 18.04: export GO111MODULE=on package github.com/hashicorp/hcl/hcl/printer: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of: |
Hi @ionutnechita, I'm sorry you've encountered this problem. Based on your error messages, it seems like you are using Go 1.16 in the legacy GOPATH mode rather than in the current Go Modules mode. Because GOPATH mode doesn't understand versioning, it's unable to distinguish between HCL version 1 and HCL version 2, and so it's failing to access what looks to be a HCL version 1 dependency. There's some more details on what's going on here in the Version Selection wiki page, but I think a shorter answer to this is that if you migrate your project to use Go Modules instead of the legacy Due to technical constraints of the modern Go toolchain, we can no longer support the legacy I understand that some are getting HCL 1 as a dependency only indirectly via Viper (possibly Viper also indirectly via Cobra); unfortunately various parts of the Go ecosystem are moving gradually and independently to the modules system and so for some people HCL is the first thing in their dependency tree to begin requiring Go Modules, and I understand that is inconvenient but sadly if it were not this codebase then before too long it would be some other codebase because @jmoodie2002 I see in your output that you are using Go 1.10, which I believe predates the introduction of the |
With GoPath, you can also avoid this mistake?? |
Fix the build error: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of: /usr/local/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT) /go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH) This is related to the removal ot the legacy GOPATH mode support in the package as explained in the HCL issue #449: hashicorp/hcl#449 (comment) Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
Could not solve the problem. v2 seems to be very inconvenient |
cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
/usr/lib/go-1.16/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
/root/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)
The text was updated successfully, but these errors were encountered: