Skip to content

Commit

Permalink
add testdata for modulewatch
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Oct 2, 2024
1 parent 7a9d70c commit 163d4e3
Show file tree
Hide file tree
Showing 38 changed files with 1,277 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/modulewatch/testdata/alpha/alpha.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package alpha

import (
"context"
"fmt"

"ftl/other"

"github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK.
)

type EchoRequest struct {
Name ftl.Option[string] `json:"name"`
}

type EchoResponse struct {
Message string `json:"message"`
}

//ftl:verb
func Echo(ctx context.Context, req EchoRequest, oc other.EchoClient) (EchoResponse, error) {
oc(ctx, other.EchoRequest{})
return EchoResponse{Message: fmt.Sprintf("Hello, %s!", req.Name.Default("anonymous"))}, nil
}
2 changes: 2 additions & 0 deletions internal/modulewatch/testdata/alpha/ftl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module = "alpha"
language = "go"
63 changes: 63 additions & 0 deletions internal/modulewatch/testdata/alpha/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
module ftl/alpha

go 1.23.0

require github.com/TBD54566975/ftl v0.129.2

require (
connectrpc.com/connect v1.16.2 // indirect
connectrpc.com/grpcreflect v1.2.0 // indirect
connectrpc.com/otelconnect v0.7.1 // indirect
github.com/XSAM/otelsql v0.34.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/kong v1.2.1 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/alecthomas/types v0.16.0 // indirect
github.com/alessio/shellescape v1.4.2 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/cronexpr v1.1.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect
github.com/swaggest/jsonschema-go v0.3.72 // indirect
github.com/swaggest/refl v1.3.0 // indirect
github.com/zalando/go-keyring v0.2.5 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

replace github.com/TBD54566975/ftl => ../../../..
248 changes: 248 additions & 0 deletions internal/modulewatch/testdata/alpha/go.sum

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions internal/modulewatch/testdata/alpha/pkg/pkg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package pkg

import (
"context"
"ftl/another"
)

func Pkg(ec another.EchoClient) {
ec(context.Background(), another.EchoRequest{})
}
22 changes: 22 additions & 0 deletions internal/modulewatch/testdata/alpha/types.ftl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ftl.alpha

import ftl.builtin.Empty
import ftl.other.Other
import xyz.block.ftl.Context
import xyz.block.ftl.Export

data class EchoRequest(val name: String?)
data class EchoResponse(val message: String)

@Export
fun echo(context: Context, req: EchoRequest): EchoResponse {
val other = Other()
return EchoResponse(message = "Hello, ${req.name ?: "anonymous"}!.")
}
54 changes: 54 additions & 0 deletions internal/modulewatch/testdata/another/another.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package another

import (
"context"
"fmt"

"github.com/TBD54566975/ftl/go-runtime/ftl" // Import the FTL SDK.
lib "github.com/TBD54566975/ftl/go-runtime/schema/testdata"
)

//ftl:enum export
type TypeEnum interface {
tag()
}

type A int

func (A) tag() {}

type B string

func (B) tag() {}

//ftl:enum export
type SecondTypeEnum interface{ typeEnum() }

type One int

func (One) typeEnum() {}

type Two string

func (Two) typeEnum() {}

//ftl:data export
type TransitiveTypeEnum struct {
TypeEnumRef SecondTypeEnum
}

type EchoRequest struct {
Name ftl.Option[string] `json:"name"`
}

type EchoResponse struct {
Message string `json:"message"`
}

//ftl:verb export
func Echo(ctx context.Context, req EchoRequest) (EchoResponse, error) {
return EchoResponse{Message: fmt.Sprintf("Hello, %s!", req.Name.Default("anonymous"))}, nil
}

//ftl:typealias export
type External lib.AnotherNonFTLType
2 changes: 2 additions & 0 deletions internal/modulewatch/testdata/another/ftl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module = "another"
language = "go"
49 changes: 49 additions & 0 deletions internal/modulewatch/testdata/another/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module ftl/another

go 1.23.0

require github.com/TBD54566975/ftl v0.129.2

require (
connectrpc.com/connect v1.16.2 // indirect
connectrpc.com/grpcreflect v1.2.0 // indirect
connectrpc.com/otelconnect v0.7.1 // indirect
github.com/XSAM/otelsql v0.34.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/alecthomas/types v0.16.0 // indirect
github.com/alessio/shellescape v1.4.2 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/hashicorp/cronexpr v1.1.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect
github.com/swaggest/jsonschema-go v0.3.72 // indirect
github.com/swaggest/refl v1.3.0 // indirect
github.com/zalando/go-keyring v0.2.5 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

replace github.com/TBD54566975/ftl => ../../../..
Loading

0 comments on commit 163d4e3

Please sign in to comment.