diff --git a/cmd/program/program.go b/cmd/program/program.go index 1f655cf1..b55d05e1 100644 --- a/cmd/program/program.go +++ b/cmd/program/program.go @@ -20,7 +20,7 @@ type Project struct { } type Framework struct { - packageName string + packageName []string templater Templater } @@ -30,12 +30,13 @@ type Templater interface { Routes() []byte } -const ( - chiPackage = "github.com/go-chi/chi/v5" - gorillaPackage = "github.com/gorilla/mux" - routerPackage = "github.com/julienschmidt/httprouter" - ginPackage = "github.com/gin-gonic/gin" - fiberPackage = "github.com/gofiber/fiber/v2" +var ( + chiPackage = []string{"github.com/go-chi/chi/v5"} + gorillaPackage = []string{"github.com/gorilla/mux"} + routerPackage = []string{"github.com/julienschmidt/httprouter"} + ginPackage = []string{"github.com/gin-gonic/gin"} + fiberPackage = []string{"github.com/gofiber/fiber/v2"} + echoPackage = []string{"github.com/labstack/echo/v4", "github.com/labstack/echo/v4/middleware"} cmdApiPath = "cmd/api" internalServerPath = "internal/server" @@ -50,14 +51,13 @@ func (p *Project) ExitCLI(tprogram *tea.Program) { } func (p *Project) createFrameworkMap() { - p.FrameworkMap["chi"] = Framework{ packageName: chiPackage, templater: tpl.ChiTemplates{}, } p.FrameworkMap["standard library"] = Framework{ - packageName: "", + packageName: []string{}, templater: tpl.StandardLibTemplate{}, } @@ -80,6 +80,11 @@ func (p *Project) createFrameworkMap() { packageName: routerPackage, templater: tpl.RouterTemplates{}, } + + p.FrameworkMap["echo"] = Framework{ + packageName: echoPackage, + templater: tpl.EchoTemplates{}, + } } func (p *Project) CreateMainFile() error { @@ -193,6 +198,12 @@ func (p *Project) CreateMainFile() error { if err != nil { return err } + err = utils.GoFmt(projectPath) + if err != nil { + log.Printf("Could not gofmt in new project %v\n", err) + cobra.CheckErr(err) + } + return nil }