为什么在Goland中忽略名为”types.go”的文件?

huangapple go评论85阅读模式
英文:

Why are files named "types.go" are ignored in goland?

问题

自从几天前开始,Goland不再将名为"types.go"的文件识别为Go源文件。这只是一个语法高亮的问题,因为项目仍然可以正常运行,但这相当令人烦恼,因为它影响了我的项目文件和标准库中的文件。

每当我尝试导入被忽略的文件时,都会出现以下错误:

构建约束排除了'/[REDACTED]/internal/api/types'目录中的所有Go文件

但是该文件只包含一些类型定义,没有任何构建约束指令。

例如,这是一个名为types.go的文件的示例:

为什么在Goland中忽略名为”types.go”的文件?

而这是同一个文件重命名后的样子:

为什么在Goland中忽略名为”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

为什么在Goland中忽略名为”types.go”的文件?

And here the same file renamed

为什么在Goland中忽略名为”types.go”的文件?

I already tried to invalidate caches, reinstall go and Goland but the problem still remains

答案1

得分: 2

types.go由于某种原因被识别为纯文本文件。你可以导航到“首选项/设置 | 编辑器 | 文件类型”,找到“由内容自动检测的文件类型”或“文本”,然后将types.go从模式列表中排除。

为什么在Goland中忽略名为”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.

为什么在Goland中忽略名为”types.go”的文件?

Feel free to follow IDEA-258255 to make the process clearer.

huangapple
  • 本文由 发表于 2021年11月28日 21:58:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/70144086.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定