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

chore: add go-arch-lint #2421

Merged
merged 1 commit into from
Aug 18, 2024
Merged

chore: add go-arch-lint #2421

merged 1 commit into from
Aug 18, 2024

Conversation

alecthomas
Copy link
Collaborator

This lints our internal software architecture.

It currently does not pass, but I'm adding this to guide the refactoring changes. Current output:

module: github.com/TBD54566975/ftl
linters:
   On | Base: component imports # always on
  Off | Advanced: vendor imports # switch 'allow.depOnAnyVendor = false' (or delete) to on
   On | Advanced: method calls and dependency injections # switch 'allow.deepScan = true' (or delete) to on

Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/admin/admin.go:13
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/handler_test.go:20
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:15
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:16
Component controller shouldn't depend on github.com/TBD54566975/ftl/backend/runner in /Users/alec/dev/ftl/backend/controller/scaling/localscaling/local_scaling.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:10
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:11
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:12
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/build_go.go:8
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/stubs.go:10
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/watch.go:11
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm_follower.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm_test.go:16
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltest in /Users/alec/dev/ftl/internal/configuration/dal/dal_test.go:9
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltypes in /Users/alec/dev/ftl/internal/configuration/sql/models.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/sql/models.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql in /Users/alec/dev/ftl/internal/configuration/sql/types.go:3
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/internal/modulecontext/from_secrets.go:8

This lints our internal software architecture.

It currently does not pass, but I'm adding this to guide the refactoring changes. Current output:

```
module: github.com/TBD54566975/ftl
linters:
   On | Base: component imports # always on
  Off | Advanced: vendor imports # switch 'allow.depOnAnyVendor = false' (or delete) to on
   On | Advanced: method calls and dependency injections # switch 'allow.deepScan = true' (or delete) to on

Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/admin/admin.go:13
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/handler_test.go:20
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:15
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:16
Component controller shouldn't depend on github.com/TBD54566975/ftl/backend/runner in /Users/alec/dev/ftl/backend/controller/scaling/localscaling/local_scaling.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:10
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:11
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:12
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/build_go.go:8
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/stubs.go:10
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/watch.go:11
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm_follower.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm_test.go:16
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltest in /Users/alec/dev/ftl/internal/configuration/dal/dal_test.go:9
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltypes in /Users/alec/dev/ftl/internal/configuration/sql/models.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/sql/models.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql in /Users/alec/dev/ftl/internal/configuration/sql/types.go:3
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/internal/modulecontext/from_secrets.go:8
```
@alecthomas alecthomas requested review from a team and wesbillman and removed request for a team August 18, 2024 21:43
@ftl-robot ftl-robot mentioned this pull request Aug 18, 2024
@alecthomas alecthomas requested a review from gak August 18, 2024 21:49
@alecthomas alecthomas enabled auto-merge August 18, 2024 21:50
Copy link
Contributor

@gak gak left a comment

Choose a reason for hiding this comment

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

Great idea!

@alecthomas alecthomas added this pull request to the merge queue Aug 18, 2024
Merged via the queue into main with commit 8977b26 Aug 18, 2024
19 checks passed
@alecthomas alecthomas deleted the aat/go-arch-lint branch August 18, 2024 22:16
@wesbillman wesbillman added the approved Marks an already closed PR as approved label Aug 19, 2024
@@ -0,0 +1,103 @@
# yaml-language-server: $schema=./.go-arch-lint-schema.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

So many cool go tools out there! This is great.

safeer pushed a commit that referenced this pull request Aug 19, 2024
This lints our internal software architecture.

It currently does not pass, but I'm adding this to guide the refactoring
changes. Current output:

```
module: github.com/TBD54566975/ftl
linters:
   On | Base: component imports # always on
  Off | Advanced: vendor imports # switch 'allow.depOnAnyVendor = false' (or delete) to on
   On | Advanced: method calls and dependency injections # switch 'allow.deepScan = true' (or delete) to on

Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/admin/admin.go:13
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/handler_test.go:20
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:15
Component controller shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/backend/controller/ingress/request_test.go:16
Component controller shouldn't depend on github.com/TBD54566975/ftl/backend/runner in /Users/alec/dev/ftl/backend/controller/scaling/localscaling/local_scaling.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding.go:16
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:10
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:11
Component encoding shouldn't depend on github.com/TBD54566975/ftl/go-runtime/ftl/reflection in /Users/alec/dev/ftl/go-runtime/encoding/encoding_test.go:12
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/build_go.go:8
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/stubs.go:10
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/compile in /Users/alec/dev/ftl/internal/buildengine/watch.go:11
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leader in /Users/alec/dev/ftl/internal/configuration/asm_follower.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/asm_test.go:16
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltest in /Users/alec/dev/ftl/internal/configuration/dal/dal_test.go:9
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql/sqltypes in /Users/alec/dev/ftl/internal/configuration/sql/models.go:14
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/leases in /Users/alec/dev/ftl/internal/configuration/sql/models.go:13
Component internal shouldn't depend on github.com/TBD54566975/ftl/backend/controller/sql in /Users/alec/dev/ftl/internal/configuration/sql/types.go:3
Component internal shouldn't depend on github.com/TBD54566975/ftl/go-runtime/encoding in /Users/alec/dev/ftl/internal/modulecontext/from_secrets.go:8
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Marks an already closed PR as approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants