英文:
Why are files named "types.go" are ignored in goland?
问题
自从几天前开始,Goland不再将名为"types.go"的文件识别为Go源文件。这只是一个语法高亮的问题,因为项目仍然可以正常运行,但这相当令人烦恼,因为它影响了我的项目文件和标准库中的文件。
每当我尝试导入被忽略的文件时,都会出现以下错误:
构建约束排除了'/[REDACTED]/internal/api/types'目录中的所有Go文件
但是该文件只包含一些类型定义,没有任何构建约束指令。
例如,这是一个名为types.go的文件的示例:
而这是同一个文件重命名后的样子:
我已经尝试过无效化缓存、重新安装Go和Goland,但问题仍然存在。
英文:
Since a few days, Goland is not recognizing files named "types.go" as go source files. This is just a problem for syntax highlighting, as the project still runs normally, but it's quite annoying, because it affects both files from my project and from the standard library.
Whenever I try to import the ignored file I get the error:
Build constraints exclude all the Go files in '/[REDACTED]/internal/api/types'
But the file just contains some types definitions, without any build constraint directive.
For example here is a file called types.go
And here the same file renamed
I already tried to invalidate caches, reinstall go and Goland but the problem still remains
答案1
得分: 2
types.go
由于某种原因被识别为纯文本文件。你可以导航到“首选项/设置 | 编辑器 | 文件类型”,找到“由内容自动检测的文件类型”或“文本”,然后将types.go
从模式列表中排除。
随意关注IDEA-258255以使该过程更清晰。
英文:
types.go
is recognized as a plain-text file for some reason. You can navigate to Preferences/Settings | Editor | File Types find File type auto-detected by content or Text and exclude types.go
from the patterns list.
Feel free to follow IDEA-258255 to make the process clearer.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论