logo

Golang - Troubleshooting

Last Updated: 2023-03-06

use of untyped nil in assignment

Symptom

If you are trying to create a nil pointer like this:

foo := nil

The compiler would complain about UntypedNilUse:

use of untyped nil in assignment

Solution

Use var foo *Foo instead.