Skip to content

Commit

Permalink
fix: pin to current ftl version
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman committed Feb 16, 2024
1 parent 52e3c27 commit 5bdde7a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module main

go {{ .GoVersion }}
go {{ .GoVersion }}

{{ if ne .FTLVersion "" }}
require github.com/TBD54566975/ftl {{ .FTLVersion }}
{{ end }}
33 changes: 21 additions & 12 deletions go-runtime/compile/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ import (
type externalModuleContext struct {
ModuleDir string
*schema.Schema
GoVersion string
Main string
GoVersion string
FTLVersion string
Main string
}

type goVerb struct {
Name string
}

type mainModuleContext struct {
GoVersion string
Name string
Verbs []goVerb
GoVersion string
FTLVersion string
Name string
Verbs []goVerb
}

func (b externalModuleContext) NonMainModules() []*schema.Module {
Expand All @@ -60,6 +62,11 @@ func Build(ctx context.Context, moduleDir string, sch *schema.Schema) error {
return err
}

ftlVersion := ""
if ftl.IsRelease(ftl.Version) {
ftlVersion = ftl.Version
}

config, err := moduleconfig.LoadConfig(moduleDir)
if err != nil {
return fmt.Errorf("failed to load module config: %w", err)
Expand All @@ -75,10 +82,11 @@ func Build(ctx context.Context, moduleDir string, sch *schema.Schema) error {

logger.Debugf("Generating external modules")
if err := internal.ScaffoldZip(externalModuleTemplateFiles(), moduleDir, externalModuleContext{
ModuleDir: moduleDir,
GoVersion: goModVersion,
Schema: sch,
Main: config.Module,
ModuleDir: moduleDir,
GoVersion: goModVersion,
FTLVersion: ftlVersion,
Schema: sch,
Main: config.Module,
}, scaffolder.Exclude("^go.mod$"), scaffolder.Functions(funcs)); err != nil {
return err
}
Expand Down Expand Up @@ -114,9 +122,10 @@ func Build(ctx context.Context, moduleDir string, sch *schema.Schema) error {
}
}
if err := internal.ScaffoldZip(buildTemplateFiles(), moduleDir, mainModuleContext{
GoVersion: goModVersion,
Name: main.Name,
Verbs: goVerbs,
GoVersion: goModVersion,
FTLVersion: ftlVersion,
Name: main.Name,
Verbs: goVerbs,
}, scaffolder.Exclude("^go.mod$"), scaffolder.Functions(funcs)); err != nil {
return err
}
Expand Down

0 comments on commit 5bdde7a

Please sign in to comment.