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

Handle calling Publish() on another module's topic #1640

Closed
Tracked by #1597
matt2e opened this issue Jun 4, 2024 · 1 comment · Fixed by #1702
Closed
Tracked by #1597

Handle calling Publish() on another module's topic #1640

matt2e opened this issue Jun 4, 2024 · 1 comment · Fixed by #1702
Assignees

Comments

@matt2e
Copy link
Collaborator

matt2e commented Jun 4, 2024

Either return an error or make it work.
Currently it sends the callees module name which could cause very weird issues.

@matt2e matt2e self-assigned this Jun 4, 2024
@matt2e matt2e mentioned this issue Jun 4, 2024
14 tasks
@ftl-robot ftl-robot mentioned this issue Jun 4, 2024
@alecthomas
Copy link
Collaborator

alecthomas commented Jun 4, 2024

This should be an error. Ideally we'd pick this up statically.

matt2e added a commit that referenced this issue Jun 11, 2024
Closes #1640
Checks for:
- publishing directly to an external module's exported topic
- directly calling an external module's verb, rather than using
`ftl.Call(...)`
- This already fails at runtime, but it's nice to have this as a compile
error

Both of these compile-time checks are not fool proof, any indirection
will mean these checks don't catch it. But it is good to catch what we
can.
eg:
```go
var extTopic = external.Topic
extTopic.Publish(...) // compiler believes this is a local topic
```
Added a separate issue for this for pubsub as it may not be as high a
priority: #1703
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