Skip to content

Conversation

@spacez320
Copy link
Contributor

Fixes #1783

@CLAassistant
Copy link

CLAassistant commented Jun 15, 2025

CLA assistant check
All committers have signed the CLA.

@rashmichandrashekar
Copy link

rashmichandrashekar commented Jul 1, 2025

Is there an ETA for when this will be merged? We are waiting for this fix too. Also, what would be the release cadence for the package? Is it possible to trigger a release once this is merged?

@spacez320
Copy link
Contributor Author

@ccoVeille Thanks for the review. Are you a maintainer, possibly able to answer @rashmichandrashekar 's question about a release?

@spacez320 spacez320 force-pushed the missing_config_file branch from f52bece to c2ae6fb Compare July 6, 2025 00:12
@ccoVeille
Copy link
Contributor

@ccoVeille Thanks for the review. Are you a maintainer, possibly able to answer @rashmichandrashekar 's question about a release?

Hi,

I'm not a maintainer of viper. I just reviewed thr PR because it popped out my stream of notification

@spacez320
Copy link
Contributor Author

Paging @sagikazarmark for potential help here?

@rashmichandrashekar
Copy link

Thanks @spacez320. Gentle ping @sagikazarmark - Could you pls help get this reviewed and merged or point to someone who can help?

@spacez320
Copy link
Contributor Author

@rashmichandrashekar In the meantime, I'm happy to maintain the branch for at least a little while if you want to start using it now.

@rashmichandrashekar
Copy link

Thanks @spacez320. I am planning to take these changes in another OSS repo kube-state-metrics, I will take your changes for testing, but would want this merged so that I can just take the next updated version in the other repo.

Pinging a few other contributors - @spf13 @alexandear @bep @bketelsen @anthonyfok @n10v - Could any one of the recent contributors please help with this? Thanks in advance

@alexandear
Copy link
Contributor

Hi, I'm not a maintainer of this repository, so I can't merge.

@rashmichandrashekar
Copy link

Hi, I'm not a maintainer of this repository, so I can't merge.

Thanks! Could you pls point me to the maintainers of the repo?

@spacez320
Copy link
Contributor Author

I sent an email to @sagikazarmark. I think we'll just have to be patient and wait for someone to respond when they have a moment. In the meantime we can also install from a fork.

@spacez320
Copy link
Contributor Author

Just as a minor update here, am discussing with @sagikazarmark about this change and whether it should move forward, more updates soon.

In the meantime, there has actually already been a thread about this with a proposed (I think reasonable) work-around that probably still works. #1491

Copy link
Collaborator

@sagikazarmark sagikazarmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @spacez320 for putting in the work on this!

I had a few comments, can you please look at them?

Thanks!

@sagikazarmark
Copy link
Collaborator

Oh, almost forgot: would be nice to add some examples:

  • how to handle both errors using the interface
  • how to handle individual errors

Either as Go examples or in the readme. (Or maybe both)

@spacez320
Copy link
Contributor Author

spacez320 commented Aug 17, 2025

@sagikazarmark Thanks for the review.

I'm going to recommend we steer away from the interface implementation, as I'm not sure it serves enough of a purpose, for three reasons:

Let me know if I convinced you or you'd still really like to add the interface.

Examples of new usage are added to the readme.

@sagikazarmark
Copy link
Collaborator

I don't believe you can use normal error management things with the interface (like errors.Is or errors.As) (let me know if I'm wrong here).

Not true: https://go.dev/play/p/Y-xROTywlGD

The original issue is solved by returning the proper error

AFAIK the original issue was not being able to catch both errors (search yields no result, file cannot be found), which is why people wanted the same error to be returned.

How does adding another error fix that?

@spacez320
Copy link
Contributor Author

AFAIK the original issue was not being able to catch both errors (search yields no result, file cannot be found), which is why people wanted the same error to be returned.

My fault, I was overly fixated on solving my issue and not the more general one. New PR now tackles this too with the interface.

Thanks for the example, as well. The thing was that tripping me up is that you have to declare an interface type before you can use it, making me assume that interfaces weren't usable in errors methods without really understanding what was happening.

// This will work for structs but not interfaces
errors.As(err, &someErrorStruct{})  

// Necessary for interfaces
var someError someErrorInterface
errors.As(err &someError) 

@spacez320 spacez320 force-pushed the missing_config_file branch from cdcc911 to 1d18744 Compare August 23, 2025 21:45
@spacez320 spacez320 changed the title fix: return not found error if setting config Return not found error if setting config Sep 22, 2025
sagikazarmark
sagikazarmark previously approved these changes Sep 26, 2025
Copy link
Collaborator

@sagikazarmark sagikazarmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @spacez320 !

I pushed some fixes to your PR.

@sagikazarmark sagikazarmark added the kind/enhancement New feature or request label Sep 26, 2025
@spacez320 spacez320 force-pushed the missing_config_file branch from 84f135d to 1a90a66 Compare October 3, 2025 23:14
@spacez320
Copy link
Contributor Author

@sagikazarmark Thanks a lot for fixes. I added a tiny bit more adjustments. Hopefully it's close now.

@sagikazarmark
Copy link
Collaborator

There was a mixup with branch protection rules, otherwise I would have merged it.

I'll merge it once I get to a computer

@sagikazarmark
Copy link
Collaborator

Apologies for sitting on this for this long. I think it's in a good shape now, so LGTM.

@sagikazarmark sagikazarmark merged commit c2b6679 into spf13:master Oct 8, 2025
34 checks passed
@spacez320 spacez320 deleted the missing_config_file branch October 15, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

viper.ReadInConfig not returning ConfigFileNotFoundError if file is missing

6 participants