'No version set for command go

I attempted to check the version of my go executable with go version on an Ubuntu machine, however I got the following error:

No version set for command go
Consider adding one of the following versions in your config file at 
golang 1.16.8
golang 1.17.1

How do I resolve this? I have no prior experience with config file, I searched on google but I found nothing which could solve this issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source