Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the go/types.Type for a declared type alias is the same type as the that which it is aliased too.
In Go 1.23, when GODEBUG=gotypesalias=1 is enabled by default, it is a go/types.Alias instead, which is a unique type node for aliases that points to the type it is aliased to via go/types.Unalias().
See golang/go#63223 for more details.
errcheck's tests do not currently fail with GODEBUG=gotypesalias=1, but that is because the tests themselves do not exercise the problematic situations, such as the following:
With GODEBUG=gotypesalias=1, errcheck will panic when inspecting
embedtalias.a()
to see if it should be excluded from checking:This change uses
types.Unalias
to follow through this extra level of indirection, which fixes the panic and ensures the same behavior with both settings.This change also adds these cases to the test suite, and runs the tests using both settings of gotypesalias. Without the calls to
types.Unalias
, the tests fail.