VSCode: Could not import Golang package
You may get a warning in VSCode as follows
Let us see how to resolve this warning. Take a look at the directory structure.
You can see , there is root folder called “GOSamples” and inside we have folder called workspace and its structure as follows
You can see, there is warning showing on main.go , but the program works without any issue, that you can see in the output.
This is just a warning and VS Code does not understand the latest go Modules changes. We can resolve, by opening the VS Code IDE from the workspace folder as shown here
Now you can see there is no red mark or any warning on the import statement.