I just recently pulled changes in my project that included the toolchain
directive. The issue is that GoLand does not recognize it as a valid directive. The image shows the output from the IDE as well as the red underlining with it; note that I am still able to run everything fine even though this is the case. I suspect it has something to do with syntax highlighting, but honestly I am not sure.
This is the output of go version
:
go version go1.22.0 linux/amd64
I have also verified that my GoLand is using 1.22.0
by checking File -> Settings -> Go -> GOROOT
.
I have attempted invalidating the cache and restarting the IDE, restarting my machine altogether, and have done some Google searches to see if there are others experiencing the same issue but have yet to find anything.
For some context, I thought I had downloaded the most recent version of GoLand through the clicky menu, however after seeing that it only brought me to 2023.1.2
I had to manually go to their website and get 2023.3.4
and install that. This fixed the toolchain problem as @Brits mentioned in the comments.
There is likely a way to properly update the GoLand version; admittedly I have not found it and am sticking with what works at the moment.