Home > Enterprise >  Go 1.18 migration issues — Cannot convert 'nil' to type 'any'
Go 1.18 migration issues — Cannot convert 'nil' to type 'any'

Time:04-02

I updated my codebase to Go 1.18. It all looks great, but in a few places, I found the following issues.

defer func() {
    if e := recover() ; e!=nil {
        ...
    }
}()

Compilation is failing with:

Cannot convert 'nil' to type 'any'

The same code was working good with Go 1.17. Based on Go 1.18 Release notes, any is a built-in type of alias for interface{} (Generics)

What is going on?

CodePudding user response:

The issue is with the IDE. IntelliJ Goland 2021.2.4

I can build the code from the command line and in the playground.

  • Related