Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: cmd/go: conditional/optional dependency for go mod #32419
What version of Go are you using (
In Go modules, the module is the unit of dependency. When you are using a proxy (slated to be enabled by default in Go 1.13), you will download only the
For registry-style APIs, I would recommend placing the service-specific implementations in a separate module from the registry package itself. Then the “conditional” aspect of the module graph is exactly: “which packages are in the package import graph?”.
This issue in its current form does not have enough detail to be a proposal.
If you want to describe a general area for improvement, please add an experience report instead.
Otherwise, please describe the specific changes you would like to see, including the motivation or background, syntax, and concrete examples (ideally drawn from experience reports).
hi @bcmills 1.13 is not out, didn't try it.
just run copy the main.go and run
for the above sample, the go.sum would be
if main module does not need package github.com/BurntSushi/toml, why it's in go.sum ?
and just because some lib use ginkgo to test, my sample should depend on that ?
and if i plan to only use sqlite in this project, why
hope my understanding about go.sum is totally wrong .
as specific changes i'd like to see, you can refer extra part in the issue:
eg. bundler groups feature.
if the package author specify ginkgo or goconvey or else as test group. that means ginkgo、goconvey are test dependencies,
as a user, i import the package, i don't care he use what to test the code if it works for me. so i don't need to depend ginkgo, goconvey, i don't even want they appear in my go.sum file as possible,
for some dependencies, if they are for development or test, then in production you don't need to package them at all ...
if i didn't make things clear, you can refer the urls in extra part .