From b9497215bd2416610de97d50bf65764a40127de1 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Fri, 26 Jul 2024 14:34:06 +1000 Subject: [PATCH] chore: attempt to auto format PRs (#2176) Co-authored-by: github-actions[bot] --- .../workflows/{autofmt.yml => autofmtpr.yml} | 13 +++++----- backend/controller/admin/client.go | 1 + backend/controller/admin/local_client.go | 3 ++- backend/controller/console.go | 3 +-- backend/controller/controller.go | 2 +- backend/controller/dal/fsm.go | 2 +- backend/controller/ingress/request.go | 3 ++- backend/controller/observability/fsm.go | 6 +++-- backend/controller/pubsub/manager.go | 3 ++- backend/controller/sql/conn.go | 1 + backend/schema/metadatasubscriber.go | 3 ++- backend/schema/metadatatypemap.go | 3 ++- backend/schema/topic.go | 3 ++- buildengine/build_kotlin.go | 3 +-- buildengine/build_rust.go | 1 + cmd/ftl/cmd_config.go | 1 - cmd/ftl/cmd_dev.go | 3 +-- cmd/ftl/cmd_schema_diff.go | 2 +- cmd/ftl/cmd_secret.go | 1 - cmd/ftl/main.go | 1 - common/configuration/asm.go | 5 ++-- common/configuration/asm_follower.go | 2 +- common/configuration/asm_leader.go | 6 ++--- common/configuration/cache.go | 5 ++-- common/configuration/db_secret_resolver.go | 3 ++- common/configuration/manual_sync_utils.go | 1 - go-runtime/compile/build.go | 3 +-- go-runtime/ftl/ftltest/fake.go | 3 ++- go-runtime/ftl/ftltest/pubsub.go | 5 ++-- go-runtime/ftl/leases.go | 2 +- go-runtime/ftl/reflection/type_registry.go | 3 ++- go-runtime/internal/impl.go | 1 - go-runtime/schema/call/analyzer.go | 7 ++--- go-runtime/schema/common/common.go | 6 ++--- go-runtime/schema/common/directive.go | 5 ++-- go-runtime/schema/common/error.go | 3 ++- go-runtime/schema/common/fact.go | 3 ++- go-runtime/schema/configsecret/analyzer.go | 2 +- go-runtime/schema/data/analyzer.go | 5 ++-- go-runtime/schema/database/analyzer.go | 5 ++-- go-runtime/schema/enum/analyzer.go | 2 +- go-runtime/schema/extract.go | 26 +++++++++---------- go-runtime/schema/finalize/analyzer.go | 7 ++--- go-runtime/schema/fsm/analyzer.go | 4 +-- go-runtime/schema/initialize/analyzer.go | 3 ++- go-runtime/schema/metadata/analyzer.go | 6 ++--- go-runtime/schema/subscription/analyzer.go | 5 ++-- go-runtime/schema/topic/analyzer.go | 5 ++-- go-runtime/schema/transitive/analyzer.go | 6 ++--- go-runtime/schema/typealias/analyzer.go | 2 +- go-runtime/schema/typeenum/analyzer.go | 7 ++--- go-runtime/schema/typeenumvariant/analyzer.go | 7 ++--- .../schema/valueenumvariant/analyzer.go | 7 ++--- go-runtime/schema/verb/analyzer.go | 2 +- internal/modulecontext/module_context.go | 9 +++---- internal/rpc/server.go | 4 +-- .../modulecontext/module_context_utils.go | 1 + 57 files changed, 126 insertions(+), 110 deletions(-) rename .github/workflows/{autofmt.yml => autofmtpr.yml} (81%) diff --git a/.github/workflows/autofmt.yml b/.github/workflows/autofmtpr.yml similarity index 81% rename from .github/workflows/autofmt.yml rename to .github/workflows/autofmtpr.yml index 6ae37700b0..947363fa80 100644 --- a/.github/workflows/autofmt.yml +++ b/.github/workflows/autofmtpr.yml @@ -1,16 +1,13 @@ on: - schedule: - # Run daily - - cron: "0 22 * * *" -name: Auto-format + pull_request: +name: Auto-format Pull Request jobs: format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - ref: main - fetch-depth: 0 + ref: ${{ github.head_ref }} token: ${{ secrets.FTL_AUTOFMT_TOKEN }} - name: Init Hermit run: ./bin/hermit env -r >> "$GITHUB_ENV" @@ -20,9 +17,11 @@ jobs: id: git-check run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> "$GITHUB_OUTPUT" - name: Push changes + env: + HEAD: ${{ github.head_ref }} if: steps.git-check.outputs.modified == 'true' run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git commit -am "chore(autofmt): Automated formatting" - git push + git push origin "$HEAD" diff --git a/backend/controller/admin/client.go b/backend/controller/admin/client.go index 3e037e3f8a..99c8861509 100644 --- a/backend/controller/admin/client.go +++ b/backend/controller/admin/client.go @@ -8,6 +8,7 @@ import ( "net/url" "connectrpc.com/connect" + ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" ) diff --git a/backend/controller/admin/local_client.go b/backend/controller/admin/local_client.go index baf4743224..7142877c2b 100644 --- a/backend/controller/admin/local_client.go +++ b/backend/controller/admin/local_client.go @@ -5,11 +5,12 @@ import ( "fmt" "path/filepath" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/buildengine" cf "github.com/TBD54566975/ftl/common/configuration" "github.com/TBD54566975/ftl/common/projectconfig" - "github.com/alecthomas/types/optional" ) // localClient reads and writes to local projectconfig files without making any network diff --git a/backend/controller/console.go b/backend/controller/console.go index b99e24c758..b3764eccf5 100644 --- a/backend/controller/console.go +++ b/backend/controller/console.go @@ -7,10 +7,9 @@ import ( "fmt" "time" - "github.com/reugn/go-quartz/logger" - "connectrpc.com/connect" "github.com/alecthomas/types/optional" + "github.com/reugn/go-quartz/logger" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/backend/controller/controller.go b/backend/controller/controller.go index 662069abbe..aaae35b012 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -7,7 +7,6 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/TBD54566975/ftl/backend/controller/observability" "hash" "io" "math/rand" @@ -43,6 +42,7 @@ import ( "github.com/TBD54566975/ftl/backend/controller/dal" "github.com/TBD54566975/ftl/backend/controller/ingress" "github.com/TBD54566975/ftl/backend/controller/leases" + "github.com/TBD54566975/ftl/backend/controller/observability" "github.com/TBD54566975/ftl/backend/controller/pubsub" "github.com/TBD54566975/ftl/backend/controller/scaling" "github.com/TBD54566975/ftl/backend/controller/scaling/localscaling" diff --git a/backend/controller/dal/fsm.go b/backend/controller/dal/fsm.go index d8a5a3855a..fe9f3b9042 100644 --- a/backend/controller/dal/fsm.go +++ b/backend/controller/dal/fsm.go @@ -5,12 +5,12 @@ import ( "encoding/json" "errors" "fmt" - "github.com/TBD54566975/ftl/backend/controller/observability" "time" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/controller/leases" + "github.com/TBD54566975/ftl/backend/controller/observability" "github.com/TBD54566975/ftl/backend/controller/sql" dalerrs "github.com/TBD54566975/ftl/backend/dal" "github.com/TBD54566975/ftl/backend/schema" diff --git a/backend/controller/ingress/request.go b/backend/controller/ingress/request.go index eee821495e..ce3bd3eeb0 100644 --- a/backend/controller/ingress/request.go +++ b/backend/controller/ingress/request.go @@ -9,9 +9,10 @@ import ( "strconv" "strings" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/controller/dal" "github.com/TBD54566975/ftl/backend/schema" - "github.com/alecthomas/types/optional" ) // BuildRequestBody extracts the HttpRequest body from an HTTP request. diff --git a/backend/controller/observability/fsm.go b/backend/controller/observability/fsm.go index 64da7e7935..592d26c617 100644 --- a/backend/controller/observability/fsm.go +++ b/backend/controller/observability/fsm.go @@ -3,11 +3,13 @@ package observability import ( "context" "fmt" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/internal/observability" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/internal/observability" ) const ( diff --git a/backend/controller/pubsub/manager.go b/backend/controller/pubsub/manager.go index cbf0af2008..e4aa6a2622 100644 --- a/backend/controller/pubsub/manager.go +++ b/backend/controller/pubsub/manager.go @@ -4,10 +4,11 @@ import ( "context" "time" + "github.com/jpillora/backoff" + "github.com/TBD54566975/ftl/backend/controller/dal" "github.com/TBD54566975/ftl/backend/controller/scheduledtask" "github.com/TBD54566975/ftl/internal/log" - "github.com/jpillora/backoff" ) const ( diff --git a/backend/controller/sql/conn.go b/backend/controller/sql/conn.go index 3d2d9933cb..5a2498536e 100644 --- a/backend/controller/sql/conn.go +++ b/backend/controller/sql/conn.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/jackc/pgx/v5" ) diff --git a/backend/schema/metadatasubscriber.go b/backend/schema/metadatasubscriber.go index 4d448aef5b..6bc252d482 100644 --- a/backend/schema/metadatasubscriber.go +++ b/backend/schema/metadatasubscriber.go @@ -3,8 +3,9 @@ package schema import ( "fmt" - schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" "google.golang.org/protobuf/proto" + + schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" ) type MetadataSubscriber struct { diff --git a/backend/schema/metadatatypemap.go b/backend/schema/metadatatypemap.go index a91e25110c..432fd4f3c3 100644 --- a/backend/schema/metadatatypemap.go +++ b/backend/schema/metadatatypemap.go @@ -3,8 +3,9 @@ package schema import ( "fmt" - schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" "google.golang.org/protobuf/reflect/protoreflect" + + schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" ) type MetadataTypeMap struct { diff --git a/backend/schema/topic.go b/backend/schema/topic.go index 58e39e01bc..e1fa150cb0 100644 --- a/backend/schema/topic.go +++ b/backend/schema/topic.go @@ -4,8 +4,9 @@ import ( "fmt" "strings" - schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" "google.golang.org/protobuf/proto" + + schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" ) type Topic struct { diff --git a/buildengine/build_kotlin.go b/buildengine/build_kotlin.go index da8764c61a..595976186f 100644 --- a/buildengine/build_kotlin.go +++ b/buildengine/build_kotlin.go @@ -9,12 +9,11 @@ import ( "sort" "strings" + "github.com/TBD54566975/scaffolder" "github.com/beevik/etree" sets "github.com/deckarep/golang-set/v2" "golang.org/x/exp/maps" - "github.com/TBD54566975/scaffolder" - "github.com/TBD54566975/ftl" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/internal" diff --git a/buildengine/build_rust.go b/buildengine/build_rust.go index 4156c1242e..25b3c7e2a3 100644 --- a/buildengine/build_rust.go +++ b/buildengine/build_rust.go @@ -3,6 +3,7 @@ package buildengine import ( "context" "fmt" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/internal/exec" "github.com/TBD54566975/ftl/internal/log" diff --git a/cmd/ftl/cmd_config.go b/cmd/ftl/cmd_config.go index c465d4c96a..9be3d8462f 100644 --- a/cmd/ftl/cmd_config.go +++ b/cmd/ftl/cmd_config.go @@ -8,7 +8,6 @@ import ( "os" "connectrpc.com/connect" - "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/controller/admin" diff --git a/cmd/ftl/cmd_dev.go b/cmd/ftl/cmd_dev.go index 79427253b6..8165017955 100644 --- a/cmd/ftl/cmd_dev.go +++ b/cmd/ftl/cmd_dev.go @@ -6,9 +6,8 @@ import ( "fmt" "time" - "golang.org/x/sync/errgroup" - "github.com/alecthomas/types/optional" + "golang.org/x/sync/errgroup" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" "github.com/TBD54566975/ftl/buildengine" diff --git a/cmd/ftl/cmd_schema_diff.go b/cmd/ftl/cmd_schema_diff.go index b7561d8407..0798609098 100644 --- a/cmd/ftl/cmd_schema_diff.go +++ b/cmd/ftl/cmd_schema_diff.go @@ -7,6 +7,7 @@ import ( "os" "connectrpc.com/connect" + "github.com/alecthomas/chroma/v2/quick" "github.com/hexops/gotextdiff" "github.com/hexops/gotextdiff/myers" "github.com/hexops/gotextdiff/span" @@ -18,7 +19,6 @@ import ( "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/internal/log" "github.com/TBD54566975/ftl/internal/rpc" - "github.com/alecthomas/chroma/v2/quick" ) type schemaDiffCmd struct { diff --git a/cmd/ftl/cmd_secret.go b/cmd/ftl/cmd_secret.go index 73f8209958..ada8852162 100644 --- a/cmd/ftl/cmd_secret.go +++ b/cmd/ftl/cmd_secret.go @@ -8,7 +8,6 @@ import ( "os" "connectrpc.com/connect" - "github.com/alecthomas/types/optional" "github.com/mattn/go-isatty" "golang.org/x/term" diff --git a/cmd/ftl/main.go b/cmd/ftl/main.go index ddcbff2e98..b40f194908 100644 --- a/cmd/ftl/main.go +++ b/cmd/ftl/main.go @@ -15,7 +15,6 @@ import ( "github.com/TBD54566975/ftl" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" - "github.com/TBD54566975/ftl/common/projectconfig" _ "github.com/TBD54566975/ftl/internal/automaxprocs" // Set GOMAXPROCS to match Linux container CPU quota. "github.com/TBD54566975/ftl/internal/log" diff --git a/common/configuration/asm.go b/common/configuration/asm.go index 74bf8826dd..4136409a2a 100644 --- a/common/configuration/asm.go +++ b/common/configuration/asm.go @@ -6,16 +6,15 @@ import ( "net/url" "time" - "github.com/TBD54566975/ftl/internal/rpc" "github.com/alecthomas/types/optional" + "github.com/aws/aws-sdk-go-v2/service/secretsmanager" "github.com/puzpuzpuz/xsync/v3" "github.com/TBD54566975/ftl/backend/controller/leader" "github.com/TBD54566975/ftl/backend/controller/leases" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" "github.com/TBD54566975/ftl/internal/log" - - "github.com/aws/aws-sdk-go-v2/service/secretsmanager" + "github.com/TBD54566975/ftl/internal/rpc" ) type asmClient interface { diff --git a/common/configuration/asm_follower.go b/common/configuration/asm_follower.go index a7ce2a5eda..60346483b7 100644 --- a/common/configuration/asm_follower.go +++ b/common/configuration/asm_follower.go @@ -6,9 +6,9 @@ import ( "net/url" "time" + "connectrpc.com/connect" "github.com/puzpuzpuz/xsync/v3" - "connectrpc.com/connect" ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" ) diff --git a/common/configuration/asm_leader.go b/common/configuration/asm_leader.go index 5589d89333..f73c3fd991 100644 --- a/common/configuration/asm_leader.go +++ b/common/configuration/asm_leader.go @@ -7,14 +7,14 @@ import ( "net/url" "time" - "github.com/puzpuzpuz/xsync/v3" - - "github.com/TBD54566975/ftl/internal/slices" "github.com/alecthomas/types/optional" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/secretsmanager" "github.com/aws/aws-sdk-go-v2/service/secretsmanager/types" "github.com/aws/smithy-go" + "github.com/puzpuzpuz/xsync/v3" + + "github.com/TBD54566975/ftl/internal/slices" ) const asmLeaderSyncInterval = time.Minute * 5 diff --git a/common/configuration/cache.go b/common/configuration/cache.go index 8bfb5e6bf6..75406926e3 100644 --- a/common/configuration/cache.go +++ b/common/configuration/cache.go @@ -7,11 +7,12 @@ import ( "sync" "time" - "github.com/TBD54566975/ftl/internal/log" - "github.com/TBD54566975/ftl/internal/slices" "github.com/alecthomas/types/optional" "github.com/alecthomas/types/pubsub" "github.com/puzpuzpuz/xsync/v3" + + "github.com/TBD54566975/ftl/internal/log" + "github.com/TBD54566975/ftl/internal/slices" ) const ( diff --git a/common/configuration/db_secret_resolver.go b/common/configuration/db_secret_resolver.go index 6e863d0e47..11f0a27e89 100644 --- a/common/configuration/db_secret_resolver.go +++ b/common/configuration/db_secret_resolver.go @@ -5,8 +5,9 @@ import ( "fmt" "net/url" - "github.com/TBD54566975/ftl/common/configuration/dal" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/common/configuration/dal" ) // DBSecretResolver loads values a project's secrets from the given database. diff --git a/common/configuration/manual_sync_utils.go b/common/configuration/manual_sync_utils.go index 34acdce9a2..6cbd931a33 100644 --- a/common/configuration/manual_sync_utils.go +++ b/common/configuration/manual_sync_utils.go @@ -8,7 +8,6 @@ import ( "time" "github.com/alecthomas/atomic" - "github.com/alecthomas/types/optional" "github.com/puzpuzpuz/xsync/v3" ) diff --git a/go-runtime/compile/build.go b/go-runtime/compile/build.go index 4a440fd2eb..8ae7646659 100644 --- a/go-runtime/compile/build.go +++ b/go-runtime/compile/build.go @@ -13,6 +13,7 @@ import ( "strings" "unicode" + "github.com/TBD54566975/scaffolder" "github.com/alecthomas/types/optional" sets "github.com/deckarep/golang-set/v2" "golang.org/x/exp/maps" @@ -22,8 +23,6 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/TBD54566975/scaffolder" - "github.com/TBD54566975/ftl" schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" "github.com/TBD54566975/ftl/backend/schema" diff --git a/go-runtime/ftl/ftltest/fake.go b/go-runtime/ftl/ftltest/fake.go index 7aa50342ae..fc2b5c8301 100644 --- a/go-runtime/ftl/ftltest/fake.go +++ b/go-runtime/ftl/ftltest/fake.go @@ -7,11 +7,12 @@ import ( "reflect" "strings" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/common/configuration" "github.com/TBD54566975/ftl/go-runtime/ftl" "github.com/TBD54566975/ftl/go-runtime/internal" - "github.com/alecthomas/types/optional" ) // pubSubEvent is a sum type for all events that can be published to the pubsub system. diff --git a/go-runtime/ftl/ftltest/pubsub.go b/go-runtime/ftl/ftltest/pubsub.go index 817708ad3b..26800d45cb 100644 --- a/go-runtime/ftl/ftltest/pubsub.go +++ b/go-runtime/ftl/ftltest/pubsub.go @@ -8,12 +8,13 @@ import ( "sync" "time" + "github.com/alecthomas/types/optional" + "github.com/alecthomas/types/pubsub" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/go-runtime/ftl" "github.com/TBD54566975/ftl/internal/log" "github.com/TBD54566975/ftl/internal/slices" - "github.com/alecthomas/types/optional" - "github.com/alecthomas/types/pubsub" ) type fakePubSub struct { diff --git a/go-runtime/ftl/leases.go b/go-runtime/ftl/leases.go index 6bdcf15e75..17e5d35d1e 100644 --- a/go-runtime/ftl/leases.go +++ b/go-runtime/ftl/leases.go @@ -10,6 +10,7 @@ import ( "time" "connectrpc.com/connect" + "github.com/alecthomas/types/optional" "google.golang.org/protobuf/types/known/durationpb" ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1" @@ -18,7 +19,6 @@ import ( "github.com/TBD54566975/ftl/internal/log" "github.com/TBD54566975/ftl/internal/modulecontext" "github.com/TBD54566975/ftl/internal/rpc" - "github.com/alecthomas/types/optional" ) // ErrLeaseHeld is returned when an attempt is made to acquire a lease that is diff --git a/go-runtime/ftl/reflection/type_registry.go b/go-runtime/ftl/reflection/type_registry.go index 20cdb1e509..8fa88fdf87 100644 --- a/go-runtime/ftl/reflection/type_registry.go +++ b/go-runtime/ftl/reflection/type_registry.go @@ -3,8 +3,9 @@ package reflection import ( "reflect" - "github.com/TBD54566975/ftl/backend/schema" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/backend/schema" ) // TypeRegistry is used for dynamic type resolution at runtime. It stores associations between sum type discriminators diff --git a/go-runtime/internal/impl.go b/go-runtime/internal/impl.go index 865bed6787..d75a7dde12 100644 --- a/go-runtime/internal/impl.go +++ b/go-runtime/internal/impl.go @@ -8,7 +8,6 @@ import ( "reflect" "connectrpc.com/connect" - "github.com/puzpuzpuz/xsync/v3" ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1" diff --git a/go-runtime/schema/call/analyzer.go b/go-runtime/schema/call/analyzer.go index aaf455e33b..3974ffe225 100644 --- a/go-runtime/schema/call/analyzer.go +++ b/go-runtime/schema/call/analyzer.go @@ -5,12 +5,13 @@ import ( "go/types" "strings" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) const ( diff --git a/go-runtime/schema/common/common.go b/go-runtime/schema/common/common.go index 2f26cb3ada..e650fb23ce 100644 --- a/go-runtime/schema/common/common.go +++ b/go-runtime/schema/common/common.go @@ -9,14 +9,14 @@ import ( "strconv" "strings" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" + "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" "github.com/puzpuzpuz/xsync/v3" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" - "github.com/TBD54566975/golang-tools/go/ast/inspector" ) var ( diff --git a/go-runtime/schema/common/directive.go b/go-runtime/schema/common/directive.go index 962b7c1f94..fa367a4da2 100644 --- a/go-runtime/schema/common/directive.go +++ b/go-runtime/schema/common/directive.go @@ -8,10 +8,11 @@ import ( "strconv" "strings" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/internal/cron" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/participle/v2" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/internal/cron" ) // This file contains a parser for Go FTL directives. diff --git a/go-runtime/schema/common/error.go b/go-runtime/schema/common/error.go index f7d1649f99..3daf2bb68c 100644 --- a/go-runtime/schema/common/error.go +++ b/go-runtime/schema/common/error.go @@ -6,8 +6,9 @@ import ( "go/token" "unicode/utf8" - "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/golang-tools/go/analysis" + + "github.com/TBD54566975/ftl/backend/schema" ) type DiagnosticCategory string diff --git a/go-runtime/schema/common/fact.go b/go-runtime/schema/common/fact.go index 9b1fb00128..4375942847 100644 --- a/go-runtime/schema/common/fact.go +++ b/go-runtime/schema/common/fact.go @@ -4,9 +4,10 @@ import ( "go/types" "reflect" - "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/backend/schema" ) // SchemaFact is a fact that associates a schema node with a Go object. diff --git a/go-runtime/schema/configsecret/analyzer.go b/go-runtime/schema/configsecret/analyzer.go index cfa7d9de58..744cb2c698 100644 --- a/go-runtime/schema/configsecret/analyzer.go +++ b/go-runtime/schema/configsecret/analyzer.go @@ -4,13 +4,13 @@ import ( "go/ast" "go/types" + "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" ) const ( diff --git a/go-runtime/schema/data/analyzer.go b/go-runtime/schema/data/analyzer.go index 6ddb935817..b1df2c6010 100644 --- a/go-runtime/schema/data/analyzer.go +++ b/go-runtime/schema/data/analyzer.go @@ -9,11 +9,12 @@ import ( "strings" "unicode" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/alecthomas/types/optional" ) var ( diff --git a/go-runtime/schema/database/analyzer.go b/go-runtime/schema/database/analyzer.go index dfe25d9fc6..80d9bbf361 100644 --- a/go-runtime/schema/database/analyzer.go +++ b/go-runtime/schema/database/analyzer.go @@ -4,10 +4,11 @@ import ( "go/ast" "go/types" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) const ftlPostgresDBFuncPath = "github.com/TBD54566975/ftl/go-runtime/ftl.PostgresDatabase" diff --git a/go-runtime/schema/enum/analyzer.go b/go-runtime/schema/enum/analyzer.go index b2f0cb766b..dbdf0b0552 100644 --- a/go-runtime/schema/enum/analyzer.go +++ b/go-runtime/schema/enum/analyzer.go @@ -6,12 +6,12 @@ import ( "slices" "strings" + "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" ) // Extractor extracts type aliases to the module schema. diff --git a/go-runtime/schema/extract.go b/go-runtime/schema/extract.go index 65386e7d5f..d66eaf52cf 100644 --- a/go-runtime/schema/extract.go +++ b/go-runtime/schema/extract.go @@ -6,17 +6,8 @@ import ( "slices" "strings" - "github.com/TBD54566975/ftl/go-runtime/schema/call" - "github.com/TBD54566975/ftl/go-runtime/schema/configsecret" - "github.com/TBD54566975/ftl/go-runtime/schema/data" - "github.com/TBD54566975/ftl/go-runtime/schema/database" - "github.com/TBD54566975/ftl/go-runtime/schema/enum" - "github.com/TBD54566975/ftl/go-runtime/schema/fsm" - "github.com/TBD54566975/ftl/go-runtime/schema/subscription" - "github.com/TBD54566975/ftl/go-runtime/schema/topic" - "github.com/TBD54566975/ftl/go-runtime/schema/typeenum" - "github.com/TBD54566975/ftl/go-runtime/schema/typeenumvariant" - "github.com/TBD54566975/ftl/go-runtime/schema/valueenumvariant" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" checker "github.com/TBD54566975/golang-tools/go/analysis/programmaticchecker" "github.com/TBD54566975/golang-tools/go/packages" "github.com/alecthomas/types/optional" @@ -25,15 +16,24 @@ import ( "golang.org/x/exp/maps" "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/go-runtime/schema/call" "github.com/TBD54566975/ftl/go-runtime/schema/common" + "github.com/TBD54566975/ftl/go-runtime/schema/configsecret" + "github.com/TBD54566975/ftl/go-runtime/schema/data" + "github.com/TBD54566975/ftl/go-runtime/schema/database" + "github.com/TBD54566975/ftl/go-runtime/schema/enum" "github.com/TBD54566975/ftl/go-runtime/schema/finalize" + "github.com/TBD54566975/ftl/go-runtime/schema/fsm" "github.com/TBD54566975/ftl/go-runtime/schema/initialize" "github.com/TBD54566975/ftl/go-runtime/schema/metadata" + "github.com/TBD54566975/ftl/go-runtime/schema/subscription" + "github.com/TBD54566975/ftl/go-runtime/schema/topic" "github.com/TBD54566975/ftl/go-runtime/schema/transitive" "github.com/TBD54566975/ftl/go-runtime/schema/typealias" + "github.com/TBD54566975/ftl/go-runtime/schema/typeenum" + "github.com/TBD54566975/ftl/go-runtime/schema/typeenumvariant" + "github.com/TBD54566975/ftl/go-runtime/schema/valueenumvariant" "github.com/TBD54566975/ftl/go-runtime/schema/verb" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" ) // Extractors contains all schema extractors that will run. diff --git a/go-runtime/schema/finalize/analyzer.go b/go-runtime/schema/finalize/analyzer.go index 5d95b1900e..fc261a0024 100644 --- a/go-runtime/schema/finalize/analyzer.go +++ b/go-runtime/schema/finalize/analyzer.go @@ -6,13 +6,14 @@ import ( "reflect" "strings" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" sets "github.com/deckarep/golang-set/v2" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) // Analyzer aggregates the results of all extractors. diff --git a/go-runtime/schema/fsm/analyzer.go b/go-runtime/schema/fsm/analyzer.go index 2ed87f22b8..f754a8a736 100644 --- a/go-runtime/schema/fsm/analyzer.go +++ b/go-runtime/schema/fsm/analyzer.go @@ -4,12 +4,12 @@ import ( "go/ast" "go/types" - "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" ) const ( diff --git a/go-runtime/schema/initialize/analyzer.go b/go-runtime/schema/initialize/analyzer.go index 0cefd0eacc..4d2e1412fd 100644 --- a/go-runtime/schema/initialize/analyzer.go +++ b/go-runtime/schema/initialize/analyzer.go @@ -7,9 +7,10 @@ import ( "reflect" "strings" - "github.com/TBD54566975/ftl/internal/slices" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/packages" + + "github.com/TBD54566975/ftl/internal/slices" ) // Analyzer prepares data prior to the schema extractor runs, e.g. loads FTL types for reference by other diff --git a/go-runtime/schema/metadata/analyzer.go b/go-runtime/schema/metadata/analyzer.go index f2bdd0c1eb..35d8256329 100644 --- a/go-runtime/schema/metadata/analyzer.go +++ b/go-runtime/schema/metadata/analyzer.go @@ -5,14 +5,14 @@ import ( "go/token" "reflect" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" + "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" sets "github.com/deckarep/golang-set/v2" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" - "github.com/TBD54566975/golang-tools/go/ast/inspector" ) // Extractor extracts metadata to the module schema. diff --git a/go-runtime/schema/subscription/analyzer.go b/go-runtime/schema/subscription/analyzer.go index 1e72009592..ec5c4617e0 100644 --- a/go-runtime/schema/subscription/analyzer.go +++ b/go-runtime/schema/subscription/analyzer.go @@ -4,11 +4,12 @@ import ( "go/ast" "go/types" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/alecthomas/types/optional" ) const ( diff --git a/go-runtime/schema/topic/analyzer.go b/go-runtime/schema/topic/analyzer.go index 0ac10a1d60..ef87d9db1b 100644 --- a/go-runtime/schema/topic/analyzer.go +++ b/go-runtime/schema/topic/analyzer.go @@ -4,11 +4,12 @@ import ( "go/ast" "go/types" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/alecthomas/types/optional" + "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/alecthomas/types/optional" ) const ( diff --git a/go-runtime/schema/transitive/analyzer.go b/go-runtime/schema/transitive/analyzer.go index bd47fe9b40..1fcbbc7660 100644 --- a/go-runtime/schema/transitive/analyzer.go +++ b/go-runtime/schema/transitive/analyzer.go @@ -4,14 +4,14 @@ import ( "go/ast" "go/types" + "github.com/TBD54566975/golang-tools/go/analysis" + "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" + "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" sets "github.com/deckarep/golang-set/v2" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" - "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" - "github.com/TBD54566975/golang-tools/go/ast/inspector" ) // Extractor extracts transitive schema.Decls to the module schema. diff --git a/go-runtime/schema/typealias/analyzer.go b/go-runtime/schema/typealias/analyzer.go index afc3ff6c4a..b637b509b3 100644 --- a/go-runtime/schema/typealias/analyzer.go +++ b/go-runtime/schema/typealias/analyzer.go @@ -5,12 +5,12 @@ import ( "go/types" "strings" + "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" - "github.com/TBD54566975/golang-tools/go/analysis" ) // Extractor extracts type aliases to the module schema. diff --git a/go-runtime/schema/typeenum/analyzer.go b/go-runtime/schema/typeenum/analyzer.go index 7d08d9eb82..bd26d4fac8 100644 --- a/go-runtime/schema/typeenum/analyzer.go +++ b/go-runtime/schema/typeenum/analyzer.go @@ -4,12 +4,13 @@ import ( "go/ast" "go/types" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) // Extractor extracts possible type enum discriminators. diff --git a/go-runtime/schema/typeenumvariant/analyzer.go b/go-runtime/schema/typeenumvariant/analyzer.go index b8cd94843e..0067397fb5 100644 --- a/go-runtime/schema/typeenumvariant/analyzer.go +++ b/go-runtime/schema/typeenumvariant/analyzer.go @@ -4,13 +4,14 @@ import ( "go/ast" "go/types" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) // Extractor extracts possible type enum variants. diff --git a/go-runtime/schema/valueenumvariant/analyzer.go b/go-runtime/schema/valueenumvariant/analyzer.go index c7f067aaac..c0d7ce1a1f 100644 --- a/go-runtime/schema/valueenumvariant/analyzer.go +++ b/go-runtime/schema/valueenumvariant/analyzer.go @@ -6,13 +6,14 @@ import ( "go/types" "strconv" - "github.com/TBD54566975/ftl/backend/schema" - "github.com/TBD54566975/ftl/backend/schema/strcase" - "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/golang-tools/go/analysis" "github.com/TBD54566975/golang-tools/go/analysis/passes/inspect" "github.com/TBD54566975/golang-tools/go/ast/inspector" "github.com/alecthomas/types/optional" + + "github.com/TBD54566975/ftl/backend/schema" + "github.com/TBD54566975/ftl/backend/schema/strcase" + "github.com/TBD54566975/ftl/go-runtime/schema/common" ) // Extractor extracts possible value enum variants. diff --git a/go-runtime/schema/verb/analyzer.go b/go-runtime/schema/verb/analyzer.go index 832f8eb06e..45ad9365c8 100644 --- a/go-runtime/schema/verb/analyzer.go +++ b/go-runtime/schema/verb/analyzer.go @@ -5,13 +5,13 @@ import ( "go/types" "unicode" + "github.com/TBD54566975/golang-tools/go/analysis" "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/backend/schema/strcase" "github.com/TBD54566975/ftl/go-runtime/schema/common" "github.com/TBD54566975/ftl/go-runtime/schema/initialize" - "github.com/TBD54566975/golang-tools/go/analysis" ) // Extractor extracts verbs to the module schema. diff --git a/internal/modulecontext/module_context.go b/internal/modulecontext/module_context.go index e3a473308d..a8c1522c90 100644 --- a/internal/modulecontext/module_context.go +++ b/internal/modulecontext/module_context.go @@ -11,20 +11,17 @@ import ( "time" "connectrpc.com/connect" - "github.com/alecthomas/atomic" + "github.com/alecthomas/types/optional" + _ "github.com/jackc/pgx/v5/stdlib" // SQL driver "github.com/jpillora/backoff" "golang.org/x/sync/errgroup" ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1" "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/ftlv1connect" - "github.com/TBD54566975/ftl/internal/rpc" - - "github.com/alecthomas/types/optional" - _ "github.com/jackc/pgx/v5/stdlib" // SQL driver - "github.com/TBD54566975/ftl/backend/schema" "github.com/TBD54566975/ftl/internal/reflect" + "github.com/TBD54566975/ftl/internal/rpc" ) // Verb is a function that takes a request and returns a response but is not constrained by request/response type like ftl.Verb diff --git a/internal/rpc/server.go b/internal/rpc/server.go index 7036fb692b..a61a290240 100644 --- a/internal/rpc/server.go +++ b/internal/rpc/server.go @@ -9,14 +9,14 @@ import ( "strings" "time" - gaphttp "github.com/TBD54566975/ftl/internal/http" - "connectrpc.com/connect" "connectrpc.com/grpcreflect" "github.com/alecthomas/concurrency" "github.com/alecthomas/types/pubsub" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" + + gaphttp "github.com/TBD54566975/ftl/internal/http" ) const ShutdownGracePeriod = time.Second * 5 diff --git a/testutils/modulecontext/module_context_utils.go b/testutils/modulecontext/module_context_utils.go index acf1a61d9f..e011662bfb 100644 --- a/testutils/modulecontext/module_context_utils.go +++ b/testutils/modulecontext/module_context_utils.go @@ -4,6 +4,7 @@ package modulecontext import ( "context" + "github.com/TBD54566975/ftl/internal/modulecontext" )