diff --git a/go-runtime/compile/build.go b/go-runtime/compile/build.go index bb7bc75ee5..0a98a235f9 100644 --- a/go-runtime/compile/build.go +++ b/go-runtime/compile/build.go @@ -282,6 +282,10 @@ var scaffoldFuncs = scaffolder.FuncMap{ case *schema.Optional, *schema.Unit: imports["github.com/TBD54566975/ftl/go-runtime/ftl"] = "" + case *schema.Topic: + if n.IsExported() { + imports["github.com/TBD54566975/ftl/go-runtime/ftl"] = "" + } default: } return next() @@ -368,15 +372,6 @@ var scaffoldFuncs = scaffolder.FuncMap{ } return out }, - "needsFTLImport": func(m *schema.Module) bool { - for _, d := range m.Decls { - if topic, ok := d.(*schema.Topic); ok && topic.IsExported() { - // uses ftl.Topic(...) function calls - return true - } - } - return false - }, } func schemaType(t schema.Type) string { diff --git a/go-runtime/compile/external-module-template/_ftl/go/modules/{{ range .NonMainModules }}{{ push .Name . }}{{ end }}/external_module.go.tmpl b/go-runtime/compile/external-module-template/_ftl/go/modules/{{ range .NonMainModules }}{{ push .Name . }}{{ end }}/external_module.go.tmpl index 06ce2d82b0..a7c7c1b2de 100644 --- a/go-runtime/compile/external-module-template/_ftl/go/modules/{{ range .NonMainModules }}{{ push .Name . }}{{ end }}/external_module.go.tmpl +++ b/go-runtime/compile/external-module-template/_ftl/go/modules/{{ range .NonMainModules }}{{ push .Name . }}{{ end }}/external_module.go.tmpl @@ -12,10 +12,6 @@ import ( "github.com/TBD54566975/ftl/go-runtime/ftl/reflection" {{- end}} -{{- if $ | needsFTLImport }} - - "github.com/TBD54566975/ftl/go-runtime/ftl" -{{- end}} ) var _ = context.Background