GoLand 找不到参考:“未解决的参考 'NewRGBA'”

GoLand could not find reference: " Unresolved reference 'NewRGBA' "

我正在尝试this sample, but GoLand could not find reference of NewRGBA function which is annoying, although it executes it correctly. I already tried

您似乎不小心将 image.go 文件标记为纯文本,这就是 IDE 无法正确识别其中定义的任何内容的原因。

要解决此问题,请转至 Settings/Preferences | Editor | File Types 并在文件类型列表中搜索 Text。在那里您应该看到所有标记为纯文本的 files/extensions 的列表。从列表中删除 image.go 并查看其是否正常工作。此外,请确保文件 file 未在同一部分的 Ignore files and folders 输入中列出。

我对 gin.WrapH 函数 utils.go 也有类似的问题。在本地模块路径中尝试了 utils.go 的 Override File Type 选项,该选项将文件更改为 Go 文件,但有一个小叉号,工具提示标记该文件已从编译中排除。错误 Unresolved reference 仅在我选择文件后消失,导航到 File -> File Properties -> Associate with File Type -> Register new file type association,然后选择 Go files

恢复 IDE 设置解决了我的问题。 我尝试将其从文本文件关联列表中删除,但仍未解决