diff --git a/cmd/ftl/cmd_init.go b/cmd/ftl/cmd_init.go index 9214f063d4..696dcafdbd 100644 --- a/cmd/ftl/cmd_init.go +++ b/cmd/ftl/cmd_init.go @@ -30,8 +30,9 @@ type initCmd struct { } type initGoCmd struct { - Dir string `arg:"" help:"Directory to initialize the module in."` - Name string `arg:"" help:"Name of the FTL module to create underneath the base directory."` + Replace map[string]string `short:"r" help:"Replace a module import path with a local path in the initialised FTL module." placeholder:"OLD=NEW,..."` + Dir string `arg:"" help:"Directory to initialize the module in."` + Name string `arg:"" help:"Name of the FTL module to create underneath the base directory."` } func (i initGoCmd) Run(ctx context.Context, parent *initCmd) error { diff --git a/go-runtime/scaffolding/go.mod b/go-runtime/scaffolding/go.mod index ba81923038..e320d797b4 100644 --- a/go-runtime/scaffolding/go.mod +++ b/go-runtime/scaffolding/go.mod @@ -1,4 +1,4 @@ // This needs to exist so that the Go toolchain doesn't include this directory. Annoying. module exclude -go 1.21.6 \ No newline at end of file +go 1.21.6 diff --git a/go-runtime/scaffolding/{{ .Name | camel | lower }}/go.mod.tmpl b/go-runtime/scaffolding/{{ .Name | camel | lower }}/go.mod.tmpl index b43a2153ed..372814bd3b 100644 --- a/go-runtime/scaffolding/{{ .Name | camel | lower }}/go.mod.tmpl +++ b/go-runtime/scaffolding/{{ .Name | camel | lower }}/go.mod.tmpl @@ -2,4 +2,8 @@ module ftl/{{ .Name }} go 1.21 -require github.com/TBD54566975/ftl latest \ No newline at end of file +require github.com/TBD54566975/ftl latest + +{{- range $old, $new := .Replace }} +replace {{ $old }} => {{ $new }} +{{- end }} \ No newline at end of file