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

docs: fix error handling for file-not-found #1237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fileformat
Copy link

I'm not a go expert, so I'm not sure exactly what the example was supposed to do before my change, but it definitely did not work.

Running on go1.17.2

@CLAassistant
Copy link

CLAassistant commented Oct 14, 2021

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

👋 Thanks for contributing to Viper! You are awesome! 🎉

A maintainer will take a look at your pull request 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

I believe os.ErrNotExist should only be returned when you use SetConfigFile and the file doesn't exist, so the documentation is technically correct. It might make sense to clean up the confusion with SetConfigFile.

@fileformat
Copy link
Author

I'm a go beginner, so I may be missing something, but findConfigFile isn't behaving the way I expect and ReadInConfig is definitely returning os.ErrNotExist.

I created a gist that demonstrates what I think it should do vs what it actually does.

The output is in the gist as stderr.txt. This is with go v1.17.2.

@sagikazarmark
Copy link
Collaborator

There is an ongoing discussion about #1491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants