Skip to content

Commit

Permalink
create: replace vfs with embed
Browse files Browse the repository at this point in the history
This patch must be accepted after golang/go#43854

Closes #631
  • Loading branch information
mRrvz authored and DifferentialOrange committed Jan 11, 2022
1 parent f4d55d1 commit 1f6a2d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 56 deletions.
42 changes: 0 additions & 42 deletions cli/codegen/generate_templates_vfs.go

This file was deleted.

1 change: 0 additions & 1 deletion cli/codegen/static/doc.go

This file was deleted.

12 changes: 0 additions & 12 deletions cli/codegen/static/static.go

This file was deleted.

8 changes: 7 additions & 1 deletion cli/create/create.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package create

import (
"embed"
"fmt"
"net/http"
"os"

"github.com/tarantool/cartridge-cli/cli/common"
Expand All @@ -13,6 +15,10 @@ import (
"github.com/tarantool/cartridge-cli/cli/create/templates"
)

// TODO: add flag when https://github.com/golang/go/issues/43854 is released.
//go:embed templates/cartridge/*
var createCartridgeTemplateFS embed.FS

// Run creates a project in ctx.Project.Path
func Run(ctx *context.Ctx) error {
common.CheckRecommendedBinaries("git")
Expand All @@ -37,7 +43,7 @@ func Run(ctx *context.Ctx) error {
if ctx.Create.From == "" {
switch ctx.Create.Template {
case "cartridge":
ctx.Create.TemplateFS = CreateCartridgeTemplateFS
ctx.Create.TemplateFS = http.FS(createCartridgeTemplateFS)
default:
return fmt.Errorf("Invalid template name: %s", ctx.Create.Template)
}
Expand Down

0 comments on commit 1f6a2d3

Please sign in to comment.