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 time behaviour from common to own package #295

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-time-from-common branch from 1a5fbb2 to ad57daf Compare June 3, 2021 16:56
@Integralist Integralist force-pushed the integralist/move-time-from-common branch from ad57daf to 304f60e Compare June 4, 2021 09:47
@Integralist Integralist merged commit 929b10b into main Jun 4, 2021
@Integralist Integralist deleted the integralist/move-time-from-common branch June 4, 2021 09:59
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.

None yet

2 participants