-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Please do not make nested go.mod modules #2271
Comments
I agree that having nested modules that are more than one level deep (e.g. But not having any submodules isn't an option either. Do you really want to pull in all of |
I appreciate your perspective on the use of multiple go.mod files, but I’d like to share why I believe that having a single go.mod at the root is the more sensible choice. First and foremost, the developer experience should be the priority in any project. When working with a single go.mod, the workflow becomes straightforward: you can clone the repository, develop your code, build, test, and commit without the confusion that comes from managing nested modules. This approach eliminates unnecessary steps, like having to delete extra go.mod files created by others, which many developers often have to do. In contrast, when multiple go.mod files are present, it can lead to significant misunderstandings. For instance, a developer might start coding without realizing that their changes won't take effect, as they may be inadvertently referencing outdated dependencies. This can lead to split pull requests and the creation of additional go.mod files, complicating the project further. By having a single go.mod, both new and experienced developers can converge on a simpler process:
Additionally, maintaining one go.mod file simplifies the release process. It ensures that there’s a single source for dependency management, reducing the risk of mismatched versions and potential security vulnerabilities. This makes it easier for release managers, who won’t need to worry about updating multiple go.mod and go.sum files or potentially overlooking one. As for the argument regarding importing nested modules, in many real-world scenarios, dependencies are interconnected. Thus, the expectation that using nested modules improves modularity often doesn’t hold up. Most dependencies will still pull in various parts of the project, regardless of the nested structure. Finally, while you mentioned that certain modules, like In summary, I believe that adopting a single go.mod file enhances collaboration, simplifies the development process, and reduces the risks associated with dependency management. Thank you for considering this perspective! If there is anything else I can help with please let me know |
Oh we definitely understand the developer pain that comes with submodules. We've been using them in all our projects and it's definitely not easy. But, especially with So I'm definitely not saying your concerns aren't valid. I'm just saying that the chances of this project changing its approach are very slim in my opinion. But of course you're welcome to try, I'd just recommend to manage expectations. |
Rookies have been active, creating unnecessary nested go modules. These are notoriously hard to get right, cause part of the project depend on entirely different versions of itself, and even though creating nested modules appears (on the surface only) to cause no problem, the opposite is true. Whats worse, once the problem is spotted, deleting the nested modules is near impossible.
The attached patch in gist attempts to clean the mess caused by other contributors:
https://gist.github.com/litecomb/ea736ccb1573ee468f40518065f59329
Note that this assumes that beyond that point the btcec package will share its version with the rest of the repo. I have no idea if that is desired or necessary at all.
Unfortunately since deleting the nested modules is near impossible, a full fork of the repo may be necessary to properly flush external sites such as pkg.go.dev and the infamous google mitm source code proxy which backs go get.
The text was updated successfully, but these errors were encountered: