-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Failed to get viper: Can not find "hashicorp/hcl/hcl/printer" #1076
Comments
👋 Thanks for reporting! A maintainer will take a look at your issue shortly. 👀 In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues. ⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9 📣 If you've already given us your feedback, you can still help by spreading the news, https://twitter.com/sagikazarmark/status/1306904078967074816 Thank you! ❤️ |
Viper uses Go modules for managing its dependencies. Based on the error message Go looks for the package in your GOPATH. |
$ go get github.com/spf13/viper what is solution for this someone help |
I'm assuming some people will end up here if they're fetching viper via golang Docker image, which by default does not utilize modules. So in Dockerfile, ensure you set:
before running go get command. Otherwise, it tries fetching v2 of hcl which has no hcl/printer package anymore. |
@sagikazarmark I understand we can upgrade to go modules or to the latest go version but what if we are not using go modules at all? Wouldn't software that's using viper break? |
@Saurabh0707 - there's nothing viper maintainers can do with this issue. This is stemming from |
@mtarnawa, Thanks, and yeah I get it. Like you and @sagikazarmark suggested, I will resolve the issue using go modules but that would be quite a significant change, switching to go modules. Kind of, technology architecture change for the software consuming viper. |
As @mtarnawa pointed out: it's out of our hands (sadly). |
the following command worked for me : |
Thank you!! This worked. |
For me unfortunately not |
@lordvalium Are you in a Windows shell? I'm running into this issue in the ubuntu-latest github CI action.
Default go version :
I'm trying to install semver, which has a mod file, but it nonetheless failed to resolve the module correctly. I updated go to 1.16 using actions/setup-go and this succeeded. So you might just need to update your go version, and/or mess with
|
thank u |
I try env GO111MODULE=on go get github.com/spf13/cobra/cobra |
The following worked for me: |
@parth-defy This adds go modules to the project: as @Saurabh0707 said, but doesn't solve the issue of Viper needing to add go modules to get viper package; this adds a go.mod file and upgrades dependencies. |
Expected behavior (what you expected to happen):
Actual behavior (what actually happened):
$ go get github.com/spf13/viper
package github.com/hashicorp/hcl/hcl/printer: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
c:\go\src\github.com\hashicorp\hcl\hcl\printer (from $GOROOT)
C:\Users\sharma.yogesh\go\src\github.com\hashicorp\hcl\hcl\printer (from $GOPATH)
Repl.it link:
Code reproducing the issue:
Environment:
Anything else we should know?:
The text was updated successfully, but these errors were encountered: