github.com/shoshinnikita/budget-manager@v0.7.1-0.20220131195411-8c46ff1c6778/templates/templates.go (about)

     1  package templates
     2  
     3  import (
     4  	_ "embed" //nolint:gci
     5  	"io/fs"
     6  
     7  	"github.com/ShoshinNikita/budget-manager/internal/pkg/embed"
     8  )
     9  
    10  //go:embed *
    11  var templates embed.FS //nolint:gochecknoglobals
    12  
    13  func New(useEmbed bool) fs.ReadDirFS {
    14  	if useEmbed {
    15  		return templates
    16  	}
    17  	return embed.DirFS("templates")
    18  }