Home > Software engineering >  Why are files named "types.go" are ignored in goland?
Why are files named "types.go" are ignored in goland?

Time:11-29

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

Here is an example of the types.go file

And here the same file renamed

enter image description here

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

CodePudding user response:

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.

enter image description here

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

  • Related