I am using a mono repo and I download certain tools under the project tree (istio). Running go get -u
or go mod tidy
causes the main go.mod
to get updated with irrelevant deps.
How do I exclude certain src subpaths for consideration.
Note:
This does not do the trick as the subdirectories I want to exclude do have go files in them.
mod and go. sum files with the suffix +incompatible , indicating that the selected version is not compatible with the original API for that path.
What is Go Module. A Module is a collection of Go packages stored in a file tree under $GOPATH/pkg folder with a go. mod file at its root. This file defines the module's path, which is also the import path used for your project, and its dependency requirements, which are the other modules needed for a successful build.
go mod tidy cleans up unused dependencies or adds missing dependencies. go mod vendor copies all third-party dependencies to a vendor folder in your project root.
Indirect Dependencies You may see some dependencies in your go. mod file that are indirect (denoted by // indirect ). This means that one of your dependencies doesn't have its own go. mod file, so, the dependencies that it imports are included in your project's go.
I think your two main options are:
A go.mod in a directory will cause that directory and all of its subdirectories to be excluded from the top-level Go module.
Use a leading underscore as Peter suggested, or a leading .
.
If neither of those are appropriate, please add a comment explaining why, ideally including an error message or some other set of details about what happened when you tried.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With