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 undo behaviour from common to own package #293

Merged
merged 2 commits into from
Jun 4, 2021

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Jun 3, 2021

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 requested review from a team, kailan and triblondon and removed request for a team June 3, 2021 15:20
@Integralist Integralist force-pushed the integralist/move-undo-from-common branch from 261ddf1 to c20102f Compare June 3, 2021 15:21
@Integralist Integralist removed the request for review from kailan June 3, 2021 15:23
@Integralist Integralist force-pushed the integralist/move-undo-from-common branch from c20102f to 6576964 Compare June 3, 2021 16:59
Copy link
Member

@fgsch fgsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Integralist Integralist merged commit 4e3b6dc into main Jun 4, 2021
@Integralist Integralist deleted the integralist/move-undo-from-common branch June 4, 2021 09:33
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.

3 participants