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

fix: pin to current ftl version #949

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module main

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

{{ if ne .FTLVersion "" }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, I think you can just do {{ if .FTLVersion }} to check for non-zero values.

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