Skip to content
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

Move command behaviour from common to own package #296

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

Integralist
Copy link
Collaborator

Problem: I'm increasingly stumbling into issues with the common package being too broad/generic. This materialises as an "import cycle error". It is also considered bad practice to have folders named common or utils etc.
Solution: Move these behaviours into their own packages.
Example: I would like to add a remediation error type to some code in our config package. This isn't possible because importing the errors package will import text which will import common and the common package has already been imported earlier in the import cycle:

package github.com/fastly/cli/cmd/fastly
        imports github.com/fastly/cli/pkg/app
        imports github.com/fastly/cli/pkg/backend
        imports github.com/fastly/cli/pkg/common << command stuff like: Base/Register/StreamingExec + lots more other misc stuff.
        imports github.com/fastly/cli/pkg/config
        imports github.com/fastly/cli/pkg/errors
        imports github.com/fastly/cli/pkg/text
        imports github.com/fastly/cli/pkg/common: import cycle not allowed

@Integralist Integralist added the enhancement New feature or request label Jun 3, 2021
@Integralist Integralist force-pushed the integralist/move-cmd-from-common branch 2 times, most recently from c93c40c to e7ea9c3 Compare June 3, 2021 16:53
@Integralist Integralist force-pushed the integralist/move-cmd-from-common branch from e7ea9c3 to e1eac9c Compare June 4, 2021 10:00
@Integralist Integralist force-pushed the integralist/move-cmd-from-common branch from e1eac9c to 4737989 Compare June 4, 2021 10:03
@Integralist Integralist merged commit 5ace660 into main Jun 4, 2021
@Integralist Integralist deleted the integralist/move-cmd-from-common branch June 4, 2021 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants