Skip to content

Conversation

@isopov
Copy link
Contributor

@isopov isopov commented Jul 3, 2023

It seems that I have some typed as *errorx.Error nil and cannot debug its source - maybe we can ignore it instead of throwing NPD and it will manifest in a more readable way somewhere else?

@isopov isopov requested a review from PeterIvanov July 3, 2023 16:22
// %s simple message output
// %v same as %s
// %+v full output complete with a stack trace
// %s simple message output
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest go reformats comments this way - can I leave it this way? Other contributors most likely will use modern go as well.

Copy link
Collaborator

@PeterIvanov PeterIvanov left a comment

Choose a reason for hiding this comment

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

In any particular codebase, I'd rather fix the bad calls to Unwrap or find where the typed nil is returned as a result (alas, I failed to find the relevant reference, it must be in Effective Go or similar article).
But for a library, this seems like a good patch.

@isopov isopov merged commit a1c187a into master Jul 4, 2023
@isopov isopov deleted the fix-unwrapped-on-typed-nil branch July 4, 2023 08:18
@PeterIvanov
Copy link
Collaborator

@isopov friendly colleague pointed to this: https://go.dev/doc/faq#nil_error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants