Melkeydev/go-blueprint

Have each framework have their own set of templates

Closed this issue · 0 comments

To make it easier to generate different types of go projects, CLI, HTTP servers, and TCP/UDP servers.

Each framework should have its templates instead of sharing files.

This will increase the duplication of common files like README, .gitignore, and .air.toml.
But, it will increase the flexibility of the different types of frameworks that can be supported.

Maybe a structure like this Where each framework exposes its own embed.FS.

  • cmd/template/chi/fs.go
  • cmd/template/chi/internal/server/routes.go.tmpl
  • cmd/template/chi/internal/server/server.go.tmpl
  • cmd/template/chi/Makefile.tmpl
  • cmd/template/chi/cmd/api/main.go.tmpl
  • cmd/template/chi/.gitignore.tmpl
  • cmd/template/chi/.air.toml.tmpl
  • cmd/template/chi/README.md.tmpl

The contents of cmd/template/chi/fs.go are the following.

package chi

import "embed"

//go:embed internal cmd all:*.tmpl
var FS embed.FS

I have a concept of this working.
Let me know if you are interested.