-
Notifications
You must be signed in to change notification settings - Fork 1k
Importers should not hard fail on errors #1315
Comments
I'll try to work on this. |
Hey @carolynvs, I have been trying to look at all the linked issues and PRs to better understand the goal here. Could you please help me and answer some doubts I have?
|
The goal of this issue is to alter import such that it never returns an error and any problems are treated as warnings. The first step is to stop returning errors from Import all together: dep/internal/importers/importers.go Line 28 in 7744710
becomes Import(path string, pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock)
Yes, if the importer encounters invalid external configuration files they should attempt to recover and continue if possible. An example of a recoverable error would be something like this: dep/internal/importers/glide/importer.go Lines 149 to 151 in 7744710
In that case instead of returning an error, a warning is printed and the importer moves on to the next package.
Yes,
No changes should be made to the gps package. I was trying to say that the base importer executes functionality in gps (either directly or via the
Don't worry about ensure, this issue is just a prerequisite for enabling that feature later on. Currently dep only imports external configuration found in the root of the repository during init. We are working on a feature to enable importing external configuration found in dependencies during dep init and eventually during ensure as well. (the epic for this is #1335). So if a dependency never migrates to dep (or is just slow to do so), we can still take advantage of that dependency's glide/govendor/gb/etc config. Hopefully that helps narrow down the scope of the issue! 😀 |
Thanks @carolynvs, this is very helpful. I am now much more clear on the scope of the issue and where the changes need to be made.
Errors are also used to indicate whether an operation was successful. In the rare scenario that something unexpected happened(ex: yaml parsing failed), how do we handle it? Is it enough to return
Would it be better to delegate this to |
Yes, in case of catastrophic failure, we should log a warning and return nil manifest and lock.
Let's focus on the immediate requirements of the issue first. There have been enough questions that I'm concerned that I completely underestimated the scope of this issue. So if we feel like we need to cap recoverable errors, I'd prefer to tackle that in a separate PR.
That spot should work as well. |
Sure @carolynvs. I'll try to make a PR over the next few days.
Yea, it's a bad habit of mine, my apologies 😅. |
Oh! No, please ask questions, they are all very good. I just didn't realize how much work may be lurking in this issue until you asked! 😊 |
@carolynvs I have made a PR - #1474. I'd love to get some early feedback from you. |
When bad config is encountered, the importer should print a warning, and skip to the next package, instead of hard failing. This is nice to have as part of #909, because if the import hard fails, nothing can be written. But it is absolutely required for importing during
dep ensure
.Examples of hard fails that should be warnings:
The text was updated successfully, but these errors were encountered: