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

Build fails when importing another module which doesn't use go-runtime/ftl #1095

Closed
matt2e opened this issue Mar 15, 2024 · 1 comment · Fixed by #1132
Closed

Build fails when importing another module which doesn't use go-runtime/ftl #1095

matt2e opened this issue Mar 15, 2024 · 1 comment · Fixed by #1132
Assignees

Comments

@matt2e
Copy link
Collaborator

matt2e commented Mar 15, 2024

Getting this build error when building a module which imports another module:
../modules/two/external_module.go:8:3: "github.com/TBD54566975/ftl/go-runtime/ftl" imported and not used

I worked around it by making use of ftl somehow, like by including an Option value somewhere

@github-actions github-actions bot added the triage Issue needs triaging label Mar 15, 2024
matt2e added a commit that referenced this issue Mar 17, 2024
Changes
- Incomplete module boilerplate for test modules
- `ftl/one` was using `two.User`, but `ftl/two` was not including it in
its schema
    - I've added a new Verb which makes use of User
- compiling schema was returning errors at the node that was reached
before finding an error, where as sometimes we have a more accurate
position available
- Now we pass around the latest position we dive deeper into all the
checks, rather than staying at the node's position
- Previously we would get an error on the verb location, rather than the
field on a struct that was used by the verb

Not included in this PR is a fix for #1095, which is why test/data is
using Option in the new verb
@matt2e
Copy link
Collaborator Author

matt2e commented Mar 24, 2024

Still seeing errors when go-runtime/compile/testdata/two.go changes ftl.Option[UserResponse] to UserResponse

@matt2e matt2e self-assigned this Mar 25, 2024
@github-actions github-actions bot removed the triage Issue needs triaging label Mar 25, 2024
matt2e added a commit that referenced this issue Mar 25, 2024
Fixes #1095

Sink & Source verbs would have a schema like
```
verb returnsUser(Unit) two.UserResponse
```
but the scaffolded `external_module.go` version of it would be:
```
func ReturnsUser(ctx context.Context) (UserResponse, error)
```

When generating imports, we were finding `schema.Unit` in the verb which
triggered an inclusion of ftl
This caused the exernal module to fail to build because ftl was not
being used by the generated code.

This fix now skips any unit in the schema if the parent is a verb
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.

1 participant