Use the replace directive in go.mod to point a module path to a local directory for development testing.
Add a replace directive to your go.mod file to point the module path to your local directory. This forces the Go toolchain to use your local code instead of downloading the remote version.
replace example.com/your/module => ./path/to/local/module
Run go mod tidy to ensure the change is recognized and dependencies are updated.
The replace directive tells Go to ignore the internet for a specific library and use a copy sitting on your hard drive instead. It is like telling a chef to use ingredients from your kitchen pantry rather than ordering them from the store. You use this when you are fixing bugs in a dependency and need to test your changes immediately without publishing a new version.