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

exporting verbs from a package within a module isn't working #1283

Closed
mistermoe opened this issue Apr 17, 2024 · 1 comment
Closed

exporting verbs from a package within a module isn't working #1283

mistermoe opened this issue Apr 17, 2024 · 1 comment

Comments

@mistermoe
Copy link
Collaborator

Project layout:

❯ tree .
.
└── modewl
    ├── _ftl
    │   ├── errors.pb
    │   ├── go
    │   │   ├── main
    │   │   │   ├── go.mod
    │   │   │   ├── go.sum
    │   │   │   └── main.go
    │   │   └── modules
    │   │       ├── builtin
    │   │       │   └── external_module.go
    │   │       └── go.mod
    │   ├── main
    │   └── schema.pb
    ├── ftl.toml
    ├── go.mod
    ├── go.sum
    ├── go.work
    ├── go.work.sum
    ├── modewl.go
    └── nested
        └── nested.go

7 directories, 15 files

1 module modewl. with a package inside it called nested. modewl/modewl.go has a verb and modewl/nested.gohas a verb

package modewl

import (
	"context"
	"fmt"

	"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:export
func Echo(ctx context.Context, req EchoRequest) (EchoResponse, error) {
	return EchoResponse{Message: fmt.Sprintf("Hello, %s!", req.Name.Default("anonymous"))}, nil
}
package nested

import "context"

type NestedRequest struct{}
type NestedResponse struct{}

//ftl:export
func Nested(ctx context.Context, req NestedRequest) (NestedResponse, error) {
	return NestedResponse{}, nil
}

Output from running ftl dev .

❯ ftl dev .
info: Starting FTL with 1 controller(s)
warn:heartbeatController: failed to heartbeat controller: conflict
info:modewl: Building module
info: Modules waiting to build: modewl
error: initial deploy failed: /tmp/project/modewl/nested/nested.go:9:1-2: function export directive must be in the module package
@github-actions github-actions bot added the triage Issue needs triaging label Apr 17, 2024
@mistermoe mistermoe changed the title exporting verbs from a package _within_ a module isn't working exporting verbs from a package within a module isn't working Apr 17, 2024
@worstell worstell removed the triage Issue needs triaging label Apr 17, 2024
@matt2e
Copy link
Collaborator

matt2e commented Jul 21, 2024

I think @worstell has completed this

@matt2e matt2e closed this as completed Jul 21, 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

No branches or pull requests

3 participants