From 9defc32de27c6f4e3790fd82c620d969c6cac57e Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Tue, 13 Feb 2024 10:27:39 +1100 Subject: [PATCH] fix: rename go-runtime/sdk to go-runtime/ftl Fixes #907 --- cmd/ftl/cmd_call.go | 2 +- examples/go/echo/echo.go | 2 +- examples/go/httpingress/httpingress.go | 2 +- examples/online-boutique/services/checkout/checkout.go | 2 +- .../services/recommendation/recommendation.go | 2 +- go-runtime/compile/build.go | 5 +++-- go-runtime/compile/schema.go | 6 +++--- go-runtime/compile/testdata/one/one.go | 2 +- go-runtime/compile/testdata/two/two.go | 2 +- go-runtime/encoding/encoding_test.go | 2 +- go-runtime/{sdk => ftl}/call.go | 0 go-runtime/{sdk => ftl}/config.go | 2 +- go-runtime/{sdk => ftl}/config_test.go | 0 go-runtime/{sdk => ftl}/database.go | 0 go-runtime/{sdk => ftl}/logging.go | 0 go-runtime/{sdk => ftl}/observability/metrics.go | 0 go-runtime/{sdk => ftl}/observability/traces.go | 0 go-runtime/{sdk => ftl}/option.go | 0 go-runtime/{sdk => ftl}/option_test.go | 0 go-runtime/{sdk => ftl}/secrets.go | 0 go-runtime/{sdk => ftl}/secrets_test.go | 0 go-runtime/{sdk => ftl}/types.go | 0 .../{{ .Name | camel | lower }}.go.tmpl | 2 +- go-runtime/server/server.go | 2 +- integration/testdata/go/database/echo.go | 2 +- integration/testdata/go/externalcalls/echo.go | 3 ++- integration/testdata/go/httpingress/echo.go | 2 +- 27 files changed, 21 insertions(+), 19 deletions(-) rename go-runtime/{sdk => ftl}/call.go (100%) rename go-runtime/{sdk => ftl}/config.go (99%) rename go-runtime/{sdk => ftl}/config_test.go (100%) rename go-runtime/{sdk => ftl}/database.go (100%) rename go-runtime/{sdk => ftl}/logging.go (100%) rename go-runtime/{sdk => ftl}/observability/metrics.go (100%) rename go-runtime/{sdk => ftl}/observability/traces.go (100%) rename go-runtime/{sdk => ftl}/option.go (100%) rename go-runtime/{sdk => ftl}/option_test.go (100%) rename go-runtime/{sdk => ftl}/secrets.go (100%) rename go-runtime/{sdk => ftl}/secrets_test.go (100%) rename go-runtime/{sdk => ftl}/types.go (100%) diff --git a/cmd/ftl/cmd_call.go b/cmd/ftl/cmd_call.go index 5d1d0c6064..bbc5d5e3be 100644 --- a/cmd/ftl/cmd_call.go +++ b/cmd/ftl/cmd_call.go @@ -9,7 +9,7 @@ import ( "github.com/titanous/json5" "github.com/TBD54566975/ftl/backend/common/log" - "github.com/TBD54566975/ftl/go-runtime/sdk" + sdk "github.com/TBD54566975/ftl/go-runtime/ftl" ftlv1 "github.com/TBD54566975/ftl/protos/xyz/block/ftl/v1" "github.com/TBD54566975/ftl/protos/xyz/block/ftl/v1/ftlv1connect" ) diff --git a/examples/go/echo/echo.go b/examples/go/echo/echo.go index 659f235254..b4eec0cc7d 100644 --- a/examples/go/echo/echo.go +++ b/examples/go/echo/echo.go @@ -9,7 +9,7 @@ import ( "ftl/time" - "github.com/TBD54566975/ftl/go-runtime/sdk" + "github.com/TBD54566975/ftl/go-runtime/ftl" ) // An echo request. diff --git a/examples/go/httpingress/httpingress.go b/examples/go/httpingress/httpingress.go index d5109169e9..2a4d529947 100644 --- a/examples/go/httpingress/httpingress.go +++ b/examples/go/httpingress/httpingress.go @@ -7,7 +7,7 @@ import ( "ftl/builtin" - "github.com/TBD54566975/ftl/go-runtime/sdk" + "github.com/TBD54566975/ftl/go-runtime/ftl" ) type GetRequest struct { diff --git a/examples/online-boutique/services/checkout/checkout.go b/examples/online-boutique/services/checkout/checkout.go index 303a922f46..076720f311 100644 --- a/examples/online-boutique/services/checkout/checkout.go +++ b/examples/online-boutique/services/checkout/checkout.go @@ -17,7 +17,7 @@ import ( "github.com/TBD54566975/ftl/backend/common/slices" "github.com/TBD54566975/ftl/examples/online-boutique/common/money" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" ) type PlaceOrderRequest struct { diff --git a/examples/online-boutique/services/recommendation/recommendation.go b/examples/online-boutique/services/recommendation/recommendation.go index fa5264a074..85d990d8d5 100644 --- a/examples/online-boutique/services/recommendation/recommendation.go +++ b/examples/online-boutique/services/recommendation/recommendation.go @@ -9,7 +9,7 @@ import ( "ftl/builtin" "ftl/productcatalog" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" ) type ListRequest struct { diff --git a/go-runtime/compile/build.go b/go-runtime/compile/build.go index cd0aa42a16..38d85b374f 100644 --- a/go-runtime/compile/build.go +++ b/go-runtime/compile/build.go @@ -10,10 +10,11 @@ import ( "reflect" "strings" - "github.com/TBD54566975/scaffolder" "golang.org/x/mod/modfile" "google.golang.org/protobuf/proto" + "github.com/TBD54566975/scaffolder" + "github.com/TBD54566975/ftl" "github.com/TBD54566975/ftl/backend/common/exec" "github.com/TBD54566975/ftl/backend/common/log" @@ -175,7 +176,7 @@ var scaffoldFuncs = scaffolder.FuncMap{ imports["time"] = "stdtime" case *schema.Optional, *schema.Unit: - imports["github.com/TBD54566975/ftl/go-runtime/sdk"] = "" + imports["github.com/TBD54566975/ftl/go-runtime/ftl"] = "" default: } diff --git a/go-runtime/compile/schema.go b/go-runtime/compile/schema.go index c5e04fb7c9..54c7cd5480 100644 --- a/go-runtime/compile/schema.go +++ b/go-runtime/compile/schema.go @@ -27,7 +27,7 @@ var ( errorIFaceType = once(func() *types.Interface { return mustLoadRef("builtin", "error").Type().Underlying().(*types.Interface) //nolint:forcetypeassert }) - ftlCallFuncPath = "github.com/TBD54566975/ftl/go-runtime/sdk.Call" + ftlCallFuncPath = "github.com/TBD54566975/ftl/go-runtime/ftl.Call" aliasFieldTag = "alias" ) @@ -462,10 +462,10 @@ func visitType(pctx *parseContext, node ast.Node, tnode types.Type) (schema.Type case "time.Time": return &schema.Time{Pos: goPosToSchemaPos(node.Pos())}, nil - case "github.com/TBD54566975/ftl/go-runtime/sdk.Unit": + case "github.com/TBD54566975/ftl/go-runtime/ftl.Unit": return &schema.Unit{Pos: goPosToSchemaPos(node.Pos())}, nil - case "github.com/TBD54566975/ftl/go-runtime/sdk.Option": + case "github.com/TBD54566975/ftl/go-runtime/ftl.Option": underlying, err := visitType(pctx, node, named.TypeArgs().At(0)) if err != nil { return nil, err diff --git a/go-runtime/compile/testdata/one/one.go b/go-runtime/compile/testdata/one/one.go index eef34f128e..952476698a 100644 --- a/go-runtime/compile/testdata/one/one.go +++ b/go-runtime/compile/testdata/one/one.go @@ -6,7 +6,7 @@ import ( "time" "github.com/TBD54566975/ftl/go-runtime/compile/testdata/two" - "github.com/TBD54566975/ftl/go-runtime/sdk" + sdk "github.com/TBD54566975/ftl/go-runtime/ftl" ) type Nested struct { diff --git a/go-runtime/compile/testdata/two/two.go b/go-runtime/compile/testdata/two/two.go index 780f903233..c34f6d9f95 100644 --- a/go-runtime/compile/testdata/two/two.go +++ b/go-runtime/compile/testdata/two/two.go @@ -4,7 +4,7 @@ package two import ( "context" - "github.com/TBD54566975/ftl/go-runtime/sdk" + sdk "github.com/TBD54566975/ftl/go-runtime/ftl" ) type User struct { diff --git a/go-runtime/encoding/encoding_test.go b/go-runtime/encoding/encoding_test.go index 1276dbd88a..97293cc023 100644 --- a/go-runtime/encoding/encoding_test.go +++ b/go-runtime/encoding/encoding_test.go @@ -6,7 +6,7 @@ import ( "github.com/alecthomas/assert/v2" . "github.com/TBD54566975/ftl/go-runtime/encoding" - "github.com/TBD54566975/ftl/go-runtime/sdk" + sdk "github.com/TBD54566975/ftl/go-runtime/ftl" ) func TestMarshal(t *testing.T) { diff --git a/go-runtime/sdk/call.go b/go-runtime/ftl/call.go similarity index 100% rename from go-runtime/sdk/call.go rename to go-runtime/ftl/call.go diff --git a/go-runtime/sdk/config.go b/go-runtime/ftl/config.go similarity index 99% rename from go-runtime/sdk/config.go rename to go-runtime/ftl/config.go index efb49441ac..1f34dfc4a0 100644 --- a/go-runtime/sdk/config.go +++ b/go-runtime/ftl/config.go @@ -49,7 +49,7 @@ func callerModule() string { panic("failed to get caller") } module := details.Name() - if strings.HasPrefix(module, "github.com/TBD54566975/ftl/go-runtime/sdk") { + if strings.HasPrefix(module, "github.com/TBD54566975/ftl/go-runtime/ftl") { return "testing" } if !strings.HasPrefix(module, "ftl/") { diff --git a/go-runtime/sdk/config_test.go b/go-runtime/ftl/config_test.go similarity index 100% rename from go-runtime/sdk/config_test.go rename to go-runtime/ftl/config_test.go diff --git a/go-runtime/sdk/database.go b/go-runtime/ftl/database.go similarity index 100% rename from go-runtime/sdk/database.go rename to go-runtime/ftl/database.go diff --git a/go-runtime/sdk/logging.go b/go-runtime/ftl/logging.go similarity index 100% rename from go-runtime/sdk/logging.go rename to go-runtime/ftl/logging.go diff --git a/go-runtime/sdk/observability/metrics.go b/go-runtime/ftl/observability/metrics.go similarity index 100% rename from go-runtime/sdk/observability/metrics.go rename to go-runtime/ftl/observability/metrics.go diff --git a/go-runtime/sdk/observability/traces.go b/go-runtime/ftl/observability/traces.go similarity index 100% rename from go-runtime/sdk/observability/traces.go rename to go-runtime/ftl/observability/traces.go diff --git a/go-runtime/sdk/option.go b/go-runtime/ftl/option.go similarity index 100% rename from go-runtime/sdk/option.go rename to go-runtime/ftl/option.go diff --git a/go-runtime/sdk/option_test.go b/go-runtime/ftl/option_test.go similarity index 100% rename from go-runtime/sdk/option_test.go rename to go-runtime/ftl/option_test.go diff --git a/go-runtime/sdk/secrets.go b/go-runtime/ftl/secrets.go similarity index 100% rename from go-runtime/sdk/secrets.go rename to go-runtime/ftl/secrets.go diff --git a/go-runtime/sdk/secrets_test.go b/go-runtime/ftl/secrets_test.go similarity index 100% rename from go-runtime/sdk/secrets_test.go rename to go-runtime/ftl/secrets_test.go diff --git a/go-runtime/sdk/types.go b/go-runtime/ftl/types.go similarity index 100% rename from go-runtime/sdk/types.go rename to go-runtime/ftl/types.go diff --git a/go-runtime/scaffolding/{{ .Name | camel | lower }}/{{ .Name | camel | lower }}.go.tmpl b/go-runtime/scaffolding/{{ .Name | camel | lower }}/{{ .Name | camel | lower }}.go.tmpl index 25e8356a29..2d6a0d4599 100644 --- a/go-runtime/scaffolding/{{ .Name | camel | lower }}/{{ .Name | camel | lower }}.go.tmpl +++ b/go-runtime/scaffolding/{{ .Name | camel | lower }}/{{ .Name | camel | lower }}.go.tmpl @@ -5,7 +5,7 @@ import ( "context" "fmt" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK. + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK. ) type EchoRequest struct { diff --git a/go-runtime/server/server.go b/go-runtime/server/server.go index 1b52643dd1..17611e08c1 100644 --- a/go-runtime/server/server.go +++ b/go-runtime/server/server.go @@ -15,7 +15,7 @@ import ( "github.com/TBD54566975/ftl/backend/common/plugin" "github.com/TBD54566975/ftl/backend/common/rpc" "github.com/TBD54566975/ftl/go-runtime/encoding" - sdkgo "github.com/TBD54566975/ftl/go-runtime/sdk" + sdkgo "github.com/TBD54566975/ftl/go-runtime/ftl" ftlv1 "github.com/TBD54566975/ftl/protos/xyz/block/ftl/v1" "github.com/TBD54566975/ftl/protos/xyz/block/ftl/v1/ftlv1connect" ) diff --git a/integration/testdata/go/database/echo.go b/integration/testdata/go/database/echo.go index 43c297da06..15c100013c 100644 --- a/integration/testdata/go/database/echo.go +++ b/integration/testdata/go/database/echo.go @@ -4,7 +4,7 @@ package echo import ( "context" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK. + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK. ) var db = ftl.PostgresDatabase("testdb") diff --git a/integration/testdata/go/externalcalls/echo.go b/integration/testdata/go/externalcalls/echo.go index b335fd108d..3a0f839533 100644 --- a/integration/testdata/go/externalcalls/echo.go +++ b/integration/testdata/go/externalcalls/echo.go @@ -6,7 +6,8 @@ import ( "fmt" "ftl/echo2" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK. + + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK. ) type EchoRequest struct { diff --git a/integration/testdata/go/httpingress/echo.go b/integration/testdata/go/httpingress/echo.go index 63c9a6ef13..f237b627a2 100644 --- a/integration/testdata/go/httpingress/echo.go +++ b/integration/testdata/go/httpingress/echo.go @@ -7,7 +7,7 @@ import ( "ftl/builtin" - ftl "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK. + ftl "github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK. ) type GetRequest struct {