-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: cmd/go: conditional/optional dependency for go mod #32419
Comments
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 . thanks ! |
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 . thanks |
Duplicate of #26955 |
@bcmills I don't think this was a duplicate. That proposal seems to be about presentation - display or not display. This proposal seems to be about optimization - download or not download. |
Change https://golang.org/cl/220080 mentions this issue: |
Updates golang/go#36460 Updates golang/go#27900 Updates golang/go#26955 Updates golang/go#30831 Updates golang/go#32058 Updates golang/go#32380 Updates golang/go#32419 Updates golang/go#33370 Updates golang/go#33669 Updates golang/go#36369 Change-Id: I1d4644e3e8b4e688c2fc5a569312495e5072b7d7 Reviewed-on: https://go-review.googlesource.com/c/proposal/+/220080 Reviewed-by: Russ Cox <rsc@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
main.go
when you run
go mod graph
, you can see so many dependencies,Output
What did you expect to see?
what if i only use postgres db, please don't install mssql, sqlite dependencies for me.
i'm not sure this feature calls, maybe conditional dependencies ?
this pattern is common in some library that as a provider .....
What did you see instead?
a huge dependencies tree
Extra information (FYI)
i was a ruby on rails developer, as my experience, package management in node.js is sucking, big node_modules, installed failed, unmet dependencies ...
however in ruby world, package management (bundler) is nearly perfect, maybe go mod designer can learn something from that
The text was updated successfully, but these errors were encountered: