BrokenImport detected, yet everything works!

OVERVIEW

re: Go 1.18

I’ve created several servers, written in go, built, and deployed to production. All working perfectly with zero problems; very satisfied!

Recently I started another project and set up local modules via go mod commands, including go mod edit -replace... commands. All worked as expected, according to go’s documentation for setting up local modules (not published).

Then I decided to install VS Code’s Go extension (from Google) for linting, formatting, etc.

The idea behind this is to help improve my understanding of go syntax in general and specifically to fix warnings and errors in my new project, which I did. The goal, ofc, is to have no errors and warnings – so that when an error is introduced, it is conspicuous and can be addressed during development.

THE PROBLEM

Since activating the Go extension in VS Code and then fixing all the problems which the linter identified, one problem remains. Seems like a false positive…

The import statement for the local module file – which works when the code executes – displays in the editor as “BrokenImport,” underlined in red and the error badge in the editor’s status bar indicated 1 – for this one linting error. (This appears to be an error with the linter – not my code!)

  1. I do not plan to publish this local module, private or otherwise; it is my goal to preserve this local module to be forever in a state of never being published.

  2. Whereas I have seen many sources state that one “can publish a module,” I have yet to see any go documentation declare that all modules must be publshed. Is this a requirement of Go to have all modules published – even if there will never be a case when this module will ever be re-used in another project?

  3. Since humans are imperfect, like linter code, linter rule disable mechanisms often are provided in other languages to address linter coding flaws and other personal preferences – all in the name of flexibility!

However, I could not find out how to disable a go linter rule.

Any suggestions for disabling linter rules?

(My fallback strategy is to uninstall go-based linters/extensions to avoid distracting errors from displaying during development sessions.)