最佳答案
我在Go中看到了很多检测nil的代码,像这样:
if err != nil {
// handle the error
}
然而,我有一个像这样的结构:
type Config struct {
host string
port float64
}
和config是config的一个实例,当我这样做:
if config == nil {
}
有编译错误,说: 不能将nil转换为Config类型