GoLand IDE: How to remove syntax highlighting for unused variables?

Problem: When I just declare a variable, GoLand immediately highlights it with an error like: "The variable is not used anywhere"; I don't like this behavior of the IDE. I have not yet had time to use it anywhere, but only announced it.

Actually, subject, tell me, please, how to remove this syntax highlighting (namely, about unused variables) in GoLand?

P.S. There is no benefit from manipulating the: Settings -> Editor -> Inspections -> Go


Solution 1:

This does not seem possible with Goland, of VsCode Go (which has the same behavior)

Considering an unused variable is an error for Go itself, the IDE simply reflects that.

It can be jarring though, and other Goland issues reflect this: for example, GO-2374 mentions the same kind of issue with exported functions:

All exported functions (starting with a capital letter) that are not used within a library itself, are marked as unused.
This seems odd to me. Most exported functions in a library are never used within the library itself, but I think it is wrong to mark them as unused since they are not primarily meant to be used within the library.

I still prefer the current highlight, as it makes sure I do not introduce a new variable without using as soon as possible.

Solution 2:

Perhaps if you have that new var, do a _ = yourVar after that. (Then it is in use) Warning: scan for "_ =" afterwards yourself to see if you still have these.

The fact that the editor "complains" is just Go. Go doesn't allow you to declare vars that are not in use.