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

Cannot implement interfaces in a module #1747

Closed
mistermoe opened this issue Jun 12, 2024 · 0 comments · Fixed by #1748
Closed

Cannot implement interfaces in a module #1747

mistermoe opened this issue Jun 12, 2024 · 0 comments · Fixed by #1748
Assignees

Comments

@mistermoe
Copy link
Collaborator

mistermoe commented Jun 12, 2024

Repro

  1. replace the contents of examples/go/echo/echo.go with the following
// This is the echo module.
package echo

import (
	"context"
	"fmt"

	"ftl/time"

	"github.com/TBD54566975/ftl/go-runtime/ftl"
)

var defaultName = ftl.Config[string]("default")

type SomeInterface interface {
	A() string
}

type Thing struct{}

func (t Thing) A() string {
	return "thing"
}

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

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

// Echo returns a greeting with the current time.
//
//ftl:verb
func Echo(ctx context.Context, req EchoRequest) (EchoResponse, error) {
	tresp, err := ftl.Call(ctx, time.Time, time.TimeRequest{})
	if err != nil {
		return EchoResponse{}, err
	}

	return EchoResponse{Message: fmt.Sprintf("Hello, %s!!! It is %s!", req.Name.Default(defaultName.Get(ctx)), tresp.Time)}, nil
}
  1. run ftl dev --recreate ./examples/go

Output

❯ ftl dev --recreate ./examples/go
info: Starting FTL with 1 controller(s)
info:controller0: Web console available at: http://localhost:8892
info:controller0: HTTP ingress server listening on: http://localhost:8891
info: FTL startup command ⚡️
info:time: Building module
info:time: Deploying module
info:echo: Building module
info:controller0: Deployed dpl-time-5cblpvv3s76l8ufx
info: Modules waiting to build: echo
error: initial deploy failed: /path/to/ftl/examples/go/echo/echo.go:19:1-20: could not find enum called SomeInterface

Expected Behavior

error: initial deploy failed: /ftl/examples/go/echo/echo.go:19:1-20: could not find enum called SomeInterface

@github-actions github-actions bot added the triage Issue needs triaging label Jun 12, 2024
@ftl-robot ftl-robot mentioned this issue Jun 12, 2024
@matt2e matt2e self-assigned this Jun 12, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants