Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤗 [Question]: How to export mustache engine as a template.IEngine ? #299

Closed
3 tasks done
ip75 opened this issue Sep 29, 2023 · 1 comment · Fixed by #300
Closed
3 tasks done

🤗 [Question]: How to export mustache engine as a template.IEngine ? #299

ip75 opened this issue Sep 29, 2023 · 1 comment · Fixed by #300
Labels
🤔 Question Further information is requested

Comments

@ip75
Copy link

ip75 commented Sep 29, 2023

Question Description

error:

cannot use mustache (variable of type *"github.com/gofiber/template/mustache/v2".Engine) as "github.com/gofiber/template".IEngine value in return statement: *"github.com/gofiber/template/mustache/v2".Engine does not implement "github.com/gofiber/template".IEngine (wrong type for method AddFunc)
		have AddFunc(string, interface{}) *"github.com/gofiber/template".Engine
		want AddFunc(string, interface{}) "github.com/gofiber/template".IEngineCore

Code Snippet (optional)

import (
	"embed"
	"net/http"

	"github.com/gofiber/template"
	"github.com/gofiber/template/mustache/v2"
)

//go:embed templates/*
var fs embed.FS

func NewTemplatesEngine() template.IEngine {
	mustache := mustache.NewFileSystem(http.FS(fs), ".mustache")
	return mustache
}

I looked through template.go and see that you returns *Engine instead of IEngineCore in all interface methods

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.
@ip75 ip75 added the 🤔 Question Further information is requested label Sep 29, 2023
@ip75 ip75 changed the title 🤗 [Question]: How to export mustache engine as template.IEngine ? 🤗 [Question]: How to export mustache engine as a template.IEngine ? Sep 29, 2023
@ip75
Copy link
Author

ip75 commented Sep 29, 2023

i generated pull request for this, please check it.
#300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant