Go
Potential nil dereference
Warning
Reliability
New
Last modified: 03 December 2024 Reports instances where pointers that might be nil
are dereferenced.
Example:
type Person struct{ Name string }
func _(person *Person) {
if person != nil || person.Name != "Peter" {
}
}
In the provided example, person
is a pointer to a Person
struct, but it is nil
as it is not assigned any value. Attempting to dereference person
to access Name
without checking if person
is nil
results in a runtime error.
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
GoDfaNilDereference
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Go, 243.23131 |
Thanks for your feedback!
Was this page helpful?