generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(go-scaffolding): simplify Go layout (#521)
Also added a README to the template to explain the directory structure.
- Loading branch information
1 parent
090f67d
commit 287cef3
Showing
10 changed files
with
75 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# FTL modules | ||
|
||
Each subdirectory represents an FTL module. Remote modules will be | ||
code-generated into their own directories, one module per directory. Note that | ||
this is a temporary solution. | ||
|
||
For example given an `echo` module written in Go that calls a `time` module | ||
written in Kotlin, the filesystem might look like this once the FTL tooling is | ||
started: | ||
|
||
``` | ||
README.md | ||
go.mod | ||
echo/ftl.toml | ||
echo/echo.go | ||
time/generated_ftl_module.go | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module {{ .GoModule }} | ||
module ftl | ||
|
||
go 1.21.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module = "{{ .Name }}" | ||
language = "go" | ||
deploy = ["build/main", "build/schema.pb"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ftl/{{ .Name | camel | lower }} | ||
|
||
go 1.21.0 | ||
|
||
require github.com/TBD54566975/ftl latest |
21 changes: 21 additions & 0 deletions
21
go-runtime/scaffolding/{{ .Name | camel | lower }}/{{ .Name | camel | lower }}.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package {{ .Name | camel | lower }} | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
_ "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK. | ||
) | ||
|
||
type EchoRequest struct { | ||
Name string `json:"name'` | ||
} | ||
|
||
type EchoResponse struct { | ||
Message string `json:"message"` | ||
} | ||
|
||
//ftl:verb | ||
func echo(ctx context.Context, req EchoRequest) (EchoResponse, error) { | ||
return EchoResponse{Message: fmt.Sprintf("Hello, %s!", req.Name)}, nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters