Skip to content
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

io/fs: package io/fs is not in GOROOT #1161

Closed
arriqaaq opened this issue Jun 24, 2021 · 16 comments
Closed

io/fs: package io/fs is not in GOROOT #1161

arriqaaq opened this issue Jun 24, 2021 · 16 comments
Labels
kind/support Support requests for using the project

Comments

@arriqaaq
Copy link

arriqaaq commented Jun 24, 2021

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
@arriqaaq arriqaaq added the kind/bug Something isn't working label Jun 24, 2021
@github-actions
Copy link

👋 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,
either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

Thank you! ❤️

@sagikazarmark
Copy link
Collaborator

The CI runs against Go 1.15. I can't reproduce it locally either:

[nix-shell:~/test]$ go version
go version go1.15.13 darwin/amd64

[nix-shell:~/test]$ go mod init test
go: creating new go.mod: module test

[nix-shell:~/test]$ go get github.com/spf13/viper
go: github.com/spf13/viper upgrade => v1.8.0

@arriqaaq
Copy link
Author

Hey @sagikazarmark

This does not happen on a go mod init

It just fails on go mod tidy

@kotyara85
Copy link

Same issue. Going to rollback to 1.7.1

@sagikazarmark
Copy link
Collaborator

@arriqaaq I can't reproduce it with go mod tidy either. Please provide steps to reproduce in a clean environment (clean GOPATH, clean module cache, go.mod that results in an error).

@tmac33
Copy link

tmac33 commented Jun 28, 2021

Same issue here. But just infects go mod tidy. there is no other infects with go run.

@rengas
Copy link

rengas commented Jun 28, 2021

Same issue here with v 1.8.0 and goland version 1.15

@moreandres
Copy link

Same here, to reproduce create a new module as above and then add a main.go file importing and using viper. Run the example and then try to tidy/why to see the issue happening.

package main

import (
        "github.com/spf13/viper"
)

func main() {
        viper.SetDefault("test", 0)
}
$ go version
go version go1.15.5 linux/amd64
$ cat go.mod 
module test

go 1.15

require github.com/spf13/viper v1.8.1

@sagikazarmark
Copy link
Collaborator

sagikazarmark commented Jun 28, 2021

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:

@sagikazarmark
Copy link
Collaborator

@arriqaaq @kotyara85 @tmac33 @rengas @moreandres Can someone confirm that upgrading to 1.15.10 resolves the issue?

@sagikazarmark sagikazarmark added kind/support Support requests for using the project and removed kind/bug Something isn't working labels Jun 29, 2021
@tmac33
Copy link

tmac33 commented Jun 29, 2021

@arriqaaq @kotyara85 @tmac33 @rengas @moreandres Can someone confirm that upgrading to 1.15.10 resolves the issue?

yes, upgrading can resolve this.
Thank you, @sagikazarmark

@sagikazarmark
Copy link
Collaborator

Cool! Please upgrade to a newer version then.

@DarthPestilane
Copy link

DarthPestilane commented Jul 1, 2021

Upgrade 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... :(

@sagikazarmark
Copy link
Collaborator

@DarthPestilane you could try replacing the afero version. I don't think we use anything from the new 1.6.0 release:

$ cat go.mod 
module test

go 1.15

require github.com/spf13/viper v1.8.1

replace github.com/spf13/afero => github.com/spf13/afero v1.5.1

Keep in mind that Viper (similarly to Go itself) supports the two latest minor Go versions. (Yes, the readme is incorrect and needs updating)

@meimeitou
Copy link

upgrade to go version go1.16.6 solve the problem.

@mgyong
Copy link

mgyong commented Sep 6, 2021

Having the same error with go1.16.7

go get github.com/spf13/viper@v1.8.1

github.com/spf13/viper imports
github.com/spf13/afero imports
io/fs: package io/fs is not in GOROOT (/home/mgyong/.go/src/io/fs)

daniel-cohen added a commit to daniel-cohen/secretsfetcher that referenced this issue Sep 7, 2021
…es).

This is due to the following bug which causes build failures: spf13/viper#1161
acald-creator added a commit to nebula-aac/meshery-adapter-library that referenced this issue Oct 14, 2022
Per spf13/viper#1161, this issue has already been fixed.

`github.com/spf13/viper` is okay to. upgrade at this point.
acald-creator added a commit to nebula-aac/meshery-adapter-library that referenced this issue Oct 14, 2022
Per spf13/viper#1161, this issue has already been fixed.

`github.com/spf13/viper` is okay to. upgrade at this point.

Signed-off-by: Antonette Caldwell <pullmana8@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Support requests for using the project
Projects
None yet
Development

No branches or pull requests

9 participants