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

types.ftl.go does not import ftl correctly #4910

Open
matt2e opened this issue Mar 19, 2025 · 0 comments
Open

types.ftl.go does not import ftl correctly #4910

matt2e opened this issue Mar 19, 2025 · 0 comments
Labels
bug Something isn't working next Work that will be be picked up next

Comments

@matt2e
Copy link
Collaborator

matt2e commented Mar 19, 2025

Steps:

Add this verb to examples/go/time/time.go

//ftl:verb export
func OptionalResponse(ctx context.Context, rew TimeRequest) (ftl.Option[TimeResponse], error) {
	return ftl.None[TimeResponse](), fmt.Errorf("not implemented")
}

Add this verb to examples/go/echo/echo.go

//ftl:verb
func CallsOptionalResponse(ctx context.Context, client time.OptionalResponseClient) error {
	_, err := client(ctx, time.TimeRequest{})
	return err
}

This causes echo's types.ftl.go to be generated like this:

<...>
import (
	"context"
	ftltime "ftl/time"
	"github.com/block/ftl/common/reflection"
	"github.com/block/ftl/go-runtime/server"
)
<...>
		reflection.ProvideResourcesForVerb(
			CallsOptionalResponse,
			server.VerbClient[ftltime.OptionalResponseClient, ftltime.TimeRequest, ftl.Option[ftltime.TimeResponse]](),
		),
<...>

We get this build error:
Build failed: types.ftl.go:20:75: undefined: ftl because the verb client refers to ftl.Option but imports do not include ftl

@github-actions github-actions bot added the triage Issue needs triaging label Mar 19, 2025
@bradleydwyer bradleydwyer added the next Work that will be be picked up next label Mar 25, 2025
@github-actions github-actions bot removed the triage Issue needs triaging label Mar 25, 2025
@bradleydwyer bradleydwyer added the bug Something isn't working label Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next Work that will be be picked up next
Projects
None yet
Development

No branches or pull requests

2 participants