viper: io/fs: package io/fs is not in GOROOT
Expected behavior (what you expected to happen):
go mod tidy to work when viper 1.8.0 is imported
Actual behavior (what actually happened):
Fails with the error:
gitlab.eng.com/xxx/zzz/cmd imports
github.com/spf13/viper imports
github.com/spf13/afero imports
io/fs: package io/fs is not in GOROOT (/usr/local/go/src/io/fs)
gitlab.eng.com/xxx/zzz/cmd imports
github.com/spf13/viper imports
github.com/spf13/afero tested by
github.com/spf13/afero.test imports
testing/fstest: package testing/fstest is not in GOROOT (/usr/local/go/src/testing/fstest)
Environment:
- Viper version: 1.8.0
- go version: go1.15 darwin/amd64
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 16
Commits related to this issue
- Setting the golang version to 1.15.10 (instead of 1.15.7 in some places). This is due to the following bug which causes build failures: https://github.com/spf13/viper/issues/1161 — committed to daniel-cohen/secretsfetcher by daniel-cohen 3 years ago
- Viper bug has already been fixed Per https://github.com/spf13/viper/issues/1161, this issue has already been fixed. `github.com/spf13/viper` is okay to. upgrade at this point. — committed to nebula-aac/meshery-adapter-library by acald-creator 2 years ago
- Viper bug has already been fixed Per https://github.com/spf13/viper/issues/1161, this issue has already been fixed. `github.com/spf13/viper` is okay to. upgrade at this point. Signed-off-by: Antone... — committed to nebula-aac/meshery-adapter-library by acald-creator 2 years ago
@DarthPestilane you could try replacing the afero version. I don’t think we use anything from the new 1.6.0 release:
Keep in mind that Viper (similarly to Go itself) supports the two latest minor Go versions. (Yes, the readme is incorrect and needs updating)
yes, upgrading can resolve this. Thank you, @sagikazarmark
I’m able to reproduce this issue on Go 1.15.5, but I can no longer reproduce it after Go 1.15.10, so upgrading to that (or later) version should fix the problem.
References:
Hey @sagikazarmark
This does not happen on a
go mod initIt just fails on
go mod tidyUpgrade to go1.15.10 to solve this? I’m using go1.14.14, ran into this issue, and I cannot upgrade the golang version. Is there any way to solve this without upgrade golang version? Now I have to use logrus@v1.7.1 instead, a downgrade… 😦
Cool! Please upgrade to a newer version then.